shahrs87 commented on a change in pull request #3592:
URL: https://github.com/apache/hbase/pull/3592#discussion_r691218394
##########
File path:
hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableMapReduceUtil.java
##########
@@ -104,4 +130,147 @@ public void testInitTableMapperJob4() throws Exception {
assertNull(job.getCombinerClass());
assertEquals("Table",
job.getConfiguration().get(TableInputFormat.INPUT_TABLE));
}
+
+ private static void startSecureMiniCluster(HBaseTestingUtil util, MiniKdc
kdc, String principal)
+ throws Exception {
+ Configuration conf = util.getConfiguration();
+
+ SecureTestUtil.enableSecurity(conf);
+ VisibilityTestUtil.enableVisiblityLabels(conf);
+ SecureTestUtil.verifyConfiguration(conf);
+
+ conf.set(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY,
+ AccessController.class.getName() + ',' + TokenProvider.class.getName());
+
+ HBaseKerberosUtils.setSecuredConfiguration(conf,
+ principal + '@' + kdc.getRealm(), HTTP_PRINCIPAL + '@' + kdc.getRealm());
+
+ util.startMiniCluster();
+ util.waitUntilAllRegionsAssigned(PermissionStorage.ACL_TABLE_NAME);
+ }
+
+ @Test
+ public void testInitCredentialsForCluster1() throws Exception {
+ HBaseTestingUtil util1 = new HBaseTestingUtil();
+ HBaseTestingUtil util2 = new HBaseTestingUtil();
+
+ util1.startMiniCluster();
+ util2.startMiniCluster();
+
+ Configuration conf1 = util1.getConfiguration();
+ Job job = Job.getInstance(conf1);
+
+ TableMapReduceUtil.initCredentialsForCluster(job,
util2.getConfiguration());
+
+ Credentials credentials = job.getCredentials();
+ Collection<Token<? extends TokenIdentifier>> tokens =
credentials.getAllTokens();
+ assertTrue(tokens.isEmpty());
+
+ util1.shutdownMiniCluster();
Review comment:
move shutdownminicluster to finally block
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]