[TEST] Fix RemoteClusterConnectionTests
With PR 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.
@@ -84,6 +84,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;
@@ -861,7 +862,13 @@ public class RemoteClusterConnectionTests extends ESTestCase {
throw new AssertionError(x);
}
});
+ 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) {
