From 658bac81e3ea1925f07ade5b2387270abf17302e Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Wed, 17 Jul 2013 00:51:36 +0000 Subject: [PATCH] HBASE-8964 TestAccessController.testGlobalAuthorizationForNewRegisteredRS git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1503961 13f79535-47bb-0310-9956-ffa450edef68 --- .../security/access/TestAccessController.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java index 9a6f861e006..cb9f4df4f2b 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java @@ -127,6 +127,7 @@ public class TestAccessController { // user with no permissions private static User USER_NONE; + private static byte[] TEST_TABLE2 = Bytes.toBytes("testtable2"); private static byte[] TEST_FAMILY = Bytes.toBytes("f1"); private static MasterCoprocessorEnvironment CP_ENV; @@ -1917,7 +1918,7 @@ public class TestAccessController { verifyDenied(cloneAction, USER_CREATE, USER_RW, USER_RO, USER_NONE, USER_OWNER); } - @Test (timeout=30000) + @Test public void testGlobalAuthorizationForNewRegisteredRS() throws Exception { LOG.debug("Test for global authorization for a new registered RegionServer."); MiniHBaseCluster hbaseCluster = TEST_UTIL.getHBaseCluster(); @@ -1940,8 +1941,7 @@ public class TestAccessController { acl.close(); } HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); - final byte [] tableName = Bytes.toBytes("testGlobalAuthorizationForNewRegisteredRS"); - HTableDescriptor htd = new HTableDescriptor(tableName); + HTableDescriptor htd = new HTableDescriptor(TEST_TABLE2); htd.addFamily(new HColumnDescriptor(TEST_FAMILY)); admin.createTable(htd); @@ -1951,7 +1951,7 @@ public class TestAccessController { final HRegionServer newRs = newRsThread.getRegionServer(); // Move region to the new RegionServer. - HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName); + HTable table = new HTable(TEST_UTIL.getConfiguration(), TEST_TABLE2); try { NavigableMap regions = table .getRegionLocations(); @@ -1968,25 +1968,25 @@ public class TestAccessController { }; SUPERUSER.runAs(moveAction); - final int RETRIES_LIMIT = 100; + final int RETRIES_LIMIT = 10; int retries = 0; - while (newRs.getOnlineRegions(tableName).size() < 1 && retries < RETRIES_LIMIT) { - LOG.debug("Waiting for a region to be opened. Already retried " + retries + " times."); + while (newRs.getOnlineRegions(TEST_TABLE2).size() < 1 && retries < RETRIES_LIMIT) { + LOG.debug("Waiting for region to be opened. Already retried " + retries + + " times."); try { - Thread.sleep(1000); + Thread.sleep(200); } catch (InterruptedException e) { } retries++; if (retries == RETRIES_LIMIT - 1) { - fail("Retry exhaust for waiting region to be opened: " + - newRs.getOnlineRegions(tableName)); + fail("Retry exhaust for waiting region to be opened."); } } // Verify write permission for user "admin2" who has the global // permissions. PrivilegedExceptionAction putAction = new PrivilegedExceptionAction() { public Object run() throws Exception { - HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName); + HTable table = new HTable(TEST_UTIL.getConfiguration(), TEST_TABLE2); Put put = new Put(Bytes.toBytes("test")); put.add(TEST_FAMILY, Bytes.toBytes("qual"), Bytes.toBytes("value")); table.put(put);