From: Peter Amstutz Date: Fri, 13 May 2022 21:51:06 +0000 (-0400) Subject: 17004: Test for setting final output properties from inside container X-Git-Tag: 2.5.0~165^2~2 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/1e7856bffea0d0ecfcf940de90243dea0fbd3c2f 17004: Test for setting final output properties from inside container Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- diff --git a/sdk/cwl/tests/17004-output-props.cwl b/sdk/cwl/tests/17004-output-props.cwl new file mode 100644 index 0000000000..4cf03bade8 --- /dev/null +++ b/sdk/cwl/tests/17004-output-props.cwl @@ -0,0 +1,22 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +class: Workflow +cwlVersion: v1.2 +$namespaces: + arv: "http://arvados.org/cwl#" +hints: + arv:OutputCollectionProperties: + outputProperties: + foo: bar + baz: $(inputs.inp.basename) +inputs: + inp: File +steps: + cat: + in: + inp: inp + run: cat.cwl + out: [] +outputs: [] diff --git a/sdk/cwl/tests/arvados-tests.sh b/sdk/cwl/tests/arvados-tests.sh index 1bbaa505e9..e3f1622836 100755 --- a/sdk/cwl/tests/arvados-tests.sh +++ b/sdk/cwl/tests/arvados-tests.sh @@ -28,5 +28,9 @@ arvados-cwl-runner 18888-download_def.cwl --scripts scripts/ # integration test to check for the expected behavior. python test_copy_deps.py +# Test for #17004 +# Checks that the final output collection has the expected properties. +python test_set_output_prop.py + # Run integration tests exec cwltest --test arvados-tests.yml --tool arvados-cwl-runner $@ -- --disable-reuse --compute-checksum --api=containers diff --git a/sdk/cwl/tests/test_set_output_prop.py b/sdk/cwl/tests/test_set_output_prop.py new file mode 100644 index 0000000000..3219eac989 --- /dev/null +++ b/sdk/cwl/tests/test_set_output_prop.py @@ -0,0 +1,37 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +import arvados +import subprocess + +api = arvados.api() + +def test_execute(): + group = api.groups().create(body={"group": {"name": "test-17004-project", "group_class": "project"}}, ensure_unique_name=True).execute() + try: + contents = api.groups().contents(uuid=group["uuid"]).execute() + if len(contents["items"]) != 0: + raise Exception("Expected 0 items") + + cmd = ["arvados-cwl-runner", "--project-uuid", group["uuid"], "17004-output-props.cwl", "--inp", "scripts/download_all_data.sh"] + print(" ".join(cmd)) + subprocess.check_output(cmd) + + contents = api.groups().contents(uuid=group["uuid"]).execute() + + found = False + for c in contents["items"]: + if (c["kind"] == "arvados#collection" and + c["properties"].get("type") == "output" and + c["properties"].get("foo") == "bar" and + c["properties"].get("baz") == "download_all_data.sh"): + found = True + if not found: + raise Exception("Didn't find collection with properties") + + finally: + api.groups().delete(uuid=group["uuid"]).execute() + +if __name__ == '__main__': + test_execute()