This directory contains a suite of tests designed to validate the functionality of the ../../sapporo/ro-crate.py
script with in the Sapporo project. The script is executed by run.sh
after each workflow run to generate a ro-crate-metadata.json
file in the corresponding run directory, leveraging the RO-Crate standard.
The generate_ro_crate function in `run.sh`` triggers the execution of ro-crate.py as shown below:
function generate_ro_crate() {
python3 -c "from sapporo.ro_crate import generate_ro_crate; generate_ro_crate('${run_dir}')" || echo "{}" >"${run_dir}/ro-crate-metadata.json" || true
}
The tests aim to verify that RO-Crate metadata files are correctly generated across different workflow engines. This directory also provides example RO-Crates for reference.
To execute the tests, various workflows located in the ../curl_example directory are run, followed by verification of the generated RO-Crates.
Run the following commands to initiate the tests:
# Setup and start Sapporo (Execute from the root directory of the library)
$ cd ../../
$ docker compose -f compose.dev.yml up -d
$ docker compose -f compose.dev.yml exec app sapporo
# Run the RO-Crate tests
$ cd tests/ro-crate
$ bash run_ro-crate_test.sh
Generating a Sample ./ro-crate-metadata.json
The provided ./ro-crate-metadata.json
serves as a small example of an RO-Crate generated by Sapporo. It can be produced using Yevis-cli, a client for submitting run requests to Sapporo. The following steps demonstrate how to generate this sample:
# Initialize Sapporo service on localhost:1122
$ ./yevis --version
yevis 0.5.8
$ yevis test --wes-location http://localhost:1122 --fetch-ro-crate \
https://raw.githubusercontent.com/sapporo-wes/yevis-cli/main/tests/test-metadata-CWL-apache2.yml
Start yevis
Running validate
Validating https://raw.githubusercontent.com/sapporo-wes/yevis-cli/main/tests/test-metadata-CWL-apache2.yml
Success validate
Running test
Use WES location: http://localhost:1122/ for testing
Test workflow_id: c13b6e27-a4ee-426f-8bdb-8cf5c4310bad, version: 1.0.0
Testing test case: test_1
WES run_id: 27469c13-2f6d-47af-9623-39cdee5f1a04
Complete test case: test_1
Passed all test cases in workflow_id: c13b6e27-a4ee-426f-8bdb-8cf5c4310bad, version: 1.0.0
Success test
sapporo-service is not running. So skip stopping it.
$ ls test-logs/
ro-crate-metadata_c13b6e27-a4ee-426f-8bdb-8cf5c4310bad_1.0.0_test_1.json
$ cp test-logs/ro-crate-metadata_c13b6e27-a4ee-426f-8bdb-8cf5c4310bad_1.0.0_test_1.json ./ro-crate-metadata.json
You can also copy the complete run directory to the ro-crate_dir for further inspection:
cp -r ../../run/27/27469c13-2f6d-47af-9623-39cdee5f1a04 ./ro-crate_dir
According to the Crate section of Workflow-RO-Crate, "The Crate MUST specify a license. The license is assumed to apply to any content of the crate, unless overridden by a license on individual File entities." While Sapporo aims to add a license during the Workflow-Run-Crate creation, it currently lacks a feature for specifying a license at the time of workflow execution due to WES limitations. Future updates are planned to allow license specification through Yevis-cli. For now, the license property is added manually as a quick fix.