HBASE-19278 Reenable cleanup in test teardown in TestAccessController3 disabled by HBASE-14614

Remove a few unused imports.

Remove TestAsyncRegionAdminApi#testOffline, a test for a condition that
no longer exists (no offlining supported in hbase2).

M hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController3.java
 Uncomment cleanup called in test teardown.
This commit is contained in:
Michael Stack 2017-11-15 19:03:50 -08:00
parent 54827cf613
commit 92f53218e3
No known key found for this signature in database
GPG Key ID: 9816C7FC8ACC93D2
4 changed files with 4 additions and 35 deletions

View File

@ -1,5 +1,4 @@
/** /*
*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -43,7 +42,6 @@ import org.apache.hadoop.hbase.util.JVMClusterUtil;
import org.apache.hadoop.hbase.util.Threads; import org.apache.hadoop.hbase.util.Threads;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

View File

@ -138,34 +138,6 @@ public class TestAsyncRegionAdminApi extends TestAsyncAdminBase {
} }
} }
@Ignore @Test
// Turning off this tests in AMv2. Doesn't make sense.Offlining means something
// different now.
// You can't 'offline' a region unless you know what you are doing
// Will cause the Master to tell the regionserver to shut itself down because
// regionserver is reporting the state as OPEN.
public void testOfflineRegion() throws Exception {
RegionInfo hri = createTableAndGetOneRegion(tableName);
RegionStates regionStates =
TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().getRegionStates();
admin.offline(hri.getRegionName()).get();
long timeoutTime = System.currentTimeMillis() + 3000;
while (true) {
if (regionStates.getRegionByStateOfTable(tableName).get(RegionState.State.OFFLINE)
.stream().anyMatch(r -> RegionInfo.COMPARATOR.compare(r, hri) == 0)) break;
long now = System.currentTimeMillis();
if (now > timeoutTime) {
fail("Failed to offline the region in time");
break;
}
Thread.sleep(10);
}
RegionState regionState = regionStates.getRegionState(hri);
assertTrue(regionState.isOffline());
}
@Test @Test
public void testGetRegionByStateOfTable() throws Exception { public void testGetRegionByStateOfTable() throws Exception {
RegionInfo hri = createTableAndGetOneRegion(tableName); RegionInfo hri = createTableAndGetOneRegion(tableName);

View File

@ -40,7 +40,6 @@ import org.apache.hadoop.hbase.testclassification.MasterTests;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.Ignore;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
@Category({MasterTests.class, LargeTests.class}) @Category({MasterTests.class, LargeTests.class})

View File

@ -30,6 +30,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.TableNotFoundException;
import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost; import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment; import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
@ -201,7 +202,7 @@ public class TestAccessController3 extends SecureTestUtil {
TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads()) { TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads()) {
rs = thread.getRegionServer(); rs = thread.getRegionServer();
} }
// cleanUp(); cleanUp();
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
assertTrue("region server should have aborted due to FaultyAccessController", rs.isAborted()); assertTrue("region server should have aborted due to FaultyAccessController", rs.isAborted());
} }
@ -265,13 +266,12 @@ public class TestAccessController3 extends SecureTestUtil {
// TODO: Skipping delete because of access issues w/ AMv2. // TODO: Skipping delete because of access issues w/ AMv2.
// AMv1 seems to crash servers on exit too for same lack of // AMv1 seems to crash servers on exit too for same lack of
// auth perms but it gets hung up. // auth perms but it gets hung up.
/*
try { try {
deleteTable(TEST_UTIL, TEST_TABLE); deleteTable(TEST_UTIL, TEST_TABLE);
} catch (TableNotFoundException ex) { } catch (TableNotFoundException ex) {
// Test deleted the table, no problem // Test deleted the table, no problem
LOG.info("Test deleted table " + TEST_TABLE); LOG.info("Test deleted table " + TEST_TABLE);
}*/ }
// Verify all table/namespace permissions are erased // Verify all table/namespace permissions are erased
assertEquals(0, AccessControlLists.getTablePermissions(conf, TEST_TABLE).size()); assertEquals(0, AccessControlLists.getTablePermissions(conf, TEST_TABLE).size());
assertEquals( assertEquals(