Przeglądaj źródła

ZOOKEEPER-3046: added junit timeout to precede 'ant' timeout

When 'ant' timeout triggers, output of the test isn't captured.
Related issue ZOOKEEPER-2916

Author: Bogdan Kanivets <bkanivets@gmail.com>

Reviewers: phunt@apache.org

Closes #523 from lavacat/test-timeouts

Change-Id: I4941451395bd4f35342582e9f4852d73104da138
(cherry picked from commit 831bfebaec2500c5672fd665020b517282d9a8a9)
Signed-off-by: Patrick Hunt <phunt@apache.org>
Bogdan Kanivets 7 lat temu
rodzic
commit
587898ac9f

+ 5 - 1
src/java/test/org/apache/zookeeper/server/quorum/StandaloneDisabledTest.java

@@ -28,6 +28,7 @@ import org.apache.zookeeper.data.Stat;
 import org.apache.zookeeper.PortAssignment;
 import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.admin.ZooKeeperAdmin;
+import org.apache.zookeeper.client.FourLetterWordMain;
 import org.apache.zookeeper.test.ClientBase;
 import org.apache.zookeeper.test.ReconfigTest;
 import org.junit.Assert;
@@ -52,7 +53,7 @@ public class StandaloneDisabledTest extends QuorumPeerTestBase {
      * Test normal quorum operations work cleanly
      * with just a single server.
      */
-    @Test
+    @Test(timeout = 600000)
     public void startSingleServerTest() throws Exception {
         setUpData();
 
@@ -179,6 +180,9 @@ public class StandaloneDisabledTest extends QuorumPeerTestBase {
         zkHandles[id] = ClientBase.createZKClient("127.0.0.1:" + clientPorts[id]);
         zkAdminHandles[id] = new ZooKeeperAdmin("127.0.0.1:" + clientPorts[id], CONNECTION_TIMEOUT, this);
         zkAdminHandles[id].addAuthInfo("digest", "super:test".getBytes());
+        String statCommandOut = FourLetterWordMain.send4LetterWord("127.0.0.1", clientPorts[id], "stat");
+        LOG.info(String.format("Started server id %d with config:\n%s\nStat output:\n%s",
+                id, config, statCommandOut));
     }
 
     /**

+ 2 - 1
src/java/test/org/apache/zookeeper/test/DisconnectedWatcherTest.java

@@ -178,7 +178,7 @@ public class DisconnectedWatcherTest extends ClientBase {
 
     // @see jira issue ZOOKEEPER-706. Test auto reset of a large number of
     // watches which require multiple SetWatches calls.
-    @Test
+    @Test(timeout = 600000)
     public void testManyChildWatchersAutoReset() throws Exception {
         ZooKeeper zk1 = createClient();
 
@@ -199,6 +199,7 @@ public class DisconnectedWatcherTest extends ClientBase {
                                      CreateMode.PERSISTENT_SEQUENTIAL);
             paths.add(path);
         }
+        LOG.info("Created 10,000 nodes.");
 
         MyWatcher childWatcher = new MyWatcher();