mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-20 03:45:02 +00:00
[TEST] address testCollectNodes rare failure (#38559)
#37767 changed the expected exception for "no such cluster" error from `IllegalStateException` to a dedicated `NoSuchRemoteClusterException`. An assertion in `testCollectNodes` needs to be updated accordingly.
This commit is contained in:
parent
8e5e48319e
commit
7456117019
@ -58,12 +58,12 @@ import java.util.function.Supplier;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.containsString;
|
import static org.hamcrest.CoreMatchers.containsString;
|
||||||
import static org.hamcrest.Matchers.anyOf;
|
|
||||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||||
|
import static org.hamcrest.Matchers.either;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.hasSize;
|
import static org.hamcrest.Matchers.hasSize;
|
||||||
import static org.hamcrest.Matchers.hasToString;
|
import static org.hamcrest.Matchers.hasToString;
|
||||||
import static org.hamcrest.Matchers.startsWith;
|
import static org.hamcrest.Matchers.instanceOf;
|
||||||
|
|
||||||
public class RemoteClusterServiceTests extends ESTestCase {
|
public class RemoteClusterServiceTests extends ESTestCase {
|
||||||
|
|
||||||
@ -690,15 +690,10 @@ public class RemoteClusterServiceTests extends ESTestCase {
|
|||||||
failLatch.await();
|
failLatch.await();
|
||||||
assertNotNull(ex.get());
|
assertNotNull(ex.get());
|
||||||
if (ex.get() instanceof IllegalStateException) {
|
if (ex.get() instanceof IllegalStateException) {
|
||||||
assertThat(ex.get().getMessage(), anyOf(equalTo("no seed node left"), startsWith
|
assertThat(ex.get().getMessage(), equalTo("no seed node left"));
|
||||||
("No node available for cluster:")));
|
|
||||||
} else {
|
} else {
|
||||||
if (ex.get() instanceof TransportException == false) {
|
assertThat(ex.get(),
|
||||||
// we have an issue for this see #25301
|
either(instanceOf(TransportException.class)).or(instanceOf(NoSuchRemoteClusterException.class)));
|
||||||
logger.error("expected TransportException but got a different one see #25301", ex.get());
|
|
||||||
}
|
|
||||||
assertTrue("expected TransportException but got a different one [" + ex.get().getClass().toString() + "]",
|
|
||||||
ex.get() instanceof TransportException);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user