-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Remove withPublishAllPorts from Ryuk and stabilize containerInfo content on start #4263
Conversation
Using publish-all on Windows might lead to the usage of ports in the excluded port range.
Not sure why Works fine locally. |
core/src/main/java/org/testcontainers/containers/GenericContainer.java
Outdated
Show resolved
Hide resolved
.stream().filter(Objects::nonNull).count(); | ||
|
||
if (mappedExposedPorts != exposedPorts.size()) { | ||
throw new ContainerLaunchException("Inspect container response did not contain mapped ports"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we include a small sleep to give the API results time to update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I thought sleeping is built into Unreliables
, it is not? Then I probably confused this with Awaitility. 100ms?
core/src/main/java/org/testcontainers/utility/ResourceReaper.java
Outdated
Show resolved
Hide resolved
In case of no mapped exposed ports, the Unreliables lambda should finish after first execution after all.
Interestingly, the last commit made |
@kiview |
Oh, I lost the context over the weekend. I added the if-clause specifically for the Is there an alternative to creating an |
core/src/main/java/org/testcontainers/utility/ResourceReaper.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/testcontainers/containers/GenericContainer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/testcontainers/containers/GenericContainer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/testcontainers/containers/GenericContainer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/testcontainers/utility/ResourceReaper.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/testcontainers/utility/ResourceReaper.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/testcontainers/containers/GenericContainer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/testcontainers/utility/DynamicPollInterval.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/testcontainers/utility/ResourceReaper.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/testcontainers/containers/GenericContainer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/testcontainers/utility/ResourceReaper.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed on Slack, we should handle withCreateContainerCmdModifier
-like case, where additional ports are exposed without an entry in exposedPorts
In addition, containers from images that have ports defined using |
@kiview even without PublishAll? o_O |
Yes, because they are still exposed, just not published. I added those cases into a test, to increase the chance of failure in case of a regression on our side. |
core/src/test/java/org/testcontainers/containers/GenericContainerTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/testcontainers/containers/GenericContainerTest.java
Outdated
Show resolved
Hide resolved
…nerTest.java Co-authored-by: Sergei Egorov <bsideup@gmail.com>
Changes the start behavior of
GenericContainer
to ensure, thatcontainerInfo
is populated with all mapped ports.In addition,
withPublishAllPorts
is removed from Ryuk, since the method is deprecated and can lead to non-usable ports on Docker for Windows.This PR contains quite duplicate code with regards to polling
containerInfo
until the response stabilizes. I was not sure where to best extract this code to. Therefore, I submitted the PR in order to discuss this as well.This PR should improve Windows stability substantially and fix the issues described in #3609, originating upstream from docker/for-win#3171.
In addition, the non-idempotent behavior of
InspectContainerCmd
, as also observed in testcontainers/testcontainers-go#294 is handled, as it was also done in testcontainers/testcontainers-go#295.I have further created an issue upstream at docker/for-win#11584.