Skip to content

Commit 54abc7e

Browse files
committed
docker-compose test added
1 parent 688131f commit 54abc7e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_docker_compose.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import os
22

3+
import pytest
4+
35
from testcontainers.compose import DockerCompose
6+
from testcontainers.core.exceptions import NoSuchPortExposed
47

58

69
def test_can_spawn_service_via_compose():
@@ -14,3 +17,13 @@ def test_can_spawn_service_via_compose():
1417
assert port == "4444"
1518
finally:
1619
compose.stop()
20+
21+
22+
def test_can_throw_exception_if_no_port_exposed():
23+
compose = DockerCompose(os.path.dirname(__file__))
24+
25+
compose.start()
26+
with pytest.raises(NoSuchPortExposed):
27+
compose.get_service_host("hub", 5555)
28+
29+
compose.stop()

0 commit comments

Comments
 (0)