HBASE-7554 TestZooKeeper depends on the execution order

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1432970 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
nkeywal 2013-01-14 16:06:16 +00:00
parent 90ed67dc9a
commit cfb6fbefe2
1 changed files with 16 additions and 4 deletions

View File

@ -57,6 +57,8 @@ import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.ZooKeeper.States;
import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Stat;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
@ -121,7 +123,7 @@ public class TestZooKeeper {
* @throws InterruptedException
*/
// fails frequently, disabled for now, see HBASE-6406
// @Test
//@Test
public void testClientSessionExpired() throws Exception {
Configuration c = new Configuration(TEST_UTIL.getConfiguration());
@ -229,7 +231,7 @@ public class TestZooKeeper {
* Make sure we can use the cluster
* @throws Exception
*/
public void testSanity() throws Exception{
private void testSanity() throws Exception{
HBaseAdmin admin =
new HBaseAdmin(TEST_UTIL.getConfiguration());
String tableName = "test"+System.currentTimeMillis();
@ -356,6 +358,10 @@ public class TestZooKeeper {
ZooKeeperWatcher zk2 = new ZooKeeperWatcher(TEST_UTIL.getConfiguration(),
"testMasterAddressManagerFromZK", null);
// Save the previous ACL
Stat s = new Stat();
List<ACL> oldACL = zk.getACL("/", s);
// I set this acl after the attempted creation of the cluster home node.
// Add retries in case of retryable zk exceptions.
while (true) {
@ -395,6 +401,12 @@ public class TestZooKeeper {
}
zk.close();
ZKUtil.createAndFailSilent(zk2, aclZnode);
// Restore the ACL
ZooKeeper zk3 = new ZooKeeper(quorumServers, sessionTimeout, EmptyWatcher.instance);
zk3.addAuthInfo("digest", "hbase:rox".getBytes());
zk3.setACL("/", oldACL, -1);
zk3.close();
}
/**
@ -463,8 +475,8 @@ public class TestZooKeeper {
ZKAssign.blockUntilNoRIT(zooKeeperWatcher);
HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName);
Put p = null;
int numberOfPuts = 0;
Put p;
int numberOfPuts;
for (numberOfPuts = 0; numberOfPuts < 6; numberOfPuts++) {
p = new Put(Bytes.toBytes(numberOfPuts));
p.add(Bytes.toBytes("col"), Bytes.toBytes("ql"), Bytes.toBytes("value" + numberOfPuts));