From 9d076364d7e94e1e568b018a060069cd05ae1488 Mon Sep 17 00:00:00 2001 From: Tim Brooks Date: Wed, 6 May 2020 17:38:31 -0600 Subject: [PATCH] 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. --- .../elasticsearch/transport/RemoteClusterServiceTests.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/transport/RemoteClusterServiceTests.java b/server/src/test/java/org/elasticsearch/transport/RemoteClusterServiceTests.java index 9da5e612966..3c258f91edc 100644 --- a/server/src/test/java/org/elasticsearch/transport/RemoteClusterServiceTests.java +++ b/server/src/test/java/org/elasticsearch/transport/RemoteClusterServiceTests.java @@ -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)));