You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2017/11/14 02:21:41 UTC

[6/9] hbase git commit: HBASE-19250 TestClientClusterStatus is flaky

HBASE-19250 TestClientClusterStatus is flaky


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

Branch: refs/heads/branch-2
Commit: efe116f11a747421906d44964a1f78761192a2c3
Parents: 57aa6b3
Author: Andrew Purtell <ap...@apache.org>
Authored: Mon Nov 13 16:50:24 2017 -0800
Committer: Andrew Purtell <ap...@apache.org>
Committed: Mon Nov 13 18:02:21 2017 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/client/TestClientClusterStatus.java   | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/efe116f1/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
index ba5baa8..3e7d63a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
@@ -31,6 +31,8 @@ import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.Waiter;
+import org.apache.hadoop.hbase.Waiter.Predicate;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
 import org.apache.hadoop.hbase.coprocessor.MasterCoprocessor;
 import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
@@ -127,6 +129,7 @@ public class TestClientClusterStatus {
 
   @Test
   public void testLiveAndDeadServersStatus() throws Exception {
+    // Count the number of live regionservers
     List<RegionServerThread> regionserverThreads = CLUSTER.getLiveRegionServerThreads();
     int numRs = 0;
     int len = regionserverThreads.size();
@@ -135,6 +138,16 @@ public class TestClientClusterStatus {
         numRs++;
       }
     }
+    // Depending on the (random) order of unit execution we may run this unit before the
+    // minicluster is fully up and recovered from the RS shutdown done during test init.
+    Waiter.waitFor(CLUSTER.getConfiguration(), 10 * 1000, 100, new Predicate<Exception>() {
+      @Override
+      public boolean evaluate() throws Exception {
+        ClusterStatus status = ADMIN.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS));
+        Assert.assertNotNull(status);
+        return status.getRegionsCount() > 0;
+      }
+    });
     // Retrieve live servers and dead servers info.
     EnumSet<Option> options = EnumSet.of(Option.LIVE_SERVERS, Option.DEAD_SERVERS);
     ClusterStatus status = ADMIN.getClusterStatus(options);