HBASE-17764 Solve TestMultiSlaveReplication flakiness (Stephen Yuan Jiang)

This commit is contained in:
Stephen Yuan Jiang 2017-03-09 18:38:57 -08:00
parent 20cb390529
commit 7dfb3b3194
1 changed files with 22 additions and 9 deletions

View File

@ -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();