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

Support prioritization of DockerClientProviderStrategies #362

Merged
merged 8 commits into from
Jun 21, 2017

Conversation

bsideup
Copy link
Member

@bsideup bsideup commented Jun 10, 2017

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 :)

@bsideup bsideup requested review from rnorth and kiview June 10, 2017 16:25
@bsideup bsideup added this to the 1.3.1 milestone Jun 10, 2017
return true;
}

protected int getPriority() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth mentioning in a comment how the priority is used (i.e. highest to lowest) for avoidance of doubt.

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())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore that - the PR title gives it away 🤦‍♂️

👍 !

# Conflicts:
#	CHANGELOG.md
#	core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java
@rnorth rnorth merged commit 81952c4 into master Jun 21, 2017
@rnorth rnorth deleted the strategy_priorities branch June 21, 2017 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants