Skip to content

Commit 99364d7

Browse files
Fix UT errors
1 parent 5b852f0 commit 99364d7

File tree

1 file changed

+16
-0
lines changed
  • x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq

1 file changed

+16
-0
lines changed

x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClustersIT.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,14 @@ public void testLikeIndex() throws Exception {
430430
}
431431

432432
public void testLikeIndexLegacySettingNoResults() throws Exception {
433+
boolean isSupported = clusterHasCapability("POST", "/_query", List.of(), List.of("like_on_index_fields")).orElse(false);
434+
if (isSupported == false) {
435+
// we require that the admin client supports the like_on_index_fields capability
436+
// otherwise we will get an error when trying to toggle the setting
437+
// the remote client does not have to support it
438+
logger.info("--> skipping testLikeIndexLegacySettingNoResults, due to missing capability");
439+
return;
440+
}
433441
try (ClusterSettingToggle ignored = new ClusterSettingToggle(adminClient(), "esql.query.string_like_on_index", false, true)) {
434442
// test code with the setting changed
435443
boolean includeCCSMetadata = includeCCSMetadata();
@@ -447,6 +455,14 @@ public void testLikeIndexLegacySettingNoResults() throws Exception {
447455
}
448456

449457
public void testLikeIndexLegacySettingResults() throws Exception {
458+
boolean isSupported = clusterHasCapability("POST", "/_query", List.of(), List.of("like_on_index_fields")).orElse(false);
459+
if (isSupported == false) {
460+
// we require that the admin client supports the like_on_index_fields capability
461+
// otherwise we will get an error when trying to toggle the setting
462+
// the remote client does not have to support it
463+
logger.info("--> skipping testLikeIndexLegacySettingNoResults, due to missing capability");
464+
return;
465+
}
450466
try (ClusterSettingToggle ignored = new ClusterSettingToggle(adminClient(), "esql.query.string_like_on_index", false, true)) {
451467
boolean includeCCSMetadata = includeCCSMetadata();
452468
Map<String, Object> result = run("""

0 commit comments

Comments
 (0)