Skip to content

Commit

Permalink
Also catch URLError waiting for ServerContainer
Browse files Browse the repository at this point in the history
There was a race condition here because the server
hasn't always started before we send a request to
it. This was causing a lot of unnecessary test failures.
  • Loading branch information
mmwinther committed Nov 26, 2024
1 parent 4ced198 commit d8d2942
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/generic/testcontainers/generic/server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Union
from urllib.error import HTTPError
from urllib.error import HTTPError, URLError
from urllib.request import urlopen

import httpx
Expand Down Expand Up @@ -40,7 +40,7 @@ def __init__(self, port: int, image: Union[str, DockerImage]) -> None:
self.internal_port = port
self.with_exposed_ports(self.internal_port)

@wait_container_is_ready(HTTPError)
@wait_container_is_ready(HTTPError, URLError)
def _connect(self) -> None:
# noinspection HttpUrlsUsage
url = self._create_connection_url()
Expand Down

0 comments on commit d8d2942

Please sign in to comment.