Skip to content

Commit

Permalink
Merge branch 'main' into lucene_snapshot_10_1
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHegarty authored Dec 30, 2024
2 parents 9ad8470 + d7fa740 commit 8383529
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
6 changes: 6 additions & 0 deletions x-pack/plugin/esql/qa/security/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ apply plugin: 'elasticsearch.internal-test-artifact'
tasks.named('javaRestTest') {
usesDefaultDistribution()
}

dependencies {
javaRestTestImplementation project(xpackModule('esql-core'))
javaRestTestImplementation project(xpackModule('esql'))
javaRestTestImplementation project(xpackModule('esql:qa:server'))
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.elasticsearch.test.rest.ESRestTestCase;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.json.JsonXContent;
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
import org.elasticsearch.xpack.esql.qa.rest.EsqlSpecTestCase;
import org.junit.Before;
import org.junit.ClassRule;

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

public void testLookupJoinIndexAllowed() throws Exception {
assumeTrue(
"Requires LOOKUP JOIN capability",
EsqlSpecTestCase.hasCapabilities(adminClient(), List.of(EsqlCapabilities.Cap.JOIN_LOOKUP_V9.capabilityName()))
);

Response resp = runESQLCommand(
"metadata1_read2",
"ROW x = 40.0 | EVAL value = x | LOOKUP JOIN `lookup-user2` ON value | KEEP x, org"
Expand Down Expand Up @@ -577,7 +584,12 @@ public void testLookupJoinIndexAllowed() throws Exception {
assertThat(respMap.get("values"), equalTo(List.of(Arrays.asList(123.0, null))));
}

public void testLookupJoinIndexForbidden() {
public void testLookupJoinIndexForbidden() throws Exception {
assumeTrue(
"Requires LOOKUP JOIN capability",
EsqlSpecTestCase.hasCapabilities(adminClient(), List.of(EsqlCapabilities.Cap.JOIN_LOOKUP_V9.capabilityName()))
);

var resp = expectThrows(
ResponseException.class,
() -> runESQLCommand("metadata1_read2", "FROM lookup-user2 | EVAL value = 10.0 | LOOKUP JOIN `lookup-user1` ON value | KEEP x")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ protected static boolean hasCapabilities(List<String> requiredCapabilities) thro
return hasCapabilities(adminClient(), requiredCapabilities);
}

protected static boolean hasCapabilities(RestClient client, List<String> requiredCapabilities) throws IOException {
public static boolean hasCapabilities(RestClient client, List<String> requiredCapabilities) throws IOException {
if (requiredCapabilities.isEmpty()) {
return true;
}
Expand Down

0 comments on commit 8383529

Please sign in to comment.