|
1 | 1 | """Tests for docker engine.""" |
| 2 | +import json |
2 | 3 | import re |
3 | 4 | from pathlib import Path |
4 | 5 | from shutil import which |
5 | 6 |
|
6 | 7 | from cwltool.main import main |
7 | 8 |
|
8 | | -from .util import get_data, get_main_output, needs_docker |
| 9 | +from .util import ( |
| 10 | + get_data, |
| 11 | + get_main_output, |
| 12 | + needs_docker, |
| 13 | + needs_podman, |
| 14 | + needs_singularity, |
| 15 | +) |
9 | 16 |
|
10 | 17 |
|
11 | 18 | @needs_docker |
@@ -136,3 +143,53 @@ def test_docker_strict_memory_limit_warning(tmp_path: Path) -> None: |
136 | 143 | stderr = re.sub(r"\s\s+", " ", stderr) |
137 | 144 | assert result_code == 0 |
138 | 145 | assert "Skipping Docker software container '--memory' limit" in stderr |
| 146 | + |
| 147 | + |
| 148 | +@needs_docker |
| 149 | +def test_docker_required_secfile(tmp_path: Path) -> None: |
| 150 | + result_code, stdout, stderr = get_main_output( |
| 151 | + [ |
| 152 | + "--outdir", |
| 153 | + str(tmp_path), |
| 154 | + get_data("tests/secondary-files-required-container.cwl"), |
| 155 | + ] |
| 156 | + ) |
| 157 | + assert result_code == 0, stderr |
| 158 | + assert ( |
| 159 | + json.loads(stdout)["output"]["secondaryFiles"][0]["checksum"] |
| 160 | + == "da39a3ee5e6b4b0d3255bfef95601890afd80709" |
| 161 | + ) |
| 162 | + |
| 163 | + |
| 164 | +@needs_podman |
| 165 | +def test_podman_required_secfile(tmp_path: Path) -> None: |
| 166 | + result_code, stdout, stderr = get_main_output( |
| 167 | + [ |
| 168 | + "--outdir", |
| 169 | + "--podman", |
| 170 | + str(tmp_path), |
| 171 | + get_data("tests/secondary-files-required-container.cwl"), |
| 172 | + ] |
| 173 | + ) |
| 174 | + assert result_code == 0, stderr |
| 175 | + assert ( |
| 176 | + json.loads(stdout)["output"]["secondaryFiles"][0]["checksum"] |
| 177 | + == "da39a3ee5e6b4b0d3255bfef95601890afd80709" |
| 178 | + ) |
| 179 | + |
| 180 | + |
| 181 | +@needs_singularity |
| 182 | +def test_singularity_required_secfile(tmp_path: Path) -> None: |
| 183 | + result_code, stdout, stderr = get_main_output( |
| 184 | + [ |
| 185 | + "--outdir", |
| 186 | + "--singularity", |
| 187 | + str(tmp_path), |
| 188 | + get_data("tests/secondary-files-required-container.cwl"), |
| 189 | + ] |
| 190 | + ) |
| 191 | + assert result_code == 0, stderr |
| 192 | + assert ( |
| 193 | + json.loads(stdout)["output"]["secondaryFiles"][0]["checksum"] |
| 194 | + == "da39a3ee5e6b4b0d3255bfef95601890afd80709" |
| 195 | + ) |
0 commit comments