Skip to content

Commit

Permalink
Use 0.0.0.0 instead of localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
dcermak committed Jan 14, 2025
1 parent 4a7314e commit 7013037
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/test_port_forwarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def test_port_forward_set_up(auto_container: ContainerData, host):

assert (
host.check_output(
f"{_CURL} localhost:{auto_container.forwarded_ports[0].host_port}",
f"{_CURL} 0.0.0.0:{auto_container.forwarded_ports[0].host_port}",
).strip()
== "Hello Green World!"
)
Expand Down Expand Up @@ -163,15 +163,16 @@ def test_multiple_open_ports(container: ContainerData, number: int, host):
and container.forwarded_ports[0].container_port == 80
)
assert f"Test page {number}" in host.check_output(
f"{_CURL} localhost:{container.forwarded_ports[0].host_port}"
f"{_CURL} 0.0.0.0:{container.forwarded_ports[0].host_port}"
)

assert (
container.forwarded_ports[1].protocol == NetworkProtocol.TCP
and container.forwarded_ports[1].container_port == 443
)

assert f"Test page {number}" in host.check_output(
f"curl --insecure https://localhost:{container.forwarded_ports[1].host_port}",
f"curl --insecure https://0.0.0.0:{container.forwarded_ports[1].host_port}",
)


Expand Down Expand Up @@ -243,7 +244,7 @@ def test_container_bind_to_host_port(

assert launcher.container_data.forwarded_ports[0].host_port == PORT
assert (
host.check_output(f"{_CURL} http://localhost:{PORT}").strip()
host.check_output(f"{_CURL} http://0.0.0.0:{PORT}").strip()
== "Hello Green World!"
)

Expand Down Expand Up @@ -273,6 +274,6 @@ def test_pod_bind_to_host_port(

assert launcher.pod_data.forwarded_ports[0].host_port == PORT
assert (
host.check_output(f"{_CURL} http://localhost:{PORT}").strip()
host.check_output(f"{_CURL} http://0.0.0.0:{PORT}").strip()
== "Hello Green World!"
)

0 comments on commit 7013037

Please sign in to comment.