HDDS-1156. testDelegationToken is failing in TestSecureOzoneCluster. Contributed by Ajay Kumar.

This commit is contained in:
Ajay Yadav 2019-03-05 08:37:10 -08:00 committed by Xiaoyu Yao
parent 2576401928
commit 353b90d59e
2 changed files with 5 additions and 10 deletions

View File

@ -27,7 +27,6 @@
import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.TOKEN_EXPIRED; import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.TOKEN_EXPIRED;
import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.VOLUME_NOT_FOUND; import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.VOLUME_NOT_FOUND;
import static org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod.KERBEROS; import static org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod.KERBEROS;
import org.junit.Ignore;
import static org.slf4j.event.Level.INFO; import static org.slf4j.event.Level.INFO;
import java.io.File; import java.io.File;
@ -418,7 +417,6 @@ public void testSecureOmInitializationSuccess() throws Exception {
* @throws Exception * @throws Exception
*/ */
@Test @Test
@Ignore("TODO:HDDS-1156")
public void testDelegationToken() throws Exception { public void testDelegationToken() throws Exception {
// Capture logs for assertions // Capture logs for assertions
@ -496,8 +494,7 @@ public Void run() throws Exception {
// initial connection via DT succeeded // initial connection via DT succeeded
omLogs.clearOutput(); omLogs.clearOutput();
LambdaTestUtils.intercept(OMException.class, "Renew delegation token " + LambdaTestUtils.intercept(OMException.class, "INVALID_AUTH_METHOD",
"failed",
() -> { () -> {
try { try {
omClient.renewDelegationToken(token); omClient.renewDelegationToken(token);
@ -565,7 +562,6 @@ private void generateKeyPair(OzoneConfiguration config) throws Exception {
* @throws Exception * @throws Exception
*/ */
@Test @Test
@Ignore("TODO:HDDS-1156")
public void testDelegationTokenRenewal() throws Exception { public void testDelegationTokenRenewal() throws Exception {
GenericTestUtils GenericTestUtils
.setLogLevel(LoggerFactory.getLogger(Server.class.getName()), INFO); .setLogLevel(LoggerFactory.getLogger(Server.class.getName()), INFO);
@ -610,7 +606,7 @@ public void testDelegationTokenRenewal() throws Exception {
// 1. When token maxExpiryTime exceeds // 1. When token maxExpiryTime exceeds
Thread.sleep(500); Thread.sleep(500);
LambdaTestUtils.intercept(OMException.class, LambdaTestUtils.intercept(OMException.class,
"Renew delegation token failed", "TOKEN_EXPIRED",
() -> { () -> {
try { try {
omClient.renewDelegationToken(token); omClient.renewDelegationToken(token);
@ -626,7 +622,7 @@ public void testDelegationTokenRenewal() throws Exception {
// null or empty ) // null or empty )
Token token2 = omClient.getDelegationToken(new Text("randomService")); Token token2 = omClient.getDelegationToken(new Text("randomService"));
LambdaTestUtils.intercept(OMException.class, LambdaTestUtils.intercept(OMException.class,
"Renew delegation token failed", "Delegation token renewal failed",
() -> omClient.renewDelegationToken(token2)); () -> omClient.renewDelegationToken(token2));
Assert.assertTrue(omLogs.getOutput().contains(" with non-matching " + Assert.assertTrue(omLogs.getOutput().contains(" with non-matching " +
"renewer randomService")); "renewer randomService"));
@ -641,7 +637,7 @@ public void testDelegationTokenRenewal() throws Exception {
tokenId.getBytes(), token2.getPassword(), token2.getKind(), tokenId.getBytes(), token2.getPassword(), token2.getKind(),
token2.getService()); token2.getService());
LambdaTestUtils.intercept(OMException.class, LambdaTestUtils.intercept(OMException.class,
"Renew delegation token failed", "Delegation token renewal failed",
() -> omClient.renewDelegationToken(tamperedToken)); () -> omClient.renewDelegationToken(tamperedToken));
Assert.assertTrue(omLogs.getOutput().contains("can't be found in " + Assert.assertTrue(omLogs.getOutput().contains("can't be found in " +
"cache")); "cache"));

View File

@ -1130,8 +1130,7 @@ public void start() throws IOException {
DefaultMetricsSystem.initialize("OzoneManager"); DefaultMetricsSystem.initialize("OzoneManager");
metadataManager.start(configuration); metadataManager.start(configuration);
// TODO: uncomment this with HDDS-134 to avoid NPE startSecretManagerIfNecessary();
//startSecretManagerIfNecessary();
// Set metrics and start metrics back ground thread // Set metrics and start metrics back ground thread
metrics.setNumVolumes(metadataManager.countRowsInTable(metadataManager metrics.setNumVolumes(metadataManager.countRowsInTable(metadataManager