Skip to content

Commit 49fc1c3

Browse files
authored
tests: reduce number of software containers (#1718)
As inspired by the list at https://github.com/common-workflow-language/cwl-v1.2/blob/1.2.1_proposed/CONFORMANCE_TESTS.md#writing-a-new-conformance-test Also fixes a Singularity 3 bug
1 parent 79fd363 commit 49fc1c3

31 files changed

+73
-33
lines changed

cwltool/singularity.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def get_image(
184184
candidates.append(dockerRequirement["dockerImageId"])
185185
candidates.append(_normalize_image_id(dockerRequirement["dockerImageId"]))
186186
if is_version_3_or_newer():
187-
candidates.append(_normalize_sif_id(dockerRequirement["dockerPull"]))
187+
candidates.append(_normalize_sif_id(dockerRequirement["dockerImageId"]))
188188

189189
targets = [os.getcwd()]
190190
if "CWL_SINGULARITY_CACHE" in os.environ:

tests/debian_image_id.cwl

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ class: CommandLineTool
44

55
requirements:
66
DockerRequirement:
7-
dockerImageId: 'debian.img'
7+
dockerImageId: 'debian:stable-slim.img'
88

99
inputs:
1010
message: string
1111

1212
outputs: []
1313

14-
baseCommand: echo
14+
baseCommand: echo

tests/debian_image_id2.cwl

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.0
3+
class: CommandLineTool
4+
5+
requirements:
6+
DockerRequirement:
7+
dockerImageId: 'docker.io_debian:stable-slim.sif'
8+
9+
inputs:
10+
message: string
11+
12+
outputs: []
13+
14+
baseCommand: echo

tests/echo-job.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cwl:requirements:
22
- class: DockerRequirement
3-
dockerPull: docker.io/debian
3+
dockerPull: docker.io/debian:stable-slim
44

55
inp: "Howdy!"

tests/non_portable.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class: CommandLineTool
44

55
requirements:
66
DockerRequirement:
7-
dockerPull: docker.io/debian
7+
dockerPull: docker.io/debian:stable-slim
88
InitialWorkDirRequirement:
99
listing:
1010
- class: File

tests/non_portable2.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class: CommandLineTool
44

55
hints:
66
DockerRequirement:
7-
dockerPull: docker.io/debian
7+
dockerPull: docker.io/debian:stable-slim
88
dockerOutputDirectory: /var/spool/cwl
99
InitialWorkDirRequirement:
1010
listing:

tests/portable.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class: CommandLineTool
44

55
requirements:
66
DockerRequirement:
7-
dockerPull: docker.io/debian
7+
dockerPull: docker.io/debian:stable-slim
88
dockerOutputDirectory: /var/spool/cwl
99
InitialWorkDirRequirement:
1010
listing:

tests/sing_pullfolder_test.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class: CommandLineTool
44

55
requirements:
66
DockerRequirement:
7-
dockerPull: docker.io/debian
7+
dockerPull: docker.io/debian:stable-slim
88

99
inputs:
1010
message: string

tests/test_docker_info.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
def test_docker_mem() -> None:
66
error_code, stdout, stderr = get_main_output(
77
[
8-
"--default-container=debian",
8+
"--default-container=docker.io/debian:stable-slim",
99
"--enable-ext",
1010
get_data("tests/wf/timelimit.cwl"),
1111
"--sleep_time",

tests/test_singularity.py

+27-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
get_main_output,
1111
needs_singularity,
1212
needs_singularity_2_6,
13+
needs_singularity_3_or_newer,
1314
working_directory,
1415
)
1516

@@ -107,7 +108,7 @@ def test_singularity_local(tmp_path: Path) -> None:
107108

108109

109110
@needs_singularity_2_6
110-
def test_singularity_docker_image_id_in_tool(tmp_path: Path) -> None:
111+
def test_singularity2_docker_image_id_in_tool(tmp_path: Path) -> None:
111112
workdir = tmp_path / "working_dir"
112113
workdir.mkdir()
113114
with working_directory(workdir):
@@ -128,3 +129,28 @@ def test_singularity_docker_image_id_in_tool(tmp_path: Path) -> None:
128129
]
129130
)
130131
assert result_code1 == 0
132+
133+
134+
@needs_singularity_3_or_newer
135+
def test_singularity3_docker_image_id_in_tool(tmp_path: Path) -> None:
136+
workdir = tmp_path / "working_dir"
137+
workdir.mkdir()
138+
with working_directory(workdir):
139+
result_code, stdout, stderr = get_main_output(
140+
[
141+
"--singularity",
142+
get_data("tests/sing_pullfolder_test.cwl"),
143+
"--message",
144+
"hello",
145+
]
146+
)
147+
assert result_code == 0
148+
result_code1, stdout, stderr = get_main_output(
149+
[
150+
"--singularity",
151+
get_data("tests/debian_image_id2.cwl"),
152+
"--message",
153+
"hello",
154+
]
155+
)
156+
assert result_code1 == 0

tests/test_tmpdir.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_docker_commandLineTool_job_tmpdir_prefix(tmp_path: Path) -> None:
4545
"requirements": [
4646
{
4747
"class": "DockerRequirement",
48-
"dockerPull": "docker.io/debian:stable",
48+
"dockerPull": "docker.io/debian:stable-slim",
4949
}
5050
],
5151
}
@@ -120,7 +120,7 @@ def test_dockerfile_tmpdir_prefix(
120120
assert DockerCommandLineJob.get_image(
121121
{
122122
"class": "DockerRequirement",
123-
"dockerFile": "FROM debian:stable",
123+
"dockerFile": "FROM debian:stable-slim",
124124
"dockerImageId": sys._getframe().f_code.co_name,
125125
},
126126
pull_image=True,

tests/test_udocker.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_udocker_usage_should_not_write_cid_file(udocker: str, tmp_path: Path) -
5656
[
5757
"--debug",
5858
"--default-container",
59-
"debian",
59+
"debian:stable-slim",
6060
"--user-space-docker-cmd=" + udocker,
6161
get_data(test_file),
6262
get_data(job_file),
@@ -79,7 +79,7 @@ def test_udocker_should_display_memory_usage(udocker: str, tmp_path: Path) -> No
7979
error_code, stdout, stderr = get_main_output(
8080
[
8181
"--enable-ext",
82-
"--default-container=debian",
82+
"--default-container=debian:stable-slim",
8383
"--user-space-docker-cmd=" + udocker,
8484
get_data("tests/wf/timelimit.cwl"),
8585
"--sleep_time",

tests/wf/1590.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"requirements": [
2424
{
2525
"class": "DockerRequirement",
26-
"dockerPull": "debian:stretch-slim"
26+
"dockerPull": "debian:stable-slim"
2727
}
2828
],
2929
"stdout": "output"

tests/wf/cat-tool.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cwlVersion: v1.0
55

66
hints:
77
DockerRequirement:
8-
dockerPull: docker.io/frolvlad/alpine-bash
8+
dockerPull: docker.io/bash:4.4`
99

1010
inputs:
1111
file1: File

tests/wf/directory.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ doc: >
88

99
hints:
1010
- class: DockerRequirement
11-
dockerPull: docker.io/debian:8
11+
dockerPull: docker.io/debian:stable-slim
1212

1313
inputs:
1414
dir:

tests/wf/expect_packed.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"hints": [
77
{
88
"class": "DockerRequirement",
9-
"dockerPull": "docker.io/debian:8"
9+
"dockerPull": "docker.io/debian:stable-slim"
1010
}
1111
],
1212
"inputs": [

tests/wf/expect_revsort_datetime_packed.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"hints": [
77
{
88
"class": "DockerRequirement",
9-
"dockerPull": "docker.io/debian:8"
9+
"dockerPull": "docker.io/debian:stable-slim"
1010
}
1111
],
1212
"inputs": [

tests/wf/expect_trick_packed.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"hints": [
6363
{
6464
"class": "DockerRequirement",
65-
"dockerPull": "docker.io/debian:8"
65+
"dockerPull": "docker.io/debian:stable-slim"
6666
}
6767
],
6868
"inputs": [

tests/wf/iwdr_permutations.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ requirements:
66
envDef:
77
LC_ALL: C
88
DockerRequirement:
9-
dockerPull: docker.io/debian
9+
dockerPull: docker.io/debian:stable-slim
1010
InitialWorkDirRequirement:
1111
listing:
1212
- entry: $(inputs.first)

tests/wf/literalfile.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ inputs:
66
outputs: []
77
requirements:
88
DockerRequirement:
9-
dockerPull: docker.io/debian:9
9+
dockerPull: docker.io/debian:stable-slim
1010
arguments: [cat, $(inputs.a1)]

tests/wf/networkaccess-fail.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class: CommandLineTool
33
cwlVersion: v1.0
44
requirements:
55
DockerRequirement:
6-
dockerPull: docker.io/python:3
6+
dockerPull: docker.io/python:3-slim
77
NetworkAccess:
88
networkAccess: true
99
inputs: []

tests/wf/networkaccess.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ $namespaces:
55
cwltool: "http://commonwl.org/cwltool#"
66
requirements:
77
DockerRequirement:
8-
dockerPull: docker.io/python:3
8+
dockerPull: docker.io/python:3-slim
99
cwltool:NetworkAccess:
1010
networkAccess: true
1111
inputs: []

tests/wf/revsort.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cwlVersion: v1.0
1111
# in which the command line tools will execute.
1212
hints:
1313
- class: DockerRequirement
14-
dockerPull: docker.io/debian:8
14+
dockerPull: docker.io/debian:stable-slim
1515

1616

1717
# The inputs array defines the structure of the input object that describes

tests/wf/revsort_datetime.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cwlVersion: v1.0
1111
# in which the command line tools will execute.
1212
hints:
1313
- class: DockerRequirement
14-
dockerPull: docker.io/debian:8
14+
dockerPull: docker.io/debian:stable-slim
1515

1616

1717
# The inputs array defines the structure of the input object that describes

tests/wf/secret_wf.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ hints:
77
"cwltool:Secrets":
88
secrets: [pw]
99
DockerRequirement:
10-
dockerPull: docker.io/debian:8
10+
dockerPull: docker.io/debian:stable-slim
1111
inputs:
1212
pw: string
1313
outputs:

tests/wf/touch_tool.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class: CommandLineTool
55
baseCommand: touch
66
requirements:
77
DockerRequirement:
8-
dockerPull: docker.io/alpine
8+
dockerPull: docker.io/alpine:latest
99
inputs:
1010
message:
1111
type: string

tests/wf/trick_revsort.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cwlVersion: v1.0
1111
# in which the command line tools will execute.
1212
hints:
1313
- class: DockerRequirement
14-
dockerPull: docker.io/debian:8
14+
dockerPull: docker.io/debian:stable-slim
1515

1616

1717
# The inputs array defines the structure of the input object that describes

tests/wf/updateval.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ requirements:
88
writable: true
99
hints:
1010
DockerRequirement:
11-
dockerPull: "docker.io/python:2.7.15-alpine3.7"
11+
dockerPull: "docker.io/python:3-slim"
1212
inputs:
1313
r: File
1414
script:

tests/wf/updateval_inplace.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ requirements:
1212
inplaceUpdate: true
1313
hints:
1414
DockerRequirement:
15-
dockerPull: "docker.io/python:2.7.15-alpine3.7"
15+
dockerPull: "docker.io/python:3-slim"
1616
inputs:
1717
r: File
1818
script:

tests/wf/workreuse-fail.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class: CommandLineTool
33
cwlVersion: v1.0
44
requirements:
55
DockerRequirement:
6-
dockerPull: docker.io/python:3
6+
dockerPull: docker.io/python:3-slim
77
WorkReuse:
88
enableReuse: false
99
inputs: []

tests/wf/workreuse.cwl

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ $namespaces:
55
cwltool: "http://commonwl.org/cwltool#"
66
requirements:
77
DockerRequirement:
8-
dockerPull: docker.io/python:3
8+
dockerPull: docker.io/python:3-slim
99
cwltool:WorkReuse:
1010
enableReuse: false
1111
inputs: []

0 commit comments

Comments
 (0)