mirror of
https://github.com/containers/podman-compose.git
synced 2025-06-01 16:06:46 +02:00
tests/integration: Fix lifetime
tests
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
This commit is contained in:
parent
83c7e9462e
commit
d4ebf62e0e
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
@ -85,15 +86,14 @@ class TestLifetime(unittest.TestCase, RunSubprocessMixin):
|
|||||||
"container1",
|
"container1",
|
||||||
])
|
])
|
||||||
|
|
||||||
for _ in range(0, 3):
|
self.run_subprocess_assert_returncode([
|
||||||
self.run_subprocess_assert_returncode([
|
podman_compose_path(),
|
||||||
podman_compose_path(),
|
"-f",
|
||||||
"-f",
|
compose_path,
|
||||||
compose_path,
|
"up",
|
||||||
"up",
|
"-d",
|
||||||
"-d",
|
"container2",
|
||||||
"container2",
|
])
|
||||||
])
|
|
||||||
|
|
||||||
out, _ = self.run_subprocess_assert_returncode([
|
out, _ = self.run_subprocess_assert_returncode([
|
||||||
podman_compose_path(),
|
podman_compose_path(),
|
||||||
@ -105,6 +105,7 @@ class TestLifetime(unittest.TestCase, RunSubprocessMixin):
|
|||||||
|
|
||||||
self.assertEqual(out, b"test1\n")
|
self.assertEqual(out, b"test1\n")
|
||||||
|
|
||||||
|
# "restart: always" keeps restarting container until its removal
|
||||||
out, _ = self.run_subprocess_assert_returncode([
|
out, _ = self.run_subprocess_assert_returncode([
|
||||||
podman_compose_path(),
|
podman_compose_path(),
|
||||||
"-f",
|
"-f",
|
||||||
@ -113,13 +114,22 @@ class TestLifetime(unittest.TestCase, RunSubprocessMixin):
|
|||||||
"container2",
|
"container2",
|
||||||
])
|
])
|
||||||
|
|
||||||
# BUG: container should be started 3 times, not 4.
|
if not out.startswith(b"test2\ntest2"):
|
||||||
self.assertEqual(out, b"test2\n" * 4)
|
time.sleep(1)
|
||||||
|
out, _ = self.run_subprocess_assert_returncode([
|
||||||
|
podman_compose_path(),
|
||||||
|
"-f",
|
||||||
|
compose_path,
|
||||||
|
"logs",
|
||||||
|
"container2",
|
||||||
|
])
|
||||||
|
self.assertTrue(out.startswith(b"test2\ntest2"))
|
||||||
finally:
|
finally:
|
||||||
out, _ = self.run_subprocess_assert_returncode([
|
out, _ = self.run_subprocess_assert_returncode([
|
||||||
podman_compose_path(),
|
podman_compose_path(),
|
||||||
"-f",
|
"-f",
|
||||||
compose_path,
|
compose_path,
|
||||||
"down",
|
"down",
|
||||||
|
"-t",
|
||||||
|
"0",
|
||||||
])
|
])
|
||||||
|
@ -5,5 +5,5 @@ services:
|
|||||||
command: ["/bin/bash", "-c", "echo test1; sleep infinity"]
|
command: ["/bin/bash", "-c", "echo test1; sleep infinity"]
|
||||||
container2:
|
container2:
|
||||||
image: nopush/podman-compose-test
|
image: nopush/podman-compose-test
|
||||||
restart: never
|
restart: always
|
||||||
command: ["/bin/bash", "-c", "echo test2"]
|
command: ["/bin/bash", "-c", "echo test2"]
|
||||||
|
@ -6,6 +6,6 @@ services:
|
|||||||
command: ["/bin/bash", "-c", "echo test1; sleep infinity"]
|
command: ["/bin/bash", "-c", "echo test1; sleep infinity"]
|
||||||
container2:
|
container2:
|
||||||
image: nopush/podman-compose-test
|
image: nopush/podman-compose-test
|
||||||
restart: never
|
restart: always
|
||||||
ports: "9002:9002"
|
ports: "9002:9002"
|
||||||
command: ["/bin/bash", "-c", "echo test2"]
|
command: ["/bin/bash", "-c", "echo test2"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user