[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:
parent
61eefc84f3
commit
7520025d7d
|
@ -77,6 +77,7 @@ import java.util.function.Function;
|
||||||
|
|
||||||
import static java.util.Collections.emptyMap;
|
import static java.util.Collections.emptyMap;
|
||||||
import static java.util.Collections.emptySet;
|
import static java.util.Collections.emptySet;
|
||||||
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.instanceOf;
|
import static org.hamcrest.Matchers.instanceOf;
|
||||||
import static org.hamcrest.Matchers.iterableWithSize;
|
import static org.hamcrest.Matchers.iterableWithSize;
|
||||||
|
@ -854,7 +855,13 @@ public class RemoteClusterConnectionTests extends ESTestCase {
|
||||||
throw new AssertionError(x);
|
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();
|
latch.await();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
Loading…
Reference in New Issue