Skip to content

Commit

Permalink
Have integration test check lines further down the stack
Browse files Browse the repository at this point in the history
  • Loading branch information
joelea committed May 16, 2016
1 parent 6dd1e25 commit c1ca809
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package com.palantir.docker.compose.logging;

import static com.palantir.docker.compose.connection.waiting.HealthChecks.toHaveAllPortsOpen;
import static com.palantir.docker.compose.matchers.IOMatchers.file;
import static com.palantir.docker.compose.matchers.IOMatchers.fileWithConents;
import static com.palantir.docker.compose.matchers.IOMatchers.matchingPattern;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
Expand Down Expand Up @@ -53,8 +53,10 @@ public void logs_can_be_saved_to_a_directory() throws IOException, InterruptedEx
} finally {
loggingComposition.after();
}
assertThat(new File(logFolder.getRoot(), "db.log"), is(file(matchingPattern(".*Attaching to \\w+_db_1.*"))));
assertThat(new File(logFolder.getRoot(), "db2.log"), is(file(matchingPattern(".*Attaching to \\w+_db2_1.*"))));
assertThat(new File(logFolder.getRoot(), "db.log"), is(fileWithConents(matchingPattern(
".*Attaching to \\w+_db_1.*server started.*"))));
assertThat(new File(logFolder.getRoot(), "db2.log"), is(fileWithConents(matchingPattern(
".*Attaching to \\w+_db2_1.*server started.*"))));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected boolean matchesSafely() {
}

public static Matcher<File> fileContainingString(String contents) {
return file(containsString(contents));
return fileWithConents(containsString(contents));
}

public static Matcher<String> matchingPattern(String patternStr) {
Expand All @@ -94,7 +94,7 @@ protected boolean matchesSafely(String text, Description mismatchDescription) {
Pattern pattern = Pattern.compile(patternStr, Pattern.DOTALL);
boolean matches = pattern.matcher(text).matches();
if (!matches) {
mismatchDescription.appendText("not matching " + patternStr);
mismatchDescription.appendText(text);
}
return matches;
}
Expand All @@ -106,7 +106,7 @@ public void describeTo(Description description) {
};
}

public static Matcher<File> file(Matcher<String> contentsMatcher) {
public static Matcher<File> fileWithConents(Matcher<String> contentsMatcher) {
return new FeatureMatcher<File, String>(contentsMatcher, "file contents", "file contents") {

@Override
Expand Down

0 comments on commit c1ca809

Please sign in to comment.