Add a test to extend using an empty service (placeholder)

Signed-off-by: Natanael Arndt <arndtn@gmail.com>
This commit is contained in:
Natanael Arndt 2023-07-26 15:27:30 +02:00 committed by Muayyad Alsadi
parent f75d12af21
commit 280f1770bf
3 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,7 @@
services:
webapp_default:
webapp_special:
image: busybox
volumes:
- "/data"

View File

@ -0,0 +1,10 @@
version: "3"
services:
web:
image: busybox
extends:
file: common-services.yml
service: webapp_default
environment:
- DEBUG=1
cpu_shares: 5

View File

@ -59,3 +59,26 @@ def test_podman_compose_extends_w_file_subdir():
out, _, returncode = capture(command_check_container) out, _, returncode = capture(command_check_container)
assert 0 == returncode assert 0 == returncode
assert out == b"" assert out == b""
def test_podman_compose_extends_w_empty_service():
"""
Test that podman-compose can execute podman-compose -f <file> 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