Skip to content

Commit 7c847d8

Browse files
authored
fix: container.ready() race condition, when exposed ports is not available yet (#49)
1 parent c80373e commit 7c847d8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pytest_docker_tools/wrappers/container.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ def ready(self):
9292
ports = self._container.attrs["NetworkSettings"]["Ports"]
9393
for port, listeners in ports.items():
9494
if not listeners:
95+
if port in (self._container.attrs["HostConfig"]["PortBindings"] or []):
96+
return False
9597
continue
9698

9799
port, proto = port.split("/")

0 commit comments

Comments
 (0)