瀏覽代碼

HADOOP-13813. TestDelegationTokenFetcher#testDelegationTokenWithoutRenewer is failing. Contributed by Mingliang Liu

Mingliang Liu 8 年之前
父節點
當前提交
fb3a5085e8

+ 4 - 3
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestDelegationTokenFetcher.java

@@ -133,15 +133,16 @@ public class TestDelegationTokenFetcher {
       Iterator<Token<?>> itr = creds.getAllTokens().iterator();
       Iterator<Token<?>> itr = creds.getAllTokens().iterator();
       // make sure we got back exactly the 1 token we expected
       // make sure we got back exactly the 1 token we expected
       assertTrue(itr.hasNext());
       assertTrue(itr.hasNext());
-      assertNotNull("Token without renewer shouldn't be null", itr.next());
+      final Token token = itr.next();
+      assertNotNull("Token without renewer shouldn't be null", token);
       assertTrue(!itr.hasNext());
       assertTrue(!itr.hasNext());
       try {
       try {
         // Without renewer renewal of token should fail.
         // Without renewer renewal of token should fail.
         DelegationTokenFetcher.main(new String[] { "--renew", tokenFile });
         DelegationTokenFetcher.main(new String[] { "--renew", tokenFile });
         fail("Should have failed to renew");
         fail("Should have failed to renew");
       } catch (AccessControlException e) {
       } catch (AccessControlException e) {
-        GenericTestUtils.assertExceptionContains(
-            "tried to renew a token without a renewer", e);
+        GenericTestUtils.assertExceptionContains("tried to renew a token ("
+            + token.decodeIdentifier() + ") without a renewer", e);
       }
       }
     } finally {
     } finally {
       cluster.shutdown();
       cluster.shutdown();