From 50589db102707bf5c2d83cfc6a5c7c36a13bc82f Mon Sep 17 00:00:00 2001 From: uccuz Date: Fri, 3 Jun 2022 16:57:40 +0800 Subject: [PATCH] chore: create env, expose, profiles test case --- tests/test_parse_file.py | 84 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) diff --git a/tests/test_parse_file.py b/tests/test_parse_file.py index 1eaa166..54a8c86 100644 --- a/tests/test_parse_file.py +++ b/tests/test_parse_file.py @@ -265,7 +265,86 @@ from compose_viz.parser import Parser ], ), ), - + ( + "env_file/docker-compose", + Compose( + services=[ + Service( + name="frontend", + image="awesome/frontend", + env_file=[ + "a.env" + ], + ), + Service( + name="backend", + image="awesome/backend", + env_file=[ + "b.env" + ], + ), + Service( + name="db", + image="awesome/db", + env_file=[ + "c.env", + "d.env" + ], + ), + ], + ), + ), + ( + "expose/docker-compose", + Compose( + services=[ + Service( + name="frontend", + image="awesome/frontend", + expose=[ + "27118" + ], + ), + Service( + name="backend", + image="awesome/backend", + expose=[ + "27017", + "27018" + ], + ), + ], + ), + ), + ( + "profiles/docker-compose", + Compose( + services=[ + Service( + name="frontend", + image="awesome/frontend", + profiles=[ + "frontend" + ], + ), + Service( + name="phpmyadmin", + image="phpmyadmin", + profiles=[ + "debug" + ], + ), + Service( + name="db", + image="awesome/db", + profiles=[ + "db", + "sql" + ], + ), + ], + ), + ), ], ) def test_parse_file(test_file_path: str, expected: Compose) -> None: @@ -305,3 +384,6 @@ def test_parse_file(test_file_path: str, expected: Compose) -> None: assert actual_service.cgroup_parent == expected_service.cgroup_parent assert actual_service.container_name == expected_service.container_name + assert actual_service.expose == expected_service.expose + assert actual_service.env_file == expected_service.env_file + assert actual_service.profiles == expected_service.profiles \ No newline at end of file