HBASE-14596 TestCellACLs failing... on1.2 builds; TUNEUP
This commit is contained in:
parent
2ff6d0fe47
commit
2428c5f467
|
@ -31,9 +31,9 @@ import org.apache.hadoop.hbase.Cell;
|
||||||
import org.apache.hadoop.hbase.Coprocessor;
|
import org.apache.hadoop.hbase.Coprocessor;
|
||||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||||
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||||
import org.apache.hadoop.hbase.TableNotFoundException;
|
import org.apache.hadoop.hbase.TableNotFoundException;
|
||||||
import org.apache.hadoop.hbase.client.Admin;
|
|
||||||
import org.apache.hadoop.hbase.client.Connection;
|
import org.apache.hadoop.hbase.client.Connection;
|
||||||
import org.apache.hadoop.hbase.client.ConnectionFactory;
|
import org.apache.hadoop.hbase.client.ConnectionFactory;
|
||||||
import org.apache.hadoop.hbase.client.Delete;
|
import org.apache.hadoop.hbase.client.Delete;
|
||||||
|
@ -77,6 +77,7 @@ public class TestCellACLs extends SecureTestUtil {
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public TestTableName TEST_TABLE = new TestTableName();
|
public TestTableName TEST_TABLE = new TestTableName();
|
||||||
|
|
||||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||||
private static final byte[] TEST_FAMILY = Bytes.toBytes("f1");
|
private static final byte[] TEST_FAMILY = Bytes.toBytes("f1");
|
||||||
private static final byte[] TEST_ROW = Bytes.toBytes("cellpermtest");
|
private static final byte[] TEST_ROW = Bytes.toBytes("cellpermtest");
|
||||||
|
@ -95,10 +96,13 @@ public class TestCellACLs extends SecureTestUtil {
|
||||||
private static User USER_OTHER;
|
private static User USER_OTHER;
|
||||||
private static String[] usersAndGroups;
|
private static String[] usersAndGroups;
|
||||||
|
|
||||||
|
private Connection connection;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupBeforeClass() throws Exception {
|
public static void setupBeforeClass() throws Exception {
|
||||||
// setup configuration
|
// setup configuration
|
||||||
conf = TEST_UTIL.getConfiguration();
|
conf = TEST_UTIL.getConfiguration();
|
||||||
|
conf.setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT, 10);
|
||||||
// Enable security
|
// Enable security
|
||||||
enableSecurity(conf);
|
enableSecurity(conf);
|
||||||
// Verify enableSecurity sets up what we require
|
// Verify enableSecurity sets up what we require
|
||||||
|
@ -137,19 +141,19 @@ public class TestCellACLs extends SecureTestUtil {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
// Create the test table (owner added to the _acl_ table)
|
// Create the test table (owner added to the _acl_ table)
|
||||||
Admin admin = TEST_UTIL.getHBaseAdmin();
|
this.connection = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
|
||||||
HTableDescriptor htd = new HTableDescriptor(TEST_TABLE.getTableName());
|
HTableDescriptor htd = new HTableDescriptor(TEST_TABLE.getTableName());
|
||||||
HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY);
|
HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY);
|
||||||
hcd.setMaxVersions(4);
|
hcd.setMaxVersions(4);
|
||||||
htd.setOwner(USER_OWNER);
|
htd.setOwner(USER_OWNER);
|
||||||
htd.addFamily(hcd);
|
htd.addFamily(hcd);
|
||||||
admin.createTable(htd, new byte[][] { Bytes.toBytes("s") });
|
TEST_UTIL.createTable(htd, new byte[][] { Bytes.toBytes("s") });
|
||||||
TEST_UTIL.waitTableEnabled(TEST_TABLE.getTableName());
|
|
||||||
LOG.info("Sleeping a second because of HBASE-12581");
|
LOG.info("Sleeping a second because of HBASE-12581");
|
||||||
Threads.sleep(1000);
|
Threads.sleep(1000);
|
||||||
|
this.connection = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test (timeout=120000)
|
||||||
public void testCellPermissions() throws Exception {
|
public void testCellPermissions() throws Exception {
|
||||||
// store two sets of values, one store with a cell level ACL, and one without
|
// store two sets of values, one store with a cell level ACL, and one without
|
||||||
verifyAllowed(new AccessTestAction() {
|
verifyAllowed(new AccessTestAction() {
|
||||||
|
@ -159,17 +163,17 @@ public class TestCellACLs extends SecureTestUtil {
|
||||||
Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Put p;
|
Put p;
|
||||||
// with ro ACL
|
// with ro ACL
|
||||||
p = new Put(TEST_ROW).add(TEST_FAMILY, TEST_Q1, ZERO);
|
p = new Put(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q1, ZERO);
|
||||||
p.setACL(prepareCellPermissions(usersAndGroups, Action.READ));
|
p.setACL(prepareCellPermissions(usersAndGroups, Action.READ));
|
||||||
t.put(p);
|
t.put(p);
|
||||||
// with rw ACL
|
// with rw ACL
|
||||||
p = new Put(TEST_ROW).add(TEST_FAMILY, TEST_Q2, ZERO);
|
p = new Put(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q2, ZERO);
|
||||||
p.setACL(prepareCellPermissions(usersAndGroups, Action.READ, Action.WRITE));
|
p.setACL(prepareCellPermissions(usersAndGroups, Action.READ, Action.WRITE));
|
||||||
t.put(p);
|
t.put(p);
|
||||||
// no ACL
|
// no ACL
|
||||||
p = new Put(TEST_ROW)
|
p = new Put(TEST_ROW)
|
||||||
.add(TEST_FAMILY, TEST_Q3, ZERO)
|
.addColumn(TEST_FAMILY, TEST_Q3, ZERO)
|
||||||
.add(TEST_FAMILY, TEST_Q4, ZERO);
|
.addColumn(TEST_FAMILY, TEST_Q4, ZERO);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -376,7 +380,7 @@ public class TestCellACLs extends SecureTestUtil {
|
||||||
* Insure we are not granting access in the absence of any cells found
|
* Insure we are not granting access in the absence of any cells found
|
||||||
* when scanning for covered cells.
|
* when scanning for covered cells.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test (timeout=120000)
|
||||||
public void testCoveringCheck() throws Exception {
|
public void testCoveringCheck() throws Exception {
|
||||||
// Grant read access to USER_OTHER
|
// Grant read access to USER_OTHER
|
||||||
grantOnTable(TEST_UTIL, USER_OTHER.getShortName(), TEST_TABLE.getTableName(), TEST_FAMILY,
|
grantOnTable(TEST_UTIL, USER_OTHER.getShortName(), TEST_TABLE.getTableName(), TEST_FAMILY,
|
||||||
|
@ -399,7 +403,7 @@ public class TestCellACLs extends SecureTestUtil {
|
||||||
try(Connection connection = ConnectionFactory.createConnection(conf);
|
try(Connection connection = ConnectionFactory.createConnection(conf);
|
||||||
Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Put p;
|
Put p;
|
||||||
p = new Put(TEST_ROW).add(TEST_FAMILY, TEST_Q1, ZERO);
|
p = new Put(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q1, ZERO);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -462,5 +466,6 @@ public class TestCellACLs extends SecureTestUtil {
|
||||||
LOG.info("Test deleted table " + TEST_TABLE.getTableName());
|
LOG.info("Test deleted table " + TEST_TABLE.getTableName());
|
||||||
}
|
}
|
||||||
assertEquals(0, AccessControlLists.getTablePermissions(conf, TEST_TABLE.getTableName()).size());
|
assertEquals(0, AccessControlLists.getTablePermissions(conf, TEST_TABLE.getTableName()).size());
|
||||||
|
this.connection.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue