diff --git a/tests/extends_w_empty_service/common-services.yml b/tests/extends_w_empty_service/common-services.yml new file mode 100644 index 0000000..b7deb2c --- /dev/null +++ b/tests/extends_w_empty_service/common-services.yml @@ -0,0 +1,7 @@ +services: + webapp_default: + + webapp_special: + image: busybox + volumes: + - "/data" diff --git a/tests/extends_w_empty_service/docker-compose.yml b/tests/extends_w_empty_service/docker-compose.yml new file mode 100644 index 0000000..d5414e3 --- /dev/null +++ b/tests/extends_w_empty_service/docker-compose.yml @@ -0,0 +1,10 @@ +version: "3" +services: + web: + image: busybox + extends: + file: common-services.yml + service: webapp_default + environment: + - DEBUG=1 + cpu_shares: 5 diff --git a/tests/test_podman_compose.py b/tests/test_podman_compose.py index c255819..14e80b2 100644 --- a/tests/test_podman_compose.py +++ b/tests/test_podman_compose.py @@ -59,3 +59,26 @@ def test_podman_compose_extends_w_file_subdir(): out, _, returncode = capture(command_check_container) assert 0 == returncode assert out == b"" + + +def test_podman_compose_extends_w_empty_service(): + """ + Test that podman-compose can execute podman-compose -f up with extended File which + includes an empty service. (e.g. if the file is used as placeholder for more complex configurations.) + :return: + """ + main_path = Path(__file__).parent.parent + + command_up = [ + "python3", + str(main_path.joinpath("podman_compose.py")), + "-f", + str( + main_path.joinpath("tests", "extends_w_empty_service", "docker-compose.yml") + ), + "up", + "-d", + ] + + _, _, returncode = capture(command_up) + assert 0 == returncode