YARN-8840. Add missing cleanupSSLConfig() call for TestTimelineClient test. Contributed by Aki Tanaka.
(cherry picked from commit 39b35036ba
)
This commit is contained in:
parent
1505058440
commit
65aaa10173
|
@ -25,7 +25,6 @@ import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
|
@ -62,6 +61,8 @@ public class TestTimelineClient {
|
||||||
|
|
||||||
private TimelineClientImpl client;
|
private TimelineClientImpl client;
|
||||||
private TimelineWriter spyTimelineWriter;
|
private TimelineWriter spyTimelineWriter;
|
||||||
|
private String keystoresDir;
|
||||||
|
private String sslConfDir;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
|
@ -72,10 +73,13 @@ public class TestTimelineClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() {
|
public void tearDown() throws Exception {
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
client.stop();
|
client.stop();
|
||||||
}
|
}
|
||||||
|
if (isSSLConfigured()) {
|
||||||
|
KeyStoreTestUtil.cleanupSSLConfig(keystoresDir, sslConfDir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -453,11 +457,7 @@ public class TestTimelineClient {
|
||||||
conf.setInt(YarnConfiguration.TIMELINE_SERVICE_CLIENT_MAX_RETRIES, 0);
|
conf.setInt(YarnConfiguration.TIMELINE_SERVICE_CLIENT_MAX_RETRIES, 0);
|
||||||
conf.set(YarnConfiguration.YARN_HTTP_POLICY_KEY, Policy.HTTPS_ONLY.name());
|
conf.set(YarnConfiguration.YARN_HTTP_POLICY_KEY, Policy.HTTPS_ONLY.name());
|
||||||
|
|
||||||
File testDir = TestGenericTestUtils.getTestDir();
|
setupSSLConfig(conf);
|
||||||
String sslConfDir =
|
|
||||||
KeyStoreTestUtil.getClasspathDir(TestTimelineClient.class);
|
|
||||||
KeyStoreTestUtil.setupSSLConfig(testDir.getAbsolutePath(),
|
|
||||||
sslConfDir, conf, false);
|
|
||||||
client = createTimelineClient(conf);
|
client = createTimelineClient(conf);
|
||||||
|
|
||||||
ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
|
ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
|
||||||
|
@ -491,6 +491,17 @@ public class TestTimelineClient {
|
||||||
Assert.assertFalse("Reloader is still alive", reloaderStillAlive);
|
Assert.assertFalse("Reloader is still alive", reloaderStillAlive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupSSLConfig(YarnConfiguration conf) throws Exception {
|
||||||
|
keystoresDir = TestGenericTestUtils.getTestDir().getAbsolutePath();
|
||||||
|
sslConfDir =
|
||||||
|
KeyStoreTestUtil.getClasspathDir(TestTimelineClient.class);
|
||||||
|
KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isSSLConfigured() {
|
||||||
|
return keystoresDir != null && sslConfDir != null;
|
||||||
|
}
|
||||||
|
|
||||||
private static class TestTimelineDelegationTokenSecretManager extends
|
private static class TestTimelineDelegationTokenSecretManager extends
|
||||||
AbstractDelegationTokenSecretManager<TimelineDelegationTokenIdentifier> {
|
AbstractDelegationTokenSecretManager<TimelineDelegationTokenIdentifier> {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue