Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added docstring to host port finder code #226

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pytest_container/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ def create_host_port_port_forward(
# that, if we are still listening on it
with contextlib.ExitStack() as stack:
for port in port_forwards:
# we have to perform the port finding manually and not let the container runtime find ports for us
# every time we try to let container runtime pick ports, it leads to completely unreliable behavior and we waste a day or two
# if you nevertheless feel so inclined as to trying out to use the container runtime and fail, please increment this counter
# times_we_tried_to_use_the_container_runtime = 2

if socket.has_ipv6 and (":" in port.bind_ip or not port.bind_ip):
family = socket.AF_INET6
else:
Expand Down