Skip to content

Commit aa7c608

Browse files
authored
Merge branch 'main' into esql_danger_zone_2
2 parents 9a7613f + cf5d40f commit aa7c608

File tree

112 files changed

+4947
-1077
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+4947
-1077
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchTestBasePlugin.java

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.io.File;
3535
import java.util.List;
3636
import java.util.Map;
37+
import java.util.Set;
3738
import java.util.stream.Stream;
3839

3940
import javax.inject.Inject;
@@ -50,6 +51,8 @@ public abstract class ElasticsearchTestBasePlugin implements Plugin<Project> {
5051

5152
public static final String DUMP_OUTPUT_ON_FAILURE_PROP_NAME = "dumpOutputOnFailure";
5253

54+
public static final Set<String> TEST_TASKS_WITH_ENTITLEMENTS = Set.of("test", "internalClusterTest");
55+
5356
@Inject
5457
protected abstract ProviderFactory getProviderFactory();
5558

@@ -174,14 +177,23 @@ public void execute(Task t) {
174177
nonInputProperties.systemProperty("workspace.dir", Util.locateElasticsearchWorkspace(project.getGradle()));
175178
// we use 'temp' relative to CWD since this is per JVM and tests are forbidden from writing to CWD
176179
nonInputProperties.systemProperty("java.io.tmpdir", test.getWorkingDir().toPath().resolve("temp"));
180+
if (test.getName().equals("internalClusterTest")) {
181+
// configure a node home directory independent of the Java temp dir so that entitlements can be properly enforced
182+
nonInputProperties.systemProperty("tempDir", test.getWorkingDir().toPath().resolve("nodesTemp"));
183+
}
177184

178185
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
179186
SourceSet mainSourceSet = sourceSets.findByName(SourceSet.MAIN_SOURCE_SET_NAME);
180187
SourceSet testSourceSet = sourceSets.findByName(SourceSet.TEST_SOURCE_SET_NAME);
181-
if ("test".equals(test.getName()) && mainSourceSet != null && testSourceSet != null) {
188+
SourceSet internalClusterTestSourceSet = sourceSets.findByName("internalClusterTest");
189+
190+
if (TEST_TASKS_WITH_ENTITLEMENTS.contains(test.getName()) && mainSourceSet != null && testSourceSet != null) {
182191
FileCollection mainRuntime = mainSourceSet.getRuntimeClasspath();
183192
FileCollection testRuntime = testSourceSet.getRuntimeClasspath();
184-
FileCollection testOnlyFiles = testRuntime.minus(mainRuntime);
193+
FileCollection internalClusterTestRuntime = ("internalClusterTest".equals(test.getName())
194+
&& internalClusterTestSourceSet != null) ? internalClusterTestSourceSet.getRuntimeClasspath() : project.files();
195+
FileCollection testOnlyFiles = testRuntime.plus(internalClusterTestRuntime).minus(mainRuntime);
196+
185197
test.doFirst(task -> test.environment("es.entitlement.testOnlyPath", testOnlyFiles.getAsPath()));
186198
}
187199

@@ -241,14 +253,15 @@ public void execute(Task t) {
241253
* Computes and sets the {@code --patch-module=java.base} and {@code --add-opens=java.base} JVM command line options.
242254
*/
243255
private void configureJavaBaseModuleOptions(Project project) {
244-
project.getTasks().withType(Test.class).matching(task -> task.getName().equals("test")).configureEach(test -> {
245-
FileCollection patchedImmutableCollections = patchedImmutableCollections(project);
256+
project.getTasks().withType(Test.class).configureEach(test -> {
257+
// patch immutable collections only for "test" task
258+
FileCollection patchedImmutableCollections = test.getName().equals("test") ? patchedImmutableCollections(project) : null;
246259
if (patchedImmutableCollections != null) {
247260
test.getInputs().files(patchedImmutableCollections);
248261
test.systemProperty("tests.hackImmutableCollections", "true");
249262
}
250263

251-
FileCollection entitlementBridge = entitlementBridge(project);
264+
FileCollection entitlementBridge = TEST_TASKS_WITH_ENTITLEMENTS.contains(test.getName()) ? entitlementBridge(project) : null;
252265
if (entitlementBridge != null) {
253266
test.getInputs().files(entitlementBridge);
254267
}
@@ -312,27 +325,30 @@ private static void configureEntitlements(Project project) {
312325
}
313326
FileCollection bridgeFiles = bridgeConfig;
314327

315-
project.getTasks().withType(Test.class).configureEach(test -> {
316-
// See also SystemJvmOptions.maybeAttachEntitlementAgent.
317-
318-
// Agent
319-
if (agentFiles.isEmpty() == false) {
320-
test.getInputs().files(agentFiles);
321-
test.systemProperty("es.entitlement.agentJar", agentFiles.getAsPath());
322-
test.systemProperty("jdk.attach.allowAttachSelf", true);
323-
}
328+
project.getTasks()
329+
.withType(Test.class)
330+
.matching(test -> TEST_TASKS_WITH_ENTITLEMENTS.contains(test.getName()))
331+
.configureEach(test -> {
332+
// See also SystemJvmOptions.maybeAttachEntitlementAgent.
333+
334+
// Agent
335+
if (agentFiles.isEmpty() == false) {
336+
test.getInputs().files(agentFiles);
337+
test.systemProperty("es.entitlement.agentJar", agentFiles.getAsPath());
338+
test.systemProperty("jdk.attach.allowAttachSelf", true);
339+
}
324340

325-
// Bridge
326-
if (bridgeFiles.isEmpty() == false) {
327-
String modulesContainingEntitlementInstrumentation = "java.logging,java.net.http,java.naming,jdk.net";
328-
test.getInputs().files(bridgeFiles);
329-
// Tests may not be modular, but the JDK still is
330-
test.jvmArgs(
331-
"--add-exports=java.base/org.elasticsearch.entitlement.bridge=ALL-UNNAMED,"
332-
+ modulesContainingEntitlementInstrumentation
333-
);
334-
}
335-
});
341+
// Bridge
342+
if (bridgeFiles.isEmpty() == false) {
343+
String modulesContainingEntitlementInstrumentation = "java.logging,java.net.http,java.naming,jdk.net";
344+
test.getInputs().files(bridgeFiles);
345+
// Tests may not be modular, but the JDK still is
346+
test.jvmArgs(
347+
"--add-exports=java.base/org.elasticsearch.entitlement.bridge=ALL-UNNAMED,"
348+
+ modulesContainingEntitlementInstrumentation
349+
);
350+
}
351+
});
336352
}
337353

338354
}

build-tools/src/main/java/org/elasticsearch/gradle/test/TestBuildInfoPlugin.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ public void apply(Project project) {
5858
});
5959

6060
if (project.getRootProject().getName().equals("elasticsearch")) {
61-
project.getTasks().withType(Test.class).matching(test -> List.of("test").contains(test.getName())).configureEach(test -> {
62-
test.systemProperty("es.entitlement.enableForTests", "true");
63-
});
61+
project.getTasks()
62+
.withType(Test.class)
63+
.matching(test -> List.of("test", "internalClusterTest").contains(test.getName()))
64+
.configureEach(test -> {
65+
test.systemProperty("es.entitlement.enableForTests", "true");
66+
});
6467
}
6568
}
6669
}

docs/changelog/121914.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/changelog/129282.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 129282
2+
summary: "Fix query rewrite logic to preserve `boosts` and `queryName` for `match`,\
3+
\ `knn`, and `sparse_vector` queries on semantic_text fields"
4+
area: Search
5+
type: bug
6+
issues: []

docs/changelog/129848.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 129848
2+
summary: "[ML] Add Azure AI Rerank support to the Inference Plugin"
3+
area: Machine Learning
4+
type: enhancement
5+
issues: []

docs/changelog/130940.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 130940
2+
summary: Block trained model updates from inference
3+
area: Machine Learning
4+
type: enhancement
5+
issues:
6+
- 129999

docs/changelog/131296.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 131296
2+
summary: Enable failure store for newly created APM datastreams
3+
area: Ingest Node
4+
type: enhancement
5+
issues: []

docs/changelog/131391.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 131391
2+
summary: Fix bug in point in time response
3+
area: Search
4+
type: bug
5+
issues:
6+
- 131026

libs/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ configure(childProjects.values()) {
5050
// Omit oddball libraries that aren't in server.
5151
def nonServerLibs = ['plugin-scanner']
5252
if (false == nonServerLibs.contains(project.name)) {
53-
project.getTasks().withType(Test.class).matching(test -> ['test'].contains(test.name)).configureEach(test -> {
53+
project.getTasks().withType(Test.class).matching(test -> ['test', 'internalClusterTest'].contains(test.name)).configureEach(test -> {
5454
test.systemProperty('es.entitlement.enableForTests', 'true')
5555
})
5656
}

modules/ingest-common/src/yamlRestTest/resources/rest-api-spec/test/ingest/210_conditional_processor.yml

Lines changed: 0 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -74,150 +74,3 @@ teardown:
7474
- match: { _source.bytes_source_field: "1kb" }
7575
- match: { _source.conditional_field: "bar" }
7676
- is_false: _source.bytes_target_field
77-
78-
---
79-
"Test conditional processor with fields API":
80-
- do:
81-
ingest.put_pipeline:
82-
id: "my_pipeline"
83-
body:
84-
description: "_description"
85-
processors:
86-
- set:
87-
if: "field('get.field').get('') == 'one'"
88-
field: "one"
89-
value: 1
90-
- set:
91-
if: "field('get.field').get('') == 'two'"
92-
field: "missing"
93-
value: "missing"
94-
- set:
95-
if: " /* avoid yaml stash */ $('get.field', 'one') == 'one'"
96-
field: "dollar"
97-
value: true
98-
- set:
99-
if: "field('missing.field').get('fallback') == 'fallback'"
100-
field: "fallback"
101-
value: "fallback"
102-
- set:
103-
if: "field('nested.array.get.with.index.field').get(1, null) == 'two'"
104-
field: "two"
105-
value: 2
106-
- set:
107-
if: "field('getName.field').getName() == 'getName.field'"
108-
field: "three"
109-
value: 3
110-
- set:
111-
if: "field('existing.field').exists()"
112-
field: "four"
113-
value: 4
114-
- set:
115-
if: "!field('empty.field').isEmpty()"
116-
field: "missing"
117-
value: "missing"
118-
- set:
119-
if: "field('size.field').size() == 2"
120-
field: "five"
121-
value: 5
122-
- set:
123-
if: >
124-
def iterator = field('iterator.field').iterator();
125-
def sum = 0;
126-
while (iterator.hasNext()) {
127-
sum += iterator.next();
128-
}
129-
return sum == 6;
130-
field: "six"
131-
value: 6
132-
- set:
133-
if: "field('hasValue.field').hasValue(v -> v == 'two')"
134-
field: "seven"
135-
value: 7
136-
- match: { acknowledged: true }
137-
138-
- do:
139-
index:
140-
index: test
141-
id: "1"
142-
pipeline: "my_pipeline"
143-
body:
144-
get.field: "one"
145-
nested:
146-
array:
147-
get.with.index.field: ["one", "two", "three"]
148-
getName.field: "my_name"
149-
existing.field: "indeed"
150-
empty.field: []
151-
size.field: ["one", "two"]
152-
iterator.field: [1, 2, 3]
153-
hasValue.field: ["one", "two", "three"]
154-
155-
- do:
156-
get:
157-
index: test
158-
id: "1"
159-
- match: { _source.get\.field: "one" }
160-
- match: { _source.one: 1 }
161-
- is_false: _source.missing
162-
- is_true: _source.dollar
163-
- match: { _source.fallback: "fallback" }
164-
- match: { _source.nested.array.get\.with\.index\.field: ["one", "two", "three"] }
165-
- match: { _source.two: 2 }
166-
- match: { _source.three: 3 }
167-
- match: { _source.four: 4 }
168-
- match: { _source.five: 5 }
169-
- match: { _source.six: 6 }
170-
- match: { _source.seven: 7 }
171-
172-
---
173-
"Test fields iterator is unmodifiable":
174-
- do:
175-
ingest.put_pipeline:
176-
id: "my_pipeline"
177-
body:
178-
description: "_description"
179-
processors:
180-
- set:
181-
if: >
182-
def iterator = field('iterator.field').iterator();
183-
def sum = 0;
184-
while (iterator.hasNext()) {
185-
sum += iterator.next();
186-
iterator.remove();
187-
}
188-
return sum == 6;
189-
field: "sum"
190-
value: 6
191-
- match: { acknowledged: true }
192-
193-
- do:
194-
index:
195-
index: test
196-
id: "1"
197-
pipeline: "my_pipeline"
198-
body:
199-
test.field: [1, 2, 3]
200-
- match: { error: null }
201-
202-
- do:
203-
index:
204-
index: test
205-
id: "2"
206-
pipeline: "my_pipeline"
207-
body:
208-
iterator.field: [1, 2, 3]
209-
catch: bad_request
210-
- length: { error.root_cause: 1 }
211-
212-
- do:
213-
get:
214-
index: test
215-
id: "1"
216-
- match: { _source.test\.field: [1, 2, 3] }
217-
- is_false: _source.sum
218-
219-
- do:
220-
get:
221-
index: test
222-
id: "2"
223-
catch: missing

0 commit comments

Comments
 (0)