Skip to content

Commit cbc39aa

Browse files
authored
Fix CrossClusterEsqlRCSEnrichUnavailableRemotesIT failing tests
Fixes #119910 (#119977)
1 parent 7a267ee commit cbc39aa

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

x-pack/plugin/security/qa/multi-cluster/src/javaRestTest/java/org/elasticsearch/xpack/remotecluster/CrossClusterEsqlRCS1EnrichUnavailableRemotesIT.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
import java.util.Map;
2525
import java.util.concurrent.atomic.AtomicBoolean;
2626

27+
import static org.hamcrest.Matchers.anyOf;
2728
import static org.hamcrest.Matchers.containsString;
2829
import static org.hamcrest.Matchers.endsWith;
2930
import static org.hamcrest.Matchers.equalTo;
3031
import static org.hamcrest.Matchers.greaterThan;
3132
import static org.hamcrest.Matchers.is;
33+
import static org.hamcrest.Matchers.oneOf;
3234

3335
public class CrossClusterEsqlRCS1EnrichUnavailableRemotesIT extends AbstractRemoteClusterSecurityTestCase {
3436
private static final AtomicBoolean SSL_ENABLED_REF = new AtomicBoolean();
@@ -185,8 +187,7 @@ private void esqlEnrichWithSkipUnavailableTrue() throws Exception {
185187
Map<String, ?> failuresMap = (Map<String, ?>) remoteClusterFailures.get(0);
186188

187189
Map<String, ?> reason = (Map<String, ?>) failuresMap.get("reason");
188-
assertThat(reason.get("type").toString(), equalTo("connect_transport_exception"));
189-
assertThat(reason.get("reason").toString(), containsString("Unable to connect to [my_remote_cluster]"));
190+
assertThat(reason.get("type").toString(), oneOf("node_disconnected_exception", "connect_transport_exception"));
190191
} finally {
191192
fulfillingCluster.start();
192193
closeFulfillingClusterClient();
@@ -202,7 +203,11 @@ private void esqlEnrichWithSkipUnavailableFalse() throws Exception {
202203

203204
String query = "FROM to-be-enr*,my_remote_cluster:to-be-enr* | ENRICH " + randomFrom(modes) + ":employees-policy | LIMIT 10";
204205
ResponseException ex = expectThrows(ResponseException.class, () -> client().performRequest(esqlRequest(query)));
205-
assertThat(ex.getMessage(), containsString("connect_transport_exception"));
206+
207+
assertThat(
208+
ex.getMessage(),
209+
anyOf(containsString("connect_transport_exception"), containsString("node_disconnected_exception"))
210+
);
206211
} finally {
207212
fulfillingCluster.start();
208213
closeFulfillingClusterClient();

x-pack/plugin/security/qa/multi-cluster/src/javaRestTest/java/org/elasticsearch/xpack/remotecluster/CrossClusterEsqlRCS2EnrichUnavailableRemotesIT.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
import java.util.Map;
2727
import java.util.concurrent.atomic.AtomicReference;
2828

29+
import static org.hamcrest.Matchers.anyOf;
2930
import static org.hamcrest.Matchers.containsString;
3031
import static org.hamcrest.Matchers.endsWith;
3132
import static org.hamcrest.Matchers.equalTo;
3233
import static org.hamcrest.Matchers.greaterThan;
3334
import static org.hamcrest.Matchers.is;
35+
import static org.hamcrest.Matchers.oneOf;
3436

3537
public class CrossClusterEsqlRCS2EnrichUnavailableRemotesIT extends AbstractRemoteClusterSecurityTestCase {
3638
private static final AtomicReference<Map<String, Object>> API_KEY_MAP_REF = new AtomicReference<>();
@@ -205,8 +207,7 @@ private void esqlEnrichWithSkipUnavailableTrue() throws Exception {
205207
Map<String, ?> failuresMap = (Map<String, ?>) remoteClusterFailures.get(0);
206208

207209
Map<String, ?> reason = (Map<String, ?>) failuresMap.get("reason");
208-
assertThat(reason.get("type").toString(), equalTo("connect_transport_exception"));
209-
assertThat(reason.get("reason").toString(), containsString("Unable to connect to [my_remote_cluster]"));
210+
assertThat(reason.get("type").toString(), oneOf("node_disconnected_exception", "connect_transport_exception"));
210211
} finally {
211212
fulfillingCluster.start();
212213
closeFulfillingClusterClient();
@@ -222,7 +223,10 @@ private void esqlEnrichWithSkipUnavailableFalse() throws Exception {
222223

223224
String query = "FROM to-be-enr*,my_remote_cluster:to-be-enr* | ENRICH " + randomFrom(modes) + ":employees-policy | LIMIT 10";
224225
ResponseException ex = expectThrows(ResponseException.class, () -> performRequestWithRemoteSearchUser(esqlRequest(query)));
225-
assertThat(ex.getMessage(), containsString("connect_transport_exception"));
226+
assertThat(
227+
ex.getMessage(),
228+
anyOf(containsString("connect_transport_exception"), containsString("node_disconnected_exception"))
229+
);
226230
} finally {
227231
fulfillingCluster.start();
228232
closeFulfillingClusterClient();

0 commit comments

Comments
 (0)