Skip to content

Commit

Permalink
connect
Browse files Browse the repository at this point in the history
  • Loading branch information
jiridanek committed Jan 26, 2025
1 parent 0585b38 commit d3b3a6d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/containers/workbenches/workbench_image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_ipv6_only(self, image: str, test_frame):
ipv6_address = (container.get_wrapped_container().attrs
["NetworkSettings"]["Networks"][network.name]["GlobalIPv6Address"])

container._connect(container_host=ipv6_address)
container._connect(container_host=ipv6_address, container_port=container.port)
finally:
# try to grab logs regardless of whether container started or not
stdout, stderr = container.get_logs()
Expand Down Expand Up @@ -142,6 +142,9 @@ def _connect(self, container_host: str | None = None, container_port: int | None
# HTTP 302 (i.e. `except urllib.error.HTTPError as e: assert e.code == 302`) every time
cookie_jar = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cookie_jar))
# host may be an ipv6 address, need to be careful with formatting this
if ":" in host:
host = f"[{host}]"
result = opener.open(urllib.request.Request(f"http://{host}:{port}"), timeout=1)
except urllib.error.URLError as e:
raise e
Expand Down

0 comments on commit d3b3a6d

Please sign in to comment.