[FLINK-2464][tests] Add logging to BufferSpillerTest to help debug spurious failures.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/7ee02758 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/7ee02758 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/7ee02758 Branch: refs/heads/master Commit: 7ee0275804232056b144fca8e9bb41bab37cef68 Parents: 83102f0 Author: Stephan Ewen <[email protected]> Authored: Sun Aug 2 20:44:50 2015 +0200 Committer: Stephan Ewen <[email protected]> Committed: Mon Aug 3 00:54:36 2015 +0200 ---------------------------------------------------------------------- .../flink/streaming/runtime/io/BufferSpillerTest.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/7ee02758/flink-staging/flink-streaming/flink-streaming-core/src/test/java/org/apache/flink/streaming/runtime/io/BufferSpillerTest.java ---------------------------------------------------------------------- diff --git a/flink-staging/flink-streaming/flink-streaming-core/src/test/java/org/apache/flink/streaming/runtime/io/BufferSpillerTest.java b/flink-staging/flink-streaming/flink-streaming-core/src/test/java/org/apache/flink/streaming/runtime/io/BufferSpillerTest.java index 05ce4be..ca6df16 100644 --- a/flink-staging/flink-streaming/flink-streaming-core/src/test/java/org/apache/flink/streaming/runtime/io/BufferSpillerTest.java +++ b/flink-staging/flink-streaming/flink-streaming-core/src/test/java/org/apache/flink/streaming/runtime/io/BufferSpillerTest.java @@ -30,6 +30,8 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Random; @@ -40,6 +42,8 @@ import java.util.concurrent.atomic.AtomicReference; import static org.junit.Assert.*; public class BufferSpillerTest { + + private static final Logger LOG = LoggerFactory.getLogger(BufferSpillerTest.class); private static final int PAGE_SIZE = 4096; @@ -179,6 +183,8 @@ public class BufferSpillerTest { @Test public void testSpillWhileReading() { + LOG.debug("Starting SpillWhileReading test"); + try { final int sequences = 10; @@ -287,7 +293,11 @@ public class BufferSpillerTest { MemorySegment seg = buf.getMemorySegment(); for (int i = 0; i < expectedSize; i++) { - assertEquals("wrong buffer contents", (byte) i, seg.get(i)); + byte expected = (byte) i; + if (expected != seg.get(i)) { + fail(String.format( + "wrong buffer contents at position %s : expected=%d , found=%d", i, expected, seg.get(i))); + } } } @@ -349,6 +359,8 @@ public class BufferSpillerTest { int numBuffersAndEvents = nextSequence.numBuffersAndEvents; int numChannels = nextSequence.numChannels; + LOG.debug("Reading sequence {}", consumedSequences); + // consume sequence seq.open();
