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

(cherry picked from commit fb3a5085e8)
This commit is contained in:
Mingliang Liu 2016-11-11 22:06:43 -08:00
parent fcedb6812b
commit 4bcef1c616
1 changed files with 4 additions and 3 deletions

View File

@ -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( GenericTestUtils.assertExceptionContains("tried to renew a token ("
"tried to renew a token without a renewer", e); + token.decodeIdentifier() + ") without a renewer", e);
} }
} finally { } finally {
cluster.shutdown(); cluster.shutdown();