FLUME-1524. Fix flaky MonitoredCounterGroup test.

(Mike Percy via Hari Shreedharan)


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

Branch: refs/heads/cdh-1.2.0+24_intuit
Commit: d3146b3dd92c1e0fec52c5af01937ad64290b5f4
Parents: 9ad93a9
Author: Hari Shreedharan <[email protected]>
Authored: Wed Aug 29 15:08:47 2012 -0700
Committer: Mike Percy <[email protected]>
Committed: Fri Sep 7 14:03:06 2012 -0700

----------------------------------------------------------------------
 .../instrumentation/TestMonitoredCounterGroup.java |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/d3146b3d/flume-ng-core/src/test/java/org/apache/flume/instrumentation/TestMonitoredCounterGroup.java
----------------------------------------------------------------------
diff --git 
a/flume-ng-core/src/test/java/org/apache/flume/instrumentation/TestMonitoredCounterGroup.java
 
b/flume-ng-core/src/test/java/org/apache/flume/instrumentation/TestMonitoredCounterGroup.java
index 1b8447a..0a730e9 100644
--- 
a/flume-ng-core/src/test/java/org/apache/flume/instrumentation/TestMonitoredCounterGroup.java
+++ 
b/flume-ng-core/src/test/java/org/apache/flume/instrumentation/TestMonitoredCounterGroup.java
@@ -157,6 +157,9 @@ public class TestMonitoredCounterGroup {
     assertSkCounterState(on, connCreated, connClosed, connFailed, batchEmpty,
         batchUnderflow, batchComplete, eventDrainAttempt, eventDrainSuccess);
 
+    // give start time a chance to increment
+    Thread.sleep(5L);
+
     skc.start();
     Assert.assertTrue("StartTime", getStartTime(on) != 0L);
     Assert.assertTrue("StartTime", getStartTime(on) > start1);
@@ -219,6 +222,9 @@ public class TestMonitoredCounterGroup {
     assertChCounterState(on, numChannelSize, numEventPutAttempt,
         numEventTakeAttempt, numEventPutSuccess, numEventTakeSuccess);
 
+    // give start time a chance to increment
+    Thread.sleep(5L);
+
     chc.start();
     Assert.assertTrue("StartTime", getStartTime(on) != 0L);
     Assert.assertTrue("StartTime", getStartTime(on) > start1);
@@ -280,6 +286,9 @@ public class TestMonitoredCounterGroup {
         numAppendReceived, numAppendAccepted, numAppendBatchReceived,
         numAppendBatchAccepted);
 
+    // give start time a chance to increment
+    Thread.sleep(5L);
+
     srcc.start();
     Assert.assertTrue("StartTime", getStartTime(on) != 0L);
     Assert.assertTrue("StartTime", getStartTime(on) > start1);

Reply via email to