Skip to content

Commit

Permalink
HBASE-27279 Addendum fix TestSaslTlsIPCRejectPlainText
Browse files Browse the repository at this point in the history
  • Loading branch information
Apache9 committed Aug 16, 2022
1 parent 4a57cbd commit 116458a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

public abstract class AbstractTestTlsRejectPlainText {

protected static final HBaseCommonTestingUtil UTIL = new HBaseCommonTestingUtil();
protected static HBaseCommonTestingUtil UTIL;

protected static File DIR;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.io.IOException;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseCommonTestingUtil;
import org.apache.hadoop.hbase.ipc.TestProtobufRpcServiceImpl;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.RPCTests;
Expand All @@ -41,6 +42,7 @@ public class TestNettyTlsIPCRejectPlainText extends AbstractTestTlsRejectPlainTe

@BeforeClass
public static void setUpBeforeClass() throws IOException {
UTIL = new HBaseCommonTestingUtil();
initialize();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ public class TestSaslTlsIPCRejectPlainText extends AbstractTestTlsRejectPlainTex
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestSaslTlsIPCRejectPlainText.class);

private static final HBaseTestingUtil UTIL = new HBaseTestingUtil();

private static final File KEYTAB_FILE = new File(UTIL.getDataTestDir("keytab").toUri().getPath());
private static File KEYTAB_FILE;

private static MiniKdc KDC;
private static String HOST = "localhost";
Expand All @@ -57,13 +55,16 @@ public class TestSaslTlsIPCRejectPlainText extends AbstractTestTlsRejectPlainTex

@BeforeClass
public static void setUpBeforeClass() throws Exception {
HBaseTestingUtil util = new HBaseTestingUtil();
UTIL = util;
initialize();
KDC = UTIL.setupMiniKdc(KEYTAB_FILE);
KEYTAB_FILE = new File(util.getDataTestDir("keytab").toUri().getPath());
KDC = util.setupMiniKdc(KEYTAB_FILE);
PRINCIPAL = "hbase/" + HOST;
KDC.createPrincipal(KEYTAB_FILE, PRINCIPAL);
HBaseKerberosUtils.setPrincipalForTesting(PRINCIPAL + "@" + KDC.getRealm());
UGI = loginKerberosPrincipal(KEYTAB_FILE.getCanonicalPath(), PRINCIPAL);
setSecuredConfiguration(UTIL.getConfiguration());
setSecuredConfiguration(util.getConfiguration());
SecurityInfo securityInfoMock = Mockito.mock(SecurityInfo.class);
Mockito.when(securityInfoMock.getServerPrincipal())
.thenReturn(HBaseKerberosUtils.KRB_PRINCIPAL);
Expand Down

0 comments on commit 116458a

Please sign in to comment.