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
chore: resolve IPv4-IPv6 issues #2403
Open
mdelapenya
wants to merge
21
commits into
testcontainers:main
Choose a base branch
from
mdelapenya:host-port-binding-ip-family
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
chore: resolve IPv4-IPv6 issues #2403
mdelapenya
wants to merge
21
commits into
testcontainers:main
from
mdelapenya:host-port-binding-ip-family
+328
−32
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It will avoid random ports to be retrieved, so that the wait strategy does not choose the wrong port
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
* main: chore(deps): Bumping ChromaGo client version (testcontainers#2402) chore(deps): bump github.com/docker/docker from 25.0.3+incompatible to 25.0.5+incompatible (testcontainers#2444)
@cristianrgreco I ping you as you already implemented this for NodeJS, and I used it as reference. Could you please take a look? 🙏 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
It looks up the bounded ports every time a container needs to get a mapped port. It also improves the wait strategies (http and host-port) to get the bound port.
To get the bound port, we'll get the host IP addresses from the current Docker Host, and with that list of values, and the ports from a container, we will get the bound ports.
Finally, we are deprecating the
ForceIPv4LocalHost
field from the HTTPStrategy, as it's not needed anymore. The example test is updated to fix the port in the wait strategy.Why is it important?
Resolves flakiness in the CI, as the testable example is failing in a non consistent manner: because the test exposes two ports, 8080 and 80, the way Docker is retrieving them from the JSON representation is not deterministic (it's a port map), therefore, the test is sometimes returning the 80 port for getting the HTTP endpoint and others, the 8080 port.
At the same time, it adds a more consistent manner of getting the host and the port, relying on the Docker host, taking into consideration the IPv4 and IPv6 families.
Related issues