chore: add cgroup and container_name test case

This commit is contained in:
uccuz 2022-06-03 16:55:17 +08:00
parent 5892237eae
commit 603f552551

View file

@ -241,6 +241,31 @@ from compose_viz.parser import Parser
], ],
), ),
), ),
(
"cgroup_parent/docker-compose",
Compose(
services=[
Service(
name="frontend",
image="awesome/frontend",
cgroup_parent="system",
),
],
),
),
(
"container_name/docker-compose",
Compose(
services=[
Service(
name="frontend",
image="awesome/frontend",
container_name="myfrontend",
),
],
),
),
], ],
) )
def test_parse_file(test_file_path: str, expected: Compose) -> None: def test_parse_file(test_file_path: str, expected: Compose) -> None:
@ -275,3 +300,8 @@ def test_parse_file(test_file_path: str, expected: Compose) -> None:
if (actual_service.extends is not None) and (expected_service.extends is not None): if (actual_service.extends is not None) and (expected_service.extends is not None):
assert actual_service.extends.service_name == expected_service.extends.service_name assert actual_service.extends.service_name == expected_service.extends.service_name
assert actual_service.extends.from_file == expected_service.extends.from_file assert actual_service.extends.from_file == expected_service.extends.from_file
assert actual_service.cgroup_parent == expected_service.cgroup_parent
assert actual_service.container_name == expected_service.container_name