From 353b90d59e3583a73a76db550d47aa86b3f36d5d Mon Sep 17 00:00:00 2001 From: Ajay Yadav <7813154+ajayydv@users.noreply.github.com> Date: Tue, 5 Mar 2019 08:37:10 -0800 Subject: [PATCH] HDDS-1156. testDelegationToken is failing in TestSecureOzoneCluster. Contributed by Ajay Kumar. --- .../apache/hadoop/ozone/TestSecureOzoneCluster.java | 12 ++++-------- .../org/apache/hadoop/ozone/om/OzoneManager.java | 3 +-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestSecureOzoneCluster.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestSecureOzoneCluster.java index f790b30e06..c4deeba958 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestSecureOzoneCluster.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestSecureOzoneCluster.java @@ -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.VOLUME_NOT_FOUND; import static org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod.KERBEROS; -import org.junit.Ignore; import static org.slf4j.event.Level.INFO; import java.io.File; @@ -418,7 +417,6 @@ public void testSecureOmInitializationSuccess() throws Exception { * @throws Exception */ @Test - @Ignore("TODO:HDDS-1156") public void testDelegationToken() throws Exception { // Capture logs for assertions @@ -496,8 +494,7 @@ public Void run() throws Exception { // initial connection via DT succeeded omLogs.clearOutput(); - LambdaTestUtils.intercept(OMException.class, "Renew delegation token " + - "failed", + LambdaTestUtils.intercept(OMException.class, "INVALID_AUTH_METHOD", () -> { try { omClient.renewDelegationToken(token); @@ -565,7 +562,6 @@ private void generateKeyPair(OzoneConfiguration config) throws Exception { * @throws Exception */ @Test - @Ignore("TODO:HDDS-1156") public void testDelegationTokenRenewal() throws Exception { GenericTestUtils .setLogLevel(LoggerFactory.getLogger(Server.class.getName()), INFO); @@ -610,7 +606,7 @@ public void testDelegationTokenRenewal() throws Exception { // 1. When token maxExpiryTime exceeds Thread.sleep(500); LambdaTestUtils.intercept(OMException.class, - "Renew delegation token failed", + "TOKEN_EXPIRED", () -> { try { omClient.renewDelegationToken(token); @@ -626,7 +622,7 @@ public void testDelegationTokenRenewal() throws Exception { // null or empty ) Token token2 = omClient.getDelegationToken(new Text("randomService")); LambdaTestUtils.intercept(OMException.class, - "Renew delegation token failed", + "Delegation token renewal failed", () -> omClient.renewDelegationToken(token2)); Assert.assertTrue(omLogs.getOutput().contains(" with non-matching " + "renewer randomService")); @@ -641,7 +637,7 @@ public void testDelegationTokenRenewal() throws Exception { tokenId.getBytes(), token2.getPassword(), token2.getKind(), token2.getService()); LambdaTestUtils.intercept(OMException.class, - "Renew delegation token failed", + "Delegation token renewal failed", () -> omClient.renewDelegationToken(tamperedToken)); Assert.assertTrue(omLogs.getOutput().contains("can't be found in " + "cache")); diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java index ff949358ba..17552368bb 100644 --- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java +++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java @@ -1130,8 +1130,7 @@ public void start() throws IOException { DefaultMetricsSystem.initialize("OzoneManager"); metadataManager.start(configuration); - // TODO: uncomment this with HDDS-134 to avoid NPE - //startSecretManagerIfNecessary(); + startSecretManagerIfNecessary(); // Set metrics and start metrics back ground thread metrics.setNumVolumes(metadataManager.countRowsInTable(metadataManager