1
1
"""Tests for docker engine."""
2
+ import re
2
3
from pathlib import Path
3
4
from shutil import which
4
5
@@ -13,7 +14,7 @@ def test_docker_workflow(tmp_path: Path) -> None:
13
14
result_code , _ , stderr = get_main_output (
14
15
[
15
16
"--default-container" ,
16
- "debian" ,
17
+ "docker.io/ debian:stable-slim " ,
17
18
"--outdir" ,
18
19
str (tmp_path ),
19
20
get_data ("tests/wf/hello-workflow.cwl" ),
@@ -30,7 +31,7 @@ def test_docker_iwdr() -> None:
30
31
result_code = main (
31
32
[
32
33
"--default-container" ,
33
- "debian" ,
34
+ "docker.io/ debian:stable-slim " ,
34
35
get_data ("tests/wf/iwdr-entry.cwl" ),
35
36
"--message" ,
36
37
"hello" ,
@@ -69,3 +70,61 @@ def test_docker_file_mount() -> None:
69
70
[get_data ("tests/wf/literalfile.cwl" ), get_data ("tests/wf/literalfile-job.yml" )]
70
71
)
71
72
assert result_code == 0
73
+
74
+
75
+ @needs_docker
76
+ def test_docker_strict_cpu_limit () -> None :
77
+ result_code , stdout , stderr = get_main_output (
78
+ [
79
+ "--strict-cpu-limit" ,
80
+ "--default-container" ,
81
+ "docker.io/debian:stable-slim" ,
82
+ get_data ("tests/wf/cores_float.cwl" ),
83
+ ]
84
+ )
85
+ stderr = re .sub (r"\s\s+" , " " , stderr )
86
+ assert result_code == 0
87
+ assert "--cpus=2" in stderr
88
+
89
+
90
+ @needs_docker
91
+ def test_docker_strict_memory_limit () -> None :
92
+ result_code , stdout , stderr = get_main_output (
93
+ [
94
+ "--strict-memory-limit" ,
95
+ "--default-container" ,
96
+ "docker.io/debian:stable-slim" ,
97
+ get_data ("tests/wf/storage_float.cwl" ),
98
+ ]
99
+ )
100
+ stderr = re .sub (r"\s\s+" , " " , stderr )
101
+ assert result_code == 0
102
+ assert "--memory=255m" in stderr
103
+
104
+
105
+ @needs_docker
106
+ def test_docker_strict_cpu_limit_warning () -> None :
107
+ result_code , stdout , stderr = get_main_output (
108
+ [
109
+ "--default-container" ,
110
+ "docker.io/debian:stable-slim" ,
111
+ get_data ("tests/wf/cores_float.cwl" ),
112
+ ]
113
+ )
114
+ stderr = re .sub (r"\s\s+" , " " , stderr )
115
+ assert result_code == 0
116
+ assert "Skipping Docker software container '--cpus' limit" in stderr
117
+
118
+
119
+ @needs_docker
120
+ def test_docker_strict_memory_limit_warning () -> None :
121
+ result_code , stdout , stderr = get_main_output (
122
+ [
123
+ "--default-container" ,
124
+ "docker.io/debian:stable-slim" ,
125
+ get_data ("tests/wf/storage_float.cwl" ),
126
+ ]
127
+ )
128
+ stderr = re .sub (r"\s\s+" , " " , stderr )
129
+ assert result_code == 0
130
+ assert "Skipping Docker software container '--memory' limit" in stderr
0 commit comments