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

Implement pre-flight checks #363

Merged
merged 7 commits into from
Jun 18, 2017
Merged

Implement pre-flight checks #363

merged 7 commits into from
Jun 18, 2017

Conversation

bsideup
Copy link
Member

@bsideup bsideup commented Jun 10, 2017

To simplify the first experience with TestContainers, we can provide pre-flight checks to distinguish user errors and environment/Docker/TestContainers errors.

Implemented checks:

  • Free space (old one)
  • Exec functionality
  • Volume mappings
  • Network connectivity

screen shot 2017-06-10 at 7 00 17 pm

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)

@bsideup bsideup requested a review from rnorth June 10, 2017 16:55
@bsideup bsideup added this to the 1.3.1 milestone Jun 10, 2017
@bsideup
Copy link
Member Author

bsideup commented Jun 12, 2017

@rnorth

Added CHANGELOG record :) Ready for the merge from my side

Copy link
Contributor

@asafm asafm left a 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;
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Member

@kiview kiview left a 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>() {
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, why not

Copy link
Member

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.

Copy link
Member

@rnorth rnorth left a 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");
}
});
Copy link
Member

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..?

Copy link
Member Author

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

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.

@bsideup bsideup merged commit 23e5995 into master Jun 18, 2017
@bsideup bsideup deleted the pre-flight_checks branch June 18, 2017 10:21
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

4 participants