luwak
luwak copied to clipboard
Test testParallelSlowLog() fails when run independently
The test uk.co.flax.luwak.matchers.TestParallelMatcher.testParallelSlowLog() inside ConcurrentMatcherTestBase.java fails if run independently.
I used the following command to run the test using mvn:
mvn test -Dtest=uk.co.flax.luwak.matchers.TestParallelMatcher#testParallelSlowLog -DfailIfNoTests=false
Failure log:
testParallelSlowLog(uk.co.flax.luwak.matchers.TestParallelMatcher) Time elapsed: 0.714 sec <<< FAILURE!
java.lang.AssertionError:
Expecting:
<"Limit: 0
1 [256454792ns]
2 [2220334ns]
3 [256454500ns]
">
not to contain:
<"2 [">
at uk.co.flax.luwak.matchers.ConcurrentMatcherTestBase.testParallelSlowLog(ConcurrentMatcherTestBase.java:118)
The assertion that fails is:
assertThat(matches.getSlowLog().toString())
.contains("1 [")
.contains("3 [")
.doesNotContain("2 [");
The test passes when the following change is made, calling getSlowLog() directly without using the matches object:
assertThat(monitor.match(batch, factory).getSlowLog().toString())
.contains("1 [")
.contains("3 [")
.doesNotContain("2 [");
The change is small and does not affect the test logic, I am raising this issue to discuss if I can raise a PR for the fix and to get some feedback on any alternative approach for making the test work on its own.