Repository: hbase
Updated Branches:
  refs/heads/branch-1 20cb39052 -> 7dfb3b319


HBASE-17764 Solve TestMultiSlaveReplication flakiness (Stephen Yuan Jiang)


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

Branch: refs/heads/branch-1
Commit: 7dfb3b3194b9096104020f4c87401813c4716dbe
Parents: 20cb390
Author: Stephen Yuan Jiang <syuanjiang...@gmail.com>
Authored: Thu Mar 9 18:38:57 2017 -0800
Committer: Stephen Yuan Jiang <syuanjiang...@gmail.com>
Committed: Thu Mar 9 18:38:57 2017 -0800

----------------------------------------------------------------------
 .../replication/TestMultiSlaveReplication.java  | 31 ++++++++++++++------
 1 file changed, 22 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7dfb3b31/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMultiSlaveReplication.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMultiSlaveReplication.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMultiSlaveReplication.java
index 8a59661..ccaf20f 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMultiSlaveReplication.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMultiSlaveReplication.java
@@ -54,7 +54,9 @@ import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
+import org.junit.After;
 import org.junit.AfterClass;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -107,10 +109,6 @@ public class TestMultiSlaveReplication {
     conf1.setLong(ReplicationZKLockCleanerChore.TTL_CONFIG_KEY, 0L);
 
     utility1 = new HBaseTestingUtility(conf1);
-    utility1.startMiniZKCluster();
-    MiniZooKeeperCluster miniZK = utility1.getZkCluster();
-    utility1.setZkCluster(miniZK);
-    new ZooKeeperWatcher(conf1, "cluster1", null, true);
 
     conf2 = new Configuration(conf1);
     conf2.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/2");
@@ -119,12 +117,8 @@ public class TestMultiSlaveReplication {
     conf3.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/3");
 
     utility2 = new HBaseTestingUtility(conf2);
-    utility2.setZkCluster(miniZK);
-    new ZooKeeperWatcher(conf2, "cluster2", null, true);
 
     utility3 = new HBaseTestingUtility(conf3);
-    utility3.setZkCluster(miniZK);
-    new ZooKeeperWatcher(conf3, "cluster3", null, true);
 
     table = new HTableDescriptor(tableName);
     HColumnDescriptor fam = new HColumnDescriptor(famName);
@@ -134,9 +128,28 @@ public class TestMultiSlaveReplication {
     table.addFamily(fam);
   }
 
+  @Before
+  public void startup() throws Exception {
+    utility1.startMiniZKCluster();
+    MiniZooKeeperCluster miniZK = utility1.getZkCluster();
+    utility1.setZkCluster(miniZK);
+    new ZooKeeperWatcher(conf1, "cluster1", null, true);
+
+    utility2.setZkCluster(miniZK);
+    new ZooKeeperWatcher(conf2, "cluster2", null, true);
+
+    utility3.setZkCluster(miniZK);
+    new ZooKeeperWatcher(conf3, "cluster3", null, true);
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    utility1.shutdownMiniZKCluster();
+  }
+
   @Test(timeout=300000)
   public void testMultiSlaveReplication() throws Exception {
-    LOG.info("testCyclicReplication");
+    LOG.info("Start the testMultiSlaveReplication Test");
     MiniHBaseCluster master = utility1.startMiniCluster();
     utility2.startMiniCluster();
     utility3.startMiniCluster();

Reply via email to