YARN-10155. TestDelegationTokenRenewer.testTokenThreadTimeout fails in trunk. Contributed by Manikandan R.

This commit is contained in:
Inigo Goiri 2020-02-27 12:53:20 -08:00
parent 10461e0193
commit b420ddeada
1 changed files with 10 additions and 4 deletions

View File

@ -220,6 +220,7 @@ public void setUp() throws Exception {
UserGroupInformation.setConfiguration(conf); UserGroupInformation.setConfiguration(conf);
eventQueue = new LinkedBlockingQueue<Event>(); eventQueue = new LinkedBlockingQueue<Event>();
dispatcher = new AsyncDispatcher(eventQueue); dispatcher = new AsyncDispatcher(eventQueue);
dispatcher.init(conf);
Renewer.reset(); Renewer.reset();
delegationTokenRenewer = createNewDelegationTokenRenewer(conf, counter); delegationTokenRenewer = createNewDelegationTokenRenewer(conf, counter);
RMContext mockContext = mock(RMContext.class); RMContext mockContext = mock(RMContext.class);
@ -241,6 +242,11 @@ public void setUp() throws Exception {
@After @After
public void tearDown() { public void tearDown() {
try {
dispatcher.close();
} catch (IOException e) {
LOG.debug("Unable to close the dispatcher. " + e);
}
delegationTokenRenewer.stop(); delegationTokenRenewer.stop();
} }
@ -1711,10 +1717,10 @@ public void testTokenThreadTimeoutWithoutDelay() throws Exception {
"kerberos"); "kerberos");
yarnConf.set(YarnConfiguration.RM_STORE, yarnConf.set(YarnConfiguration.RM_STORE,
MemoryRMStateStore.class.getName()); MemoryRMStateStore.class.getName());
yarnConf.setTimeDuration(YarnConfiguration.RM_DT_RENEWER_THREAD_TIMEOUT, 5, yarnConf.setTimeDuration(YarnConfiguration.RM_DT_RENEWER_THREAD_TIMEOUT, 3,
TimeUnit.SECONDS); TimeUnit.SECONDS);
yarnConf.setTimeDuration( yarnConf.setTimeDuration(
YarnConfiguration.RM_DT_RENEWER_THREAD_RETRY_INTERVAL, 5, YarnConfiguration.RM_DT_RENEWER_THREAD_RETRY_INTERVAL, 3,
TimeUnit.SECONDS); TimeUnit.SECONDS);
yarnConf.setInt(YarnConfiguration.RM_DT_RENEWER_THREAD_RETRY_MAX_ATTEMPTS, yarnConf.setInt(YarnConfiguration.RM_DT_RENEWER_THREAD_RETRY_MAX_ATTEMPTS,
3); 3);
@ -1786,11 +1792,11 @@ protected void renewToken(final DelegationTokenToRenew dttr)
throws IOException { throws IOException {
try { try {
if (renewDelay.get()) { if (renewDelay.get()) {
// Delay for 4 times than the configured timeout // Delay for 2 times than the configured timeout
Thread.sleep(config.getTimeDuration( Thread.sleep(config.getTimeDuration(
YarnConfiguration.RM_DT_RENEWER_THREAD_TIMEOUT, YarnConfiguration.RM_DT_RENEWER_THREAD_TIMEOUT,
YarnConfiguration.DEFAULT_RM_DT_RENEWER_THREAD_TIMEOUT, YarnConfiguration.DEFAULT_RM_DT_RENEWER_THREAD_TIMEOUT,
TimeUnit.MILLISECONDS) * 4); TimeUnit.MILLISECONDS) * 2);
} }
super.renewToken(dttr); super.renewToken(dttr);
} catch (InterruptedException e) { } catch (InterruptedException e) {