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

View File

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