-
-
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
Implement pre-flight checks #363
Conversation
Added CHANGELOG record :) Ready for the merge from my side |
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.
Pretty cool!
@@ -24,7 +24,8 @@ | |||
|
|||
private String ambassadorContainerImage = "richnorth/ambassador:latest"; | |||
private String vncRecordedContainerImage = "richnorth/vnc-recorder:latest"; | |||
private String tinyImage = "alpine:3.2"; | |||
private String tinyImage = "alpine:3.5"; | |||
private Boolean disableChecks = false; |
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.
Curios here: Why Boolean and not boolean?
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.
leftover from previous implementation actually :) will change to boolean, thanks :)
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.
It seems configuring Testcontainers using properties isn't documented yet, we might want to add this now as well.
if (!TestcontainersConfiguration.getInstance().getDisableChecks()) { | ||
VisibleAssertions.info("Checking the system..."); | ||
|
||
VisibleAssertions.assertThat("Docker version", version.getVersion(), new BaseMatcher<String>() { |
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.
Do you think it would be possible, to have each check in its own method? Would make the method much more readable and it would directly be visible, which checks are performed.
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.
sure, why not
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.
Agree re putting each check in a separate method.
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.
Only trivial comments from me. Feel free to merge when you're happy with it!
public void describeTo(Description description) { | ||
description.appendText("is newer than 1.6.0"); | ||
} | ||
}); |
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.
Couldn't this be a bit shorter by just using an assertTrue
method? An anonymous inner class to satisfy assertThat
feels a bit heavy..?
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.
I decided to use Matcher because in case of a failure it will print current version - helps to debug
if (!TestcontainersConfiguration.getInstance().getDisableChecks()) { | ||
VisibleAssertions.info("Checking the system..."); | ||
|
||
VisibleAssertions.assertThat("Docker version", version.getVersion(), new BaseMatcher<String>() { |
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.
Agree re putting each check in a separate method.
To simplify the first experience with TestContainers, we can provide pre-flight checks to distinguish user errors and environment/Docker/TestContainers errors.
Implemented checks:
The overhead of running these additional checks (compared to what we already had before this change, ~3s on my machine) is very small (100-200ms on my machine), but I also added a property to disable the checks completely (imagine
experienced users who already integrated TC and want to speed up their local setup for instance)