Skip to content

Commit

Permalink
Fix CrossClusterEsqlRCSEnrichUnavailableRemotesIT failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
quux00 committed Jan 13, 2025
1 parent 1f572ad commit 2e31f8e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;

import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.oneOf;

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

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

String query = "FROM to-be-enr*,my_remote_cluster:to-be-enr* | ENRICH " + randomFrom(modes) + ":employees-policy | LIMIT 10";
ResponseException ex = expectThrows(ResponseException.class, () -> client().performRequest(esqlRequest(query)));
assertThat(ex.getMessage(), containsString("connect_transport_exception"));

assertThat(
ex.getMessage(),
anyOf(containsString("connect_transport_exception"), containsString("node_disconnected_exception"))
);
} finally {
fulfillingCluster.start();
closeFulfillingClusterClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;

import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.oneOf;

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

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

String query = "FROM to-be-enr*,my_remote_cluster:to-be-enr* | ENRICH " + randomFrom(modes) + ":employees-policy | LIMIT 10";
ResponseException ex = expectThrows(ResponseException.class, () -> performRequestWithRemoteSearchUser(esqlRequest(query)));
assertThat(ex.getMessage(), containsString("connect_transport_exception"));
assertThat(
ex.getMessage(),
anyOf(containsString("connect_transport_exception"), containsString("node_disconnected_exception"))
);
} finally {
fulfillingCluster.start();
closeFulfillingClusterClient();
Expand Down

0 comments on commit 2e31f8e

Please sign in to comment.