[TEST] Fix RemoteClusterConnectionTests

With PR #31574 we now ensure that connections are established under the proper
thread context. There is a test in RemoteClusterConnectionTests, however,
that shuts down the service while connecting. With the above change, a new kind
of exception can occur that the test is unaware of.
This commit is contained in:
Yannick Welsch 2018-06-27 18:43:49 +02:00
parent 61eefc84f3
commit 7520025d7d
1 changed files with 8 additions and 1 deletions

View File

@ -77,6 +77,7 @@ import java.util.function.Function;
import static java.util.Collections.emptyMap;
import static java.util.Collections.emptySet;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.iterableWithSize;
@ -854,7 +855,13 @@ public class RemoteClusterConnectionTests extends ESTestCase {
throw new AssertionError(x);
}
});
connection.updateSeedNodes(seedNodes, listener);
try {
connection.updateSeedNodes(seedNodes, listener);
} catch (Exception e) {
// it's ok if we're shutting down
assertThat(e.getMessage(), containsString("threadcontext is already closed"));
latch.countDown();
}
}
latch.await();
} catch (Exception ex) {