File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ def test_can_build_images_before_spawning_service_via_compose():
39
39
assert "--build" in docker_compose_cmd
40
40
41
41
42
- def test_can_run_specific_services ():
42
+ def test_can_specify_services ():
43
43
with patch .object (DockerCompose , "_call_command" ) as call_mock :
44
44
with DockerCompose (ROOT , services = ["hub" , "firefox" ]) as compose :
45
45
...
@@ -52,6 +52,25 @@ def test_can_run_specific_services():
52
52
assert "chrome" not in docker_compose_cmd
53
53
54
54
55
+ @pytest .mark .parametrize ("should_run_hub" , [
56
+ [True ],
57
+ [False ],
58
+ ])
59
+ def test_can_run_specific_services (should_run_hub : bool ):
60
+ # compose V2 will improve this test by being able to assert that "firefox" also has started and exited
61
+ services = ["firefox" ]
62
+ if should_run_hub :
63
+ services .append ("hub" )
64
+
65
+ with DockerCompose (ROOT , services = services ) as compose :
66
+ if should_run_hub :
67
+ assert compose .get_service_host ("hub" , 4444 )
68
+ assert compose .get_service_port ("hub" , 4444 )
69
+ else :
70
+ with pytest .raises (NoSuchPortExposed ):
71
+ assert compose .get_service_host ("hub" , 4444 )
72
+
73
+
55
74
def test_can_throw_exception_if_no_port_exposed ():
56
75
with DockerCompose (ROOT ) as compose :
57
76
with pytest .raises (NoSuchPortExposed ):
You can’t perform that action at this time.
0 commit comments