accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject [2/3] git commit: ACCUMULO-2798 make MonitorLoggingIT retry.
Date Tue, 13 May 2014 14:14:05 GMT
ACCUMULO-2798 make MonitorLoggingIT retry.

Sets a timeout so it doesn't retry forever.


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

Branch: refs/heads/master
Commit: e8fab2f89ca8bfaedb13a699e5b3f73551e14bbf
Parents: a73cf85
Author: Sean Busbey <busbey@cloudera.com>
Authored: Mon May 12 20:05:01 2014 -0500
Committer: Sean Busbey <busbey@cloudera.com>
Committed: Tue May 13 08:48:53 2014 -0500

----------------------------------------------------------------------
 .../test/functional/MonitorLoggingIT.java       | 26 +++++++++++++++-----
 1 file changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/e8fab2f8/test/src/test/java/org/apache/accumulo/test/functional/MonitorLoggingIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/MonitorLoggingIT.java
b/test/src/test/java/org/apache/accumulo/test/functional/MonitorLoggingIT.java
index 2dadafe..c4a2e3d 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/MonitorLoggingIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/MonitorLoggingIT.java
@@ -50,7 +50,12 @@ public class MonitorLoggingIT extends ConfigurableMacIT {
   }
 
   private static final int NUM_LOCATION_PASSES = 5;
-  private static final long LOCATION_DELAY = 5000L;
+  private static final int LOCATION_DELAY = 5000;
+
+  @Override
+  protected int defaultTimeoutSeconds() {
+    return (NUM_LOCATION_PASSES + 2) * LOCATION_DELAY;
+  }
 
   @Test
   public void logToMonitor() throws Exception {
@@ -82,12 +87,21 @@ public class MonitorLoggingIT extends ConfigurableMacIT {
     } catch (Exception e) {
       // expected, the iterator was bad
     }
-    Thread.sleep(5000L);  // extra precaution to ensure monitor has opportunity to log
 
-    // Verify messages were received at the monitor.
-    URL url = new URL("http://" + monitorLocation + "/log");
-    log.debug("Fetching web page " + url);
-    String result = FunctionalTestUtils.readAll(url.openStream());
+    String result = "";
+    while(true) {
+      Thread.sleep(LOCATION_DELAY);  // extra precaution to ensure monitor has opportunity
to log
+
+      // Verify messages were received at the monitor.
+      URL url = new URL("http://" + monitorLocation + "/log");
+      log.debug("Fetching web page " + url);
+      result = FunctionalTestUtils.readAll(url.openStream());
+      if (result.contains("<pre class='logevent'>")) {
+        break;
+      }
+      log.debug("No messages found, waiting a little longer...");
+    }
+
     assertTrue("No log messages found", result.contains("<pre class='logevent'>"));
 
     // Shutdown cleanly.


Mime
View raw message