Repository: flume
Updated Branches:
  refs/heads/trunk 9b65219cc -> 7c4b2fd3e


FLUME-2997. Fix flaky test in SpillableMemoryChannel

When the mock sinks are slower than sources, testParallelSingleSourceAndSink 
sometimes fails.
In such situations the channel can get full, thus uncaught ChannelFullException 
breaks the test.

Since testCapacityWithOverflow was designed to cover such a scenario, we
can safely fix the test by increasing the channel capacity to make sure it 
won't get full.

This commit does the previously mentioned change.

Reviewers: Bessenyei Balázs Donát

(Attila Simon via Bessenyei Balázs Donát)


Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/7c4b2fd3
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/7c4b2fd3
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/7c4b2fd3

Branch: refs/heads/trunk
Commit: 7c4b2fd3e88f038dea3bdae01eb864547770ad48
Parents: 9b65219
Author: Attila Simon <[email protected]>
Authored: Thu Oct 27 13:31:40 2016 +0200
Committer: Bessenyei Balázs Donát <[email protected]>
Committed: Thu Oct 27 13:48:06 2016 +0200

----------------------------------------------------------------------
 .../apache/flume/channel/TestSpillableMemoryChannel.java    | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/7c4b2fd3/flume-ng-channels/flume-spillable-memory-channel/src/test/java/org/apache/flume/channel/TestSpillableMemoryChannel.java
----------------------------------------------------------------------
diff --git 
a/flume-ng-channels/flume-spillable-memory-channel/src/test/java/org/apache/flume/channel/TestSpillableMemoryChannel.java
 
b/flume-ng-channels/flume-spillable-memory-channel/src/test/java/org/apache/flume/channel/TestSpillableMemoryChannel.java
index ab90c3d..8a0d576 100644
--- 
a/flume-ng-channels/flume-spillable-memory-channel/src/test/java/org/apache/flume/channel/TestSpillableMemoryChannel.java
+++ 
b/flume-ng-channels/flume-spillable-memory-channel/src/test/java/org/apache/flume/channel/TestSpillableMemoryChannel.java
@@ -805,7 +805,7 @@ public class TestSpillableMemoryChannel {
 
     Map<String, String> params = new HashMap<String, String>();
     params.put("memoryCapacity", "0");
-    params.put("overflowCapacity", "500020");
+    params.put("overflowCapacity", String.valueOf(eventCount));
     params.put("overflowTimeout", "3");
     startChannel(params);
 
@@ -822,12 +822,11 @@ public class TestSpillableMemoryChannel {
 
     watch.elapsed();
 
-    System.out.println("Total puts " + channel.drainOrder.totalPuts);
-
     System.out.println("Max Queue size " + channel.getMaxMemQueueSize());
-    System.out.println(channel.memQueue.size());
 
-    System.out.println("done");
+    Assert.assertEquals(eventCount, channel.drainOrder.totalPuts);
+    Assert.assertEquals("Channel not fully drained", 0, 
channel.getTotalStored());
+    System.out.println("testParallelMultipleSourcesAndSinks done");
   }
 
   static class StopWatch {

Reply via email to