YARN-31. Fix TestDelegationTokenRenewer to not depend on test order so as to pass tests on jdk7. Contributed by Thomas Graves.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1377961 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2012-08-28 03:31:11 +00:00
parent cfe25b8828
commit 7fff7b42bf
2 changed files with 11 additions and 1 deletions

View File

@ -67,3 +67,6 @@ Release 0.23.3 - Unreleased
YARN-39. RM-NM secret-keys should be randomly generated and rolled every
so often. (vinodkv and sseth via sseth)
YARN-31. Fix TestDelegationTokenRenewer to not depend on test order so as to
pass tests on jdk7. (Thomas Graves via vinodkv)

View File

@ -66,6 +66,12 @@ public class TestDelegationTokenRenewer {
private static Token<?> lastRenewed = null;
private static Token<?> tokenToRenewIn2Sec = null;
private static void reset() {
counter = 0;
lastRenewed = null;
tokenToRenewIn2Sec = null;
}
@Override
public boolean handleKind(Text kind) {
return KIND.equals(kind);
@ -124,6 +130,7 @@ public class TestDelegationTokenRenewer {
@Before
public void setUp() throws Exception {
Renewer.reset();
delegationTokenRenewer = new DelegationTokenRenewer();
delegationTokenRenewer.init(conf);
delegationTokenRenewer.start();
@ -367,7 +374,7 @@ public class TestDelegationTokenRenewer {
Credentials ts = new Credentials();
MyToken token1 = dfs.getDelegationToken(new Text("user1"));
//to cause this one to be set for renew in 2 secs
Renewer.tokenToRenewIn2Sec = token1;
LOG.info("token="+token1+" should be renewed for 2 secs");