You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flume.apache.org by pr...@apache.org on 2011/12/19 04:04:10 UTC

svn commit: r1220595 - /incubator/flume/trunk/flume-core/src/test/java/com/cloudera/flume/handlers/rolling/TestSlowSinkRoll.java

Author: prasadm
Date: Mon Dec 19 03:04:10 2011
New Revision: 1220595

URL: http://svn.apache.org/viewvc?rev=1220595&view=rev
Log:
Flume-798. Fixing the timing issue in TestSlowRollSink test

Modified:
    incubator/flume/trunk/flume-core/src/test/java/com/cloudera/flume/handlers/rolling/TestSlowSinkRoll.java

Modified: incubator/flume/trunk/flume-core/src/test/java/com/cloudera/flume/handlers/rolling/TestSlowSinkRoll.java
URL: http://svn.apache.org/viewvc/incubator/flume/trunk/flume-core/src/test/java/com/cloudera/flume/handlers/rolling/TestSlowSinkRoll.java?rev=1220595&r1=1220594&r2=1220595&view=diff
==============================================================================
--- incubator/flume/trunk/flume-core/src/test/java/com/cloudera/flume/handlers/rolling/TestSlowSinkRoll.java (original)
+++ incubator/flume/trunk/flume-core/src/test/java/com/cloudera/flume/handlers/rolling/TestSlowSinkRoll.java Mon Dec 19 03:04:10 2011
@@ -30,6 +30,7 @@ import java.io.File;
 import java.io.IOException;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.log4j.Level;
 import org.codehaus.jettison.json.JSONException;
@@ -151,8 +152,9 @@ public class TestSlowSinkRoll {
   @Test
   public void testSlowSinkRoll() throws IOException, InterruptedException {
     final File f = FileUtil.mktempdir();
+    final AtomicBoolean firstPass = new AtomicBoolean(true);
 
-    RollSink snk = new RollSink(new Context(), "test", 2000, 250) {
+    RollSink snk = new RollSink(new Context(), "test", 1000, 250) {
       @Override
       protected EventSink newSink(Context ctx) throws IOException {
         return new EscapedCustomDfsSink(ctx, "file:///" + f.getPath(),
@@ -160,7 +162,10 @@ public class TestSlowSinkRoll {
           @Override
           public void append(final Event e) throws IOException, InterruptedException {
             super.append(e);
-            Clock.sleep(1500);
+            if (firstPass.get()) {
+              firstPass.set(false);
+              Clock.sleep(3000);
+            }
           }
         };
       }
@@ -169,7 +174,7 @@ public class TestSlowSinkRoll {
     DummySource source = new DummySource(4);
     DirectDriver driver = new DirectDriver(source, snk);
     driver.start();
-    Clock.sleep(12200);
+    Clock.sleep(6000);
     driver.stop();
     assertTrue(snk.getMetrics().getLongMetric(RollSink.A_ROLL_ABORTED_APPENDS) > Long.valueOf(0));
   }