From 1d64f2cf8ce83a877f2c6c537afbb6c9b169ce78 Mon Sep 17 00:00:00 2001 From: Zhen Liu Date: Sat, 18 May 2024 08:24:35 +0800 Subject: [PATCH 1/2] Update podman_compose.py fix #940 Signed-off-by: Zhen Liu --- podman_compose.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/podman_compose.py b/podman_compose.py index 6fc65f7..2df05b3 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -1749,7 +1749,7 @@ class PodmanCompose: # If `include` is used, append included files to files include = compose.get("include", None) if include: - files.append(*include) + files.extend(include) # As compose obj is updated and tested with every loop, not deleting `include` # from it, results in it being tested again and again, original values for # `include` be appended to `files`, and, included files be processed for ever. From 4f73f2b79e6f37d5b13f029455b5c41571f27f4a Mon Sep 17 00:00:00 2001 From: Zhen Liu Date: Sat, 18 May 2024 21:23:43 +0800 Subject: [PATCH 2/2] fix: add include test file, edit the assertion Signed-off-by: Zhen Liu --- tests/include/docker-compose.extend.yaml | 6 ++++++ tests/include/docker-compose.yaml | 1 + tests/test_podman_compose_include.py | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/include/docker-compose.extend.yaml diff --git a/tests/include/docker-compose.extend.yaml b/tests/include/docker-compose.extend.yaml new file mode 100644 index 0000000..728a938 --- /dev/null +++ b/tests/include/docker-compose.extend.yaml @@ -0,0 +1,6 @@ +version: '3.6' + +services: + web2: + image: nopush/podman-compose-test + command: ["dumb-init", "/bin/busybox", "httpd", "-f", "-h", ".", "-p", "8004"] diff --git a/tests/include/docker-compose.yaml b/tests/include/docker-compose.yaml index ada2153..bf608d4 100644 --- a/tests/include/docker-compose.yaml +++ b/tests/include/docker-compose.yaml @@ -2,3 +2,4 @@ version: '3.6' include: - docker-compose.base.yaml + - docker-compose.extend.yaml diff --git a/tests/test_podman_compose_include.py b/tests/test_podman_compose_include.py index 5b5044c..a45c579 100644 --- a/tests/test_podman_compose_include.py +++ b/tests/test_podman_compose_include.py @@ -48,7 +48,7 @@ class TestPodmanComposeInclude(unittest.TestCase, RunSubprocessMixin): self.run_subprocess_assert_returncode(command_up) out, _ = self.run_subprocess_assert_returncode(command_check_container) - self.assertEqual(out, b'"localhost/nopush/podman-compose-test:latest"\n') + self.assertEqual(out, b'"localhost/nopush/podman-compose-test:latest"\n"localhost/nopush/podman-compose-test:latest"\n') # Get container ID to remove it out, _ = self.run_subprocess_assert_returncode(command_container_id) self.assertNotEqual(out, b"")