Skip to content

Commit a764bf1

Browse files
committed
added an execution timeout for all --wait calls
Signed-off-by: mammo0 <marc.ammon@hotmail.de>
1 parent 5904b6a commit a764bf1

File tree

1 file changed

+37
-25
lines changed

1 file changed

+37
-25
lines changed

tests/integration/wait/test_podman_compose_wait.py

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from datetime import timedelta
88
from io import BytesIO
99
from typing import Any
10+
from typing import Final
1011
from typing import Optional
1112

1213
from packaging import version
@@ -16,6 +17,8 @@
1617
from tests.integration.test_utils import podman_compose_path
1718
from tests.integration.test_utils import test_path
1819

20+
EXECUTION_TIMEOUT: Final[float] = 30
21+
1922

2023
def compose_yaml_path() -> str:
2124
return os.path.join(test_path(), "wait", "docker-compose.yml")
@@ -119,14 +122,17 @@ def test_wait(self) -> None:
119122
# the execution time of this command must be at least 10 seconds,
120123
# because of the sleep command in entrypoint.sh
121124
with ExecutionTime(min_execution_time=timedelta(seconds=10)):
122-
self.run_subprocess_assert_returncode([
123-
podman_compose_path(),
124-
"-f",
125-
compose_yaml_path(),
126-
"up",
127-
"-d",
128-
"--wait",
129-
])
125+
self.run_subprocess_assert_returncode(
126+
[
127+
podman_compose_path(),
128+
"-f",
129+
compose_yaml_path(),
130+
"up",
131+
"-d",
132+
"--wait",
133+
],
134+
timeout=EXECUTION_TIMEOUT,
135+
)
130136

131137
output, _ = self.run_subprocess_assert_returncode([
132138
podman_compose_path(),
@@ -155,16 +161,19 @@ def test_wait_with_timeout(self) -> None:
155161
with ExecutionTime(
156162
min_execution_time=timedelta(seconds=5), max_execution_time=timedelta(seconds=10)
157163
):
158-
self.run_subprocess_assert_returncode([
159-
podman_compose_path(),
160-
"-f",
161-
compose_yaml_path(),
162-
"up",
163-
"-d",
164-
"--wait",
165-
"--wait-timeout",
166-
"5",
167-
])
164+
self.run_subprocess_assert_returncode(
165+
[
166+
podman_compose_path(),
167+
"-f",
168+
compose_yaml_path(),
169+
"up",
170+
"-d",
171+
"--wait",
172+
"--wait-timeout",
173+
"5",
174+
],
175+
timeout=EXECUTION_TIMEOUT,
176+
)
168177

169178
output, _ = self.run_subprocess_assert_returncode([
170179
podman_compose_path(),
@@ -224,13 +233,16 @@ def test_wait_with_start(self) -> None:
224233
# the execution time of this command must be at least 10 seconds,
225234
# because of the sleep command in entrypoint.sh
226235
with ExecutionTime(min_execution_time=timedelta(seconds=10)):
227-
self.run_subprocess_assert_returncode([
228-
podman_compose_path(),
229-
"-f",
230-
compose_yaml_path(),
231-
"start",
232-
"--wait",
233-
])
236+
self.run_subprocess_assert_returncode(
237+
[
238+
podman_compose_path(),
239+
"-f",
240+
compose_yaml_path(),
241+
"start",
242+
"--wait",
243+
],
244+
timeout=EXECUTION_TIMEOUT,
245+
)
234246

235247
self.assertTrue(self._is_running("wait_app_1"))
236248

0 commit comments

Comments
 (0)