Skip to content

tests: reduce number of software containers #1718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cwltool/singularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def get_image(
candidates.append(dockerRequirement["dockerImageId"])
candidates.append(_normalize_image_id(dockerRequirement["dockerImageId"]))
if is_version_3_or_newer():
candidates.append(_normalize_sif_id(dockerRequirement["dockerPull"]))
candidates.append(_normalize_sif_id(dockerRequirement["dockerImageId"]))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops!


targets = [os.getcwd()]
if "CWL_SINGULARITY_CACHE" in os.environ:
Expand Down
4 changes: 2 additions & 2 deletions tests/debian_image_id.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ class: CommandLineTool

requirements:
DockerRequirement:
dockerImageId: 'debian.img'
dockerImageId: 'debian:stable-slim.img'

inputs:
message: string

outputs: []

baseCommand: echo
baseCommand: echo
14 changes: 14 additions & 0 deletions tests/debian_image_id2.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool

requirements:
DockerRequirement:
dockerImageId: 'docker.io_debian:stable-slim.sif'

inputs:
message: string

outputs: []

baseCommand: echo
2 changes: 1 addition & 1 deletion tests/echo-job.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cwl:requirements:
- class: DockerRequirement
dockerPull: docker.io/debian
dockerPull: docker.io/debian:stable-slim

inp: "Howdy!"
2 changes: 1 addition & 1 deletion tests/non_portable.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class: CommandLineTool

requirements:
DockerRequirement:
dockerPull: docker.io/debian
dockerPull: docker.io/debian:stable-slim
InitialWorkDirRequirement:
listing:
- class: File
Expand Down
2 changes: 1 addition & 1 deletion tests/non_portable2.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class: CommandLineTool

hints:
DockerRequirement:
dockerPull: docker.io/debian
dockerPull: docker.io/debian:stable-slim
dockerOutputDirectory: /var/spool/cwl
InitialWorkDirRequirement:
listing:
Expand Down
2 changes: 1 addition & 1 deletion tests/portable.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class: CommandLineTool

requirements:
DockerRequirement:
dockerPull: docker.io/debian
dockerPull: docker.io/debian:stable-slim
dockerOutputDirectory: /var/spool/cwl
InitialWorkDirRequirement:
listing:
Expand Down
2 changes: 1 addition & 1 deletion tests/sing_pullfolder_test.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class: CommandLineTool

requirements:
DockerRequirement:
dockerPull: docker.io/debian
dockerPull: docker.io/debian:stable-slim

inputs:
message: string
Expand Down
2 changes: 1 addition & 1 deletion tests/test_docker_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
def test_docker_mem() -> None:
error_code, stdout, stderr = get_main_output(
[
"--default-container=debian",
"--default-container=docker.io/debian:stable-slim",
"--enable-ext",
get_data("tests/wf/timelimit.cwl"),
"--sleep_time",
Expand Down
28 changes: 27 additions & 1 deletion tests/test_singularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
get_main_output,
needs_singularity,
needs_singularity_2_6,
needs_singularity_3_or_newer,
working_directory,
)

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


@needs_singularity_2_6
def test_singularity_docker_image_id_in_tool(tmp_path: Path) -> None:
def test_singularity2_docker_image_id_in_tool(tmp_path: Path) -> None:
workdir = tmp_path / "working_dir"
workdir.mkdir()
with working_directory(workdir):
Expand All @@ -128,3 +129,28 @@ def test_singularity_docker_image_id_in_tool(tmp_path: Path) -> None:
]
)
assert result_code1 == 0


@needs_singularity_3_or_newer
def test_singularity3_docker_image_id_in_tool(tmp_path: Path) -> None:
workdir = tmp_path / "working_dir"
workdir.mkdir()
with working_directory(workdir):
result_code, stdout, stderr = get_main_output(
[
"--singularity",
get_data("tests/sing_pullfolder_test.cwl"),
"--message",
"hello",
]
)
assert result_code == 0
result_code1, stdout, stderr = get_main_output(
[
"--singularity",
get_data("tests/debian_image_id2.cwl"),
"--message",
"hello",
]
)
assert result_code1 == 0
4 changes: 2 additions & 2 deletions tests/test_tmpdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_docker_commandLineTool_job_tmpdir_prefix(tmp_path: Path) -> None:
"requirements": [
{
"class": "DockerRequirement",
"dockerPull": "docker.io/debian:stable",
"dockerPull": "docker.io/debian:stable-slim",
}
],
}
Expand Down Expand Up @@ -120,7 +120,7 @@ def test_dockerfile_tmpdir_prefix(
assert DockerCommandLineJob.get_image(
{
"class": "DockerRequirement",
"dockerFile": "FROM debian:stable",
"dockerFile": "FROM debian:stable-slim",
"dockerImageId": sys._getframe().f_code.co_name,
},
pull_image=True,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_udocker.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_udocker_usage_should_not_write_cid_file(udocker: str, tmp_path: Path) -
[
"--debug",
"--default-container",
"debian",
"debian:stable-slim",
"--user-space-docker-cmd=" + udocker,
get_data(test_file),
get_data(job_file),
Expand All @@ -79,7 +79,7 @@ def test_udocker_should_display_memory_usage(udocker: str, tmp_path: Path) -> No
error_code, stdout, stderr = get_main_output(
[
"--enable-ext",
"--default-container=debian",
"--default-container=debian:stable-slim",
"--user-space-docker-cmd=" + udocker,
get_data("tests/wf/timelimit.cwl"),
"--sleep_time",
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/1590.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"requirements": [
{
"class": "DockerRequirement",
"dockerPull": "debian:stretch-slim"
"dockerPull": "debian:stable-slim"
}
],
"stdout": "output"
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/cat-tool.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cwlVersion: v1.0

hints:
DockerRequirement:
dockerPull: docker.io/frolvlad/alpine-bash
dockerPull: docker.io/bash:4.4`

inputs:
file1: File
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/directory.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ doc: >

hints:
- class: DockerRequirement
dockerPull: docker.io/debian:8
dockerPull: docker.io/debian:stable-slim

inputs:
dir:
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/expect_packed.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"hints": [
{
"class": "DockerRequirement",
"dockerPull": "docker.io/debian:8"
"dockerPull": "docker.io/debian:stable-slim"
}
],
"inputs": [
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/expect_revsort_datetime_packed.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"hints": [
{
"class": "DockerRequirement",
"dockerPull": "docker.io/debian:8"
"dockerPull": "docker.io/debian:stable-slim"
}
],
"inputs": [
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/expect_trick_packed.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"hints": [
{
"class": "DockerRequirement",
"dockerPull": "docker.io/debian:8"
"dockerPull": "docker.io/debian:stable-slim"
}
],
"inputs": [
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/iwdr_permutations.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requirements:
envDef:
LC_ALL: C
DockerRequirement:
dockerPull: docker.io/debian
dockerPull: docker.io/debian:stable-slim
InitialWorkDirRequirement:
listing:
- entry: $(inputs.first)
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/literalfile.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ inputs:
outputs: []
requirements:
DockerRequirement:
dockerPull: docker.io/debian:9
dockerPull: docker.io/debian:stable-slim
arguments: [cat, $(inputs.a1)]
2 changes: 1 addition & 1 deletion tests/wf/networkaccess-fail.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class: CommandLineTool
cwlVersion: v1.0
requirements:
DockerRequirement:
dockerPull: docker.io/python:3
dockerPull: docker.io/python:3-slim
NetworkAccess:
networkAccess: true
inputs: []
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/networkaccess.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $namespaces:
cwltool: "http://commonwl.org/cwltool#"
requirements:
DockerRequirement:
dockerPull: docker.io/python:3
dockerPull: docker.io/python:3-slim
cwltool:NetworkAccess:
networkAccess: true
inputs: []
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/revsort.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cwlVersion: v1.0
# in which the command line tools will execute.
hints:
- class: DockerRequirement
dockerPull: docker.io/debian:8
dockerPull: docker.io/debian:stable-slim


# The inputs array defines the structure of the input object that describes
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/revsort_datetime.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cwlVersion: v1.0
# in which the command line tools will execute.
hints:
- class: DockerRequirement
dockerPull: docker.io/debian:8
dockerPull: docker.io/debian:stable-slim


# The inputs array defines the structure of the input object that describes
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/secret_wf.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ hints:
"cwltool:Secrets":
secrets: [pw]
DockerRequirement:
dockerPull: docker.io/debian:8
dockerPull: docker.io/debian:stable-slim
inputs:
pw: string
outputs:
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/touch_tool.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class: CommandLineTool
baseCommand: touch
requirements:
DockerRequirement:
dockerPull: docker.io/alpine
dockerPull: docker.io/alpine:latest
inputs:
message:
type: string
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/trick_revsort.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cwlVersion: v1.0
# in which the command line tools will execute.
hints:
- class: DockerRequirement
dockerPull: docker.io/debian:8
dockerPull: docker.io/debian:stable-slim


# The inputs array defines the structure of the input object that describes
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/updateval.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ requirements:
writable: true
hints:
DockerRequirement:
dockerPull: "docker.io/python:2.7.15-alpine3.7"
dockerPull: "docker.io/python:3-slim"
inputs:
r: File
script:
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/updateval_inplace.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ requirements:
inplaceUpdate: true
hints:
DockerRequirement:
dockerPull: "docker.io/python:2.7.15-alpine3.7"
dockerPull: "docker.io/python:3-slim"
inputs:
r: File
script:
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/workreuse-fail.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class: CommandLineTool
cwlVersion: v1.0
requirements:
DockerRequirement:
dockerPull: docker.io/python:3
dockerPull: docker.io/python:3-slim
WorkReuse:
enableReuse: false
inputs: []
Expand Down
2 changes: 1 addition & 1 deletion tests/wf/workreuse.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $namespaces:
cwltool: "http://commonwl.org/cwltool#"
requirements:
DockerRequirement:
dockerPull: docker.io/python:3
dockerPull: docker.io/python:3-slim
cwltool:WorkReuse:
enableReuse: false
inputs: []
Expand Down