Parameterize "timeout" and "pause" variables in "wait_for_service"
jeromecremers opened this issue · 0 comments
jeromecremers commented
timeout
and pause
are now hardcoded. My service unfortunately reaches timout during CI/CD.
Suggested solution:
def wait_for_service(self, service, private_port, timeout=30, pause=0.1, check_server=check_url):
"""
Waits for the given service to response to a http GET.
:param service: the service name as defined in the docker compose file
:param private_port: the private port as defined in docker compose file
:param check_server: optional function to check if the server is ready
(default check method makes GET request to '/'
of HTTP endpoint)
:return: the public port of the service exposed to host system if any
"""
public_port = self.port_for(service, private_port)
self.wait_until_responsive(
timeout=timeout,
pause=pause,
check=lambda: check_server(self.docker_ip, public_port),
)
return public_port