This is an automated email from the ASF dual-hosted git repository.

vjasani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new f0bc331  HBASE-24712 : Remove flakes from 
TestMasterNoCluster#testStopDuringStart (#2045)
f0bc331 is described below

commit f0bc33122e01e0b99c04e48f045414e634a4720b
Author: Viraj Jasani <[email protected]>
AuthorDate: Fri Jul 10 20:41:03 2020 +0530

    HBASE-24712 : Remove flakes from TestMasterNoCluster#testStopDuringStart 
(#2045)
    
    Forward-port from 
https://github.com/apache/hbase/commit/91da188d78e15ec3ff699765d5983cc372a85997
---
 .../hadoop/hbase/master/TestMasterNoCluster.java     | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNoCluster.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNoCluster.java
index 03b048b..5979f48 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNoCluster.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNoCluster.java
@@ -25,6 +25,7 @@ import org.apache.hadoop.hbase.Abortable;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.Waiter;
 import org.apache.hadoop.hbase.ZooKeeperConnectionException;
 import org.apache.hadoop.hbase.testclassification.MasterTests;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
@@ -43,6 +44,8 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.TestName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Standup the master and fake it to test various aspects of master function.
@@ -59,6 +62,8 @@ public class TestMasterNoCluster {
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestMasterNoCluster.class);
 
+  private static final Logger LOG = 
LoggerFactory.getLogger(TestMasterNoCluster.class);
+
   private static final HBaseTestingUtility TESTUTIL = new 
HBaseTestingUtility();
 
   @Rule
@@ -95,7 +100,20 @@ public class TestMasterNoCluster {
         return false;
       }
     });
-    ZKUtil.deleteNodeRecursively(zkw, zkw.getZNodePaths().baseZNode);
+    // Before fails sometimes so retry.
+    try {
+      TESTUTIL.waitFor(10000, (Waiter.Predicate<Exception>) () -> {
+        try {
+          ZKUtil.deleteNodeRecursively(zkw, zkw.getZNodePaths().baseZNode);
+          return true;
+        } catch (KeeperException.NotEmptyException e) {
+          LOG.info("Failed delete, retrying", e);
+        }
+        return false;
+      });
+    } catch (Exception e) {
+      LOG.info("Failed zk clear", e);
+    }
     zkw.close();
   }
 

Reply via email to