Skip to content

Commit d7fa740

Browse files
authored
ESQL: Fix EsqlSecurityIT LOOKUP tests not checking snapshot (#119283)
Without the snapshot check, the periodic tests were failing. Fixes #119268 Fixes #119269 Fixes #119270 Fixes #119271
1 parent dee3c6e commit d7fa740

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

x-pack/plugin/esql/qa/security/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ apply plugin: 'elasticsearch.internal-test-artifact'
55
tasks.named('javaRestTest') {
66
usesDefaultDistribution()
77
}
8+
9+
dependencies {
10+
javaRestTestImplementation project(xpackModule('esql-core'))
11+
javaRestTestImplementation project(xpackModule('esql'))
12+
javaRestTestImplementation project(xpackModule('esql:qa:server'))
13+
}

x-pack/plugin/esql/qa/security/src/javaRestTest/java/org/elasticsearch/xpack/esql/EsqlSecurityIT.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import org.elasticsearch.test.rest.ESRestTestCase;
2727
import org.elasticsearch.xcontent.XContentBuilder;
2828
import org.elasticsearch.xcontent.json.JsonXContent;
29+
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
30+
import org.elasticsearch.xpack.esql.qa.rest.EsqlSpecTestCase;
2931
import org.junit.Before;
3032
import org.junit.ClassRule;
3133

@@ -544,6 +546,11 @@ record Listen(long timestamp, String songId, double duration) {
544546
}
545547

546548
public void testLookupJoinIndexAllowed() throws Exception {
549+
assumeTrue(
550+
"Requires LOOKUP JOIN capability",
551+
EsqlSpecTestCase.hasCapabilities(adminClient(), List.of(EsqlCapabilities.Cap.JOIN_LOOKUP_V9.capabilityName()))
552+
);
553+
547554
Response resp = runESQLCommand(
548555
"metadata1_read2",
549556
"ROW x = 40.0 | EVAL value = x | LOOKUP JOIN `lookup-user2` ON value | KEEP x, org"
@@ -577,7 +584,12 @@ public void testLookupJoinIndexAllowed() throws Exception {
577584
assertThat(respMap.get("values"), equalTo(List.of(Arrays.asList(123.0, null))));
578585
}
579586

580-
public void testLookupJoinIndexForbidden() {
587+
public void testLookupJoinIndexForbidden() throws Exception {
588+
assumeTrue(
589+
"Requires LOOKUP JOIN capability",
590+
EsqlSpecTestCase.hasCapabilities(adminClient(), List.of(EsqlCapabilities.Cap.JOIN_LOOKUP_V9.capabilityName()))
591+
);
592+
581593
var resp = expectThrows(
582594
ResponseException.class,
583595
() -> runESQLCommand("metadata1_read2", "FROM lookup-user2 | EVAL value = 10.0 | LOOKUP JOIN `lookup-user1` ON value | KEEP x")

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/EsqlSpecTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ protected static boolean hasCapabilities(List<String> requiredCapabilities) thro
199199
return hasCapabilities(adminClient(), requiredCapabilities);
200200
}
201201

202-
protected static boolean hasCapabilities(RestClient client, List<String> requiredCapabilities) throws IOException {
202+
public static boolean hasCapabilities(RestClient client, List<String> requiredCapabilities) throws IOException {
203203
if (requiredCapabilities.isEmpty()) {
204204
return true;
205205
}

0 commit comments

Comments
 (0)