Support prioritization of DockerClientProviderStrategies#362
Merged
Conversation
rnorth
reviewed
Jun 11, 2017
| return true; | ||
| } | ||
|
|
||
| protected int getPriority() { |
Member
There was a problem hiding this comment.
Maybe worth mentioning in a comment how the priority is used (i.e. highest to lowest) for avoidance of doubt.
rnorth
reviewed
Jun 11, 2017
| throw new IllegalStateException("Could not find a valid Docker environment. Please see logs and check configuration"); | ||
| return strategies.stream() | ||
| .filter(DockerClientProviderStrategy::isApplicable) | ||
| .sorted(Comparator.comparing(DockerClientProviderStrategy::getPriority).reversed()) |
Member
There was a problem hiding this comment.
My only slight concern with determining the order at run time is that it means there's no one place you can look in the code to see the sequence. Now people will have to look at the implementations of all the strategies to figure out what order they'll run in.
Having said that, this does allow us to do dynamic prioritisation. So, e.g. as I mentioned on Slack, caching last known good config somewhere. Is that the kind of thing you had in mind too?
Member
There was a problem hiding this comment.
Ignore that - the PR title gives it away 🤦♂️
👍 !
… selected DockerClientProviderStrategy globally.
# Conflicts: # CHANGELOG.md # core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java
# Conflicts: # CHANGELOG.md
This file contains hidden or 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
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.
To improve the start-up time, we can adjust the priorities of strategies based on the environment.
Please review "isApplicable" very carefully to avoid some breaking changes :)