Support restart on 5 containers with previously fixed ports #895
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.
As pointed out in #893 (comment), individual testcontainers should not store their mapped ports in class members, as the mapped port will change in restart.
There are many test containers that currently use that pattern of port mapping, meaning they wont work after a restart. This PR fixes five of them:
There are few others that have similar port mapping (Neo4j, ArangoDB, PostgreSQL etc...), but they utilize wait strategies that do not currently work with restarts. For example, Neo4j expects a certain log message to appear before it is "ready", but that log message only appears on initial start, not on restart. This seems a bit more complex to solve, so I left them outside of scope of this PR for now. Will probably take another look at it later in separate PR, as there were previous commits solving this very issue, but they were later overwritten in another fix.
For successful CI run, see PR in this fork