From 21b9d385b29bc09b30c21cedf4fe92f8b10a5fc1 Mon Sep 17 00:00:00 2001 From: Monika Kairaityte <monika@kibit.lt> Date: Sun, 19 Jan 2025 20:28:47 +0200 Subject: [PATCH] tests/integration: Move test "deps" to corresponding directory Signed-off-by: Monika Kairaityte <monika@kibit.lt> --- tests/integration/deps/__init__.py | 1 + .../{ => deps}/test_podman_compose_deps.py | 52 +++++++++++++++++++ .../integration/test_podman_compose_tests.py | 52 ------------------- 3 files changed, 53 insertions(+), 52 deletions(-) create mode 100644 tests/integration/deps/__init__.py rename tests/integration/{ => deps}/test_podman_compose_deps.py (73%) diff --git a/tests/integration/deps/__init__.py b/tests/integration/deps/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tests/integration/deps/__init__.py @@ -0,0 +1 @@ + diff --git a/tests/integration/test_podman_compose_deps.py b/tests/integration/deps/test_podman_compose_deps.py similarity index 73% rename from tests/integration/test_podman_compose_deps.py rename to tests/integration/deps/test_podman_compose_deps.py index 17893bf..dfa8caf 100644 --- a/tests/integration/test_podman_compose_deps.py +++ b/tests/integration/deps/test_podman_compose_deps.py @@ -87,6 +87,58 @@ class TestComposeBaseDeps(unittest.TestCase, RunSubprocessMixin): "down", ]) + def test_podman_compose_run(self): + """ + This will test depends_on as well + """ + run_cmd = [ + "coverage", + "run", + podman_compose_path(), + "-f", + os.path.join(test_path(), "deps", "docker-compose.yaml"), + "run", + "--rm", + "sleep", + "/bin/sh", + "-c", + "wget -q -O - http://web:8000/hosts", + ] + + out, _ = self.run_subprocess_assert_returncode(run_cmd) + self.assertIn(b"127.0.0.1\tlocalhost", out) + + # Run it again to make sure we can run it twice. I saw an issue where a second run, with + # the container left up, would fail + run_cmd = [ + "coverage", + "run", + podman_compose_path(), + "-f", + os.path.join(test_path(), "deps", "docker-compose.yaml"), + "run", + "--rm", + "sleep", + "/bin/sh", + "-c", + "wget -q -O - http://web:8000/hosts", + ] + + out, _ = self.run_subprocess_assert_returncode(run_cmd) + self.assertIn(b"127.0.0.1\tlocalhost", out) + + # This leaves a container running. Not sure it's intended, but it matches docker-compose + down_cmd = [ + "coverage", + "run", + podman_compose_path(), + "-f", + os.path.join(test_path(), "deps", "docker-compose.yaml"), + "down", + ] + + self.run_subprocess_assert_returncode(down_cmd) + class TestComposeConditionalDeps(unittest.TestCase, RunSubprocessMixin): def test_deps_succeeds(self): diff --git a/tests/integration/test_podman_compose_tests.py b/tests/integration/test_podman_compose_tests.py index f5ac152..b12208b 100644 --- a/tests/integration/test_podman_compose_tests.py +++ b/tests/integration/test_podman_compose_tests.py @@ -29,58 +29,6 @@ class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin): self.run_subprocess_assert_returncode(up_cmd + ["--exit-code-from", "sh1"], 1) self.run_subprocess_assert_returncode(up_cmd + ["--exit-code-from", "sh2"], 2) - def test_run(self): - """ - This will test depends_on as well - """ - run_cmd = [ - "coverage", - "run", - podman_compose_path(), - "-f", - os.path.join(test_path(), "deps", "docker-compose.yaml"), - "run", - "--rm", - "sleep", - "/bin/sh", - "-c", - "wget -q -O - http://web:8000/hosts", - ] - - out, _ = self.run_subprocess_assert_returncode(run_cmd) - self.assertIn(b"127.0.0.1\tlocalhost", out) - - # Run it again to make sure we can run it twice. I saw an issue where a second run, with - # the container left up, would fail - run_cmd = [ - "coverage", - "run", - podman_compose_path(), - "-f", - os.path.join(test_path(), "deps", "docker-compose.yaml"), - "run", - "--rm", - "sleep", - "/bin/sh", - "-c", - "wget -q -O - http://web:8000/hosts", - ] - - out, _ = self.run_subprocess_assert_returncode(run_cmd) - self.assertIn(b"127.0.0.1\tlocalhost", out) - - # This leaves a container running. Not sure it's intended, but it matches docker-compose - down_cmd = [ - "coverage", - "run", - podman_compose_path(), - "-f", - os.path.join(test_path(), "deps", "docker-compose.yaml"), - "down", - ] - - self.run_subprocess_assert_returncode(down_cmd) - def test_up_with_ports(self): up_cmd = [ "coverage",