From c1ca809dc605dd71d1bb3eedf0917ba39012d745 Mon Sep 17 00:00:00 2001 From: Joe Lea Date: Mon, 16 May 2016 14:38:40 +0100 Subject: [PATCH] Have integration test check lines further down the stack --- .../logging/DockerCompositionLoggingIntegrationTest.java | 8 +++++--- .../com/palantir/docker/compose/matchers/IOMatchers.java | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/test/java/com/palantir/docker/compose/logging/DockerCompositionLoggingIntegrationTest.java b/src/test/java/com/palantir/docker/compose/logging/DockerCompositionLoggingIntegrationTest.java index dc25b9159..7bfd3554f 100644 --- a/src/test/java/com/palantir/docker/compose/logging/DockerCompositionLoggingIntegrationTest.java +++ b/src/test/java/com/palantir/docker/compose/logging/DockerCompositionLoggingIntegrationTest.java @@ -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; @@ -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.*")))); } } diff --git a/src/test/java/com/palantir/docker/compose/matchers/IOMatchers.java b/src/test/java/com/palantir/docker/compose/matchers/IOMatchers.java index c52159ad4..41cf9d204 100644 --- a/src/test/java/com/palantir/docker/compose/matchers/IOMatchers.java +++ b/src/test/java/com/palantir/docker/compose/matchers/IOMatchers.java @@ -84,7 +84,7 @@ protected boolean matchesSafely() { } public static Matcher fileContainingString(String contents) { - return file(containsString(contents)); + return fileWithConents(containsString(contents)); } public static Matcher matchingPattern(String patternStr) { @@ -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; } @@ -106,7 +106,7 @@ public void describeTo(Description description) { }; } - public static Matcher file(Matcher contentsMatcher) { + public static Matcher fileWithConents(Matcher contentsMatcher) { return new FeatureMatcher(contentsMatcher, "file contents", "file contents") { @Override