Fix testCollectNodes test assertion (#56294)

Currently when a connection closes a new sniff round begins. The
testCollectNodes test closes four transports before triggering the
method to collect the remote nodes. This leads to a race where there are
a number of reasons the collect nodes call might fail. This commit fixes
that issue by changing the test assertion to include a potential failure
condition.

Fixes #55292.
This commit is contained in:
Tim Brooks 2020-05-06 17:38:31 -06:00
parent ca9bec7c1a
commit 9d076364d7
No known key found for this signature in database
GPG Key ID: C2AA3BB91A889E77
1 changed files with 3 additions and 2 deletions

View File

@ -657,8 +657,9 @@ public class RemoteClusterServiceTests extends ESTestCase {
});
failLatch.await();
assertNotNull(ex.get());
if (ex.get() instanceof IllegalStateException) {
assertThat(ex.get().getMessage(), equalTo("no seed node left"));
if (ex.get() instanceof IllegalStateException) {
assertThat(ex.get().getMessage(), either(equalTo("no seed node left"))
.or(equalTo("Unable to open any connections to remote cluster [cluster_2]")));
} else {
assertThat(ex.get(),
either(instanceOf(TransportException.class)).or(instanceOf(NoSuchRemoteClusterException.class)));