mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-13 21:12:57 +00:00
Choose random host port in tests
This commit is contained in:
@@ -108,6 +108,13 @@ class TrackedContainer:
|
||||
assert rv == 0 or rv["StatusCode"] == 0
|
||||
return logs
|
||||
|
||||
def get_host_port(self, container_port: str) -> str:
|
||||
assert isinstance(self.container, Container)
|
||||
self.container.reload()
|
||||
return self.container.attrs["NetworkSettings"]["Ports"][container_port][0][
|
||||
"HostPort"
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def get_errors(logs: str) -> list[str]:
|
||||
return TrackedContainer._lines_starting_with(logs, "ERROR")
|
||||
@@ -137,7 +144,6 @@ def container(docker_client: docker.DockerClient, image_name: str) -> Container:
|
||||
docker_client,
|
||||
image_name,
|
||||
detach=True,
|
||||
ports={"8888/tcp": 8888},
|
||||
)
|
||||
yield container
|
||||
container.remove()
|
||||
|
Reference in New Issue
Block a user