Skip to content

Commit 249c078

Browse files
Merge remote-tracking branch 'elastic/main' into batched-exec-short
2 parents 72f8845 + c0bf7d2 commit 249c078

File tree

19 files changed

+226
-138
lines changed

19 files changed

+226
-138
lines changed

docs/changelog/121843.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 121843
2+
summary: Fix async stop sometimes not properly collecting result
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 121249

libs/entitlement/bridge/src/main/java/org/elasticsearch/entitlement/bridge/EntitlementChecker.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import java.nio.channels.SocketChannel;
5151
import java.nio.channels.spi.SelectorProvider;
5252
import java.nio.charset.Charset;
53+
import java.nio.file.LinkOption;
5354
import java.nio.file.OpenOption;
5455
import java.nio.file.Path;
5556
import java.nio.file.attribute.UserPrincipal;
@@ -514,6 +515,8 @@ public interface EntitlementChecker {
514515
void check$java_util_Scanner$(Class<?> callerClass, File source, Charset charset);
515516

516517
// nio
518+
void check$java_nio_file_Files$$getOwner(Class<?> callerClass, Path path, LinkOption... options);
519+
517520
void check$java_nio_file_Files$$probeContentType(Class<?> callerClass, Path path);
518521

519522
void check$java_nio_file_Files$$setOwner(Class<?> callerClass, Path path, UserPrincipal principal);

libs/entitlement/qa/entitled-plugin/src/main/plugin-metadata/entitlement-policy.yaml

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

libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/FileCheckActions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ static void createFileOutputStreamFileWithAppend() throws IOException {
8080
new FileOutputStream(readWriteFile().toFile(), false).close();
8181
}
8282

83+
@EntitlementTest(expectedAccess = PLUGINS)
84+
static void filesGetOwner() throws IOException {
85+
Files.getOwner(readFile());
86+
}
87+
8388
@EntitlementTest(expectedAccess = PLUGINS)
8489
static void filesProbeContentType() throws IOException {
8590
Files.probeContentType(readFile());

libs/entitlement/qa/src/javaRestTest/java/org/elasticsearch/entitlement/qa/AbstractEntitlementsIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import org.elasticsearch.client.Request;
1313
import org.elasticsearch.client.Response;
14+
import org.elasticsearch.entitlement.qa.EntitlementsTestRule.PolicyBuilder;
1415
import org.elasticsearch.test.rest.ESRestTestCase;
1516

1617
import java.io.IOException;
@@ -22,7 +23,7 @@
2223

2324
public abstract class AbstractEntitlementsIT extends ESRestTestCase {
2425

25-
static final EntitlementsTestRule.PolicyBuilder ALLOWED_TEST_ENTITLEMENTS = (builder, tempDir) -> {
26+
static final PolicyBuilder ALLOWED_TEST_ENTITLEMENTS = (builder, tempDir) -> {
2627
builder.value("create_class_loader");
2728
builder.value("set_https_connection_properties");
2829
builder.value("inbound_network");

libs/entitlement/qa/src/javaRestTest/java/org/elasticsearch/entitlement/qa/EntitlementsTestRule.java

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,27 @@
2626
import java.io.UncheckedIOException;
2727
import java.nio.file.Files;
2828
import java.nio.file.Path;
29+
import java.util.List;
30+
import java.util.Map;
2931

3032
class EntitlementsTestRule implements TestRule {
3133

34+
// entitlements that test methods may use, see EntitledActions
35+
private static final PolicyBuilder ENTITLED_POLICY = (builder, tempDir) -> {
36+
builder.value(Map.of("write_system_properties", Map.of("properties", List.of("org.elasticsearch.entitlement.qa.selfTest"))));
37+
builder.value(
38+
Map.of(
39+
"files",
40+
List.of(
41+
Map.of("path", tempDir.resolve("read_dir"), "mode", "read"),
42+
Map.of("path", tempDir.resolve("read_write_dir"), "mode", "read_write"),
43+
Map.of("path", tempDir.resolve("read_file"), "mode", "read"),
44+
Map.of("path", tempDir.resolve("read_write_file"), "mode", "read_write")
45+
)
46+
)
47+
);
48+
};
49+
3250
interface PolicyBuilder {
3351
void build(XContentBuilder builder, Path tempDir) throws IOException;
3452
}
@@ -51,7 +69,7 @@ protected void before() throws Throwable {
5169
}
5270
};
5371
cluster = ElasticsearchCluster.local()
54-
.module("entitled")
72+
.module("entitled", spec -> buildEntitlements(spec, "org.elasticsearch.entitlement.qa.entitled", ENTITLED_POLICY))
5573
.module("entitlement-test-plugin", spec -> setupEntitlements(spec, modular, policyBuilder))
5674
.systemProperty("es.entitlements.enabled", "true")
5775
.systemProperty("es.entitlements.testdir", () -> testDir.getRoot().getAbsolutePath())
@@ -65,29 +83,30 @@ public Statement apply(Statement statement, Description description) {
6583
return ruleChain.apply(statement, description);
6684
}
6785

68-
private void setupEntitlements(PluginInstallSpec spec, boolean modular, PolicyBuilder policyBuilder) {
69-
String moduleName = modular ? "org.elasticsearch.entitlement.qa.test" : "ALL-UNNAMED";
70-
if (policyBuilder != null) {
71-
spec.withEntitlementsOverride(old -> {
72-
try {
73-
try (var builder = YamlXContent.contentBuilder()) {
74-
builder.startObject();
75-
builder.field(moduleName);
76-
builder.startArray();
86+
private void buildEntitlements(PluginInstallSpec spec, String moduleName, PolicyBuilder policyBuilder) {
87+
spec.withEntitlementsOverride(old -> {
88+
try (var builder = YamlXContent.contentBuilder()) {
89+
builder.startObject();
90+
builder.field(moduleName);
91+
builder.startArray();
7792

78-
policyBuilder.build(builder, testDir.getRoot().toPath());
79-
builder.endArray();
80-
builder.endObject();
93+
policyBuilder.build(builder, testDir.getRoot().toPath());
94+
builder.endArray();
95+
builder.endObject();
8196

82-
String policy = Strings.toString(builder);
83-
System.out.println("Using entitlement policy:\n" + policy);
84-
return Resource.fromString(policy);
85-
}
97+
String policy = Strings.toString(builder);
98+
System.out.println("Using entitlement policy for module " + moduleName + ":\n" + policy);
99+
return Resource.fromString(policy);
100+
} catch (IOException e) {
101+
throw new UncheckedIOException(e);
102+
}
103+
});
104+
}
86105

87-
} catch (IOException e) {
88-
throw new UncheckedIOException(e);
89-
}
90-
});
106+
private void setupEntitlements(PluginInstallSpec spec, boolean modular, PolicyBuilder policyBuilder) {
107+
String moduleName = modular ? "org.elasticsearch.entitlement.qa.test" : "ALL-UNNAMED";
108+
if (policyBuilder != null) {
109+
buildEntitlements(spec, moduleName, policyBuilder);
91110
}
92111

93112
if (modular == false) {

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/api/ElasticsearchEntitlementChecker.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import java.nio.channels.SocketChannel;
5656
import java.nio.channels.spi.SelectorProvider;
5757
import java.nio.charset.Charset;
58+
import java.nio.file.LinkOption;
5859
import java.nio.file.OpenOption;
5960
import java.nio.file.Path;
6061
import java.nio.file.attribute.UserPrincipal;
@@ -976,6 +977,11 @@ public void checkSelectorProviderInheritedChannel(Class<?> callerClass, Selector
976977

977978
// nio
978979

980+
@Override
981+
public void check$java_nio_file_Files$$getOwner(Class<?> callerClass, Path path, LinkOption... options) {
982+
policyManager.checkFileRead(callerClass, path);
983+
}
984+
979985
@Override
980986
public void check$java_nio_file_Files$$probeContentType(Class<?> callerClass, Path path) {
981987
policyManager.checkFileRead(callerClass, path);

muted-tests.yml

Lines changed: 23 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ tests:
137137
- class: org.elasticsearch.xpack.searchablesnapshots.RetrySearchIntegTests
138138
method: testSearcherId
139139
issue: https://github.com/elastic/elasticsearch/issues/118374
140-
- class: org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT
141-
issue: https://github.com/elastic/elasticsearch/issues/118238
142140
- class: org.elasticsearch.xpack.ccr.rest.ShardChangesRestIT
143141
method: testShardChangesNoOperation
144142
issue: https://github.com/elastic/elasticsearch/issues/118800
@@ -273,9 +271,6 @@ tests:
273271
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
274272
method: testWithDatastreams
275273
issue: https://github.com/elastic/elasticsearch/issues/121236
276-
- class: org.elasticsearch.xpack.remotecluster.RemoteClusterSecurityEsqlIT
277-
method: testCrossClusterAsyncQueryStop
278-
issue: https://github.com/elastic/elasticsearch/issues/121249
279274
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
280275
method: test {p0=transform/*}
281276
issue: https://github.com/elastic/elasticsearch/issues/120816
@@ -358,18 +353,6 @@ tests:
358353
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
359354
method: testDependentVariableIsAliasToKeyword
360355
issue: https://github.com/elastic/elasticsearch/issues/121492
361-
- class: org.elasticsearch.xpack.esql.action.CrossClustersCancellationIT
362-
method: testTasks
363-
issue: https://github.com/elastic/elasticsearch/issues/121626
364-
- class: org.elasticsearch.xpack.esql.action.CrossClustersCancellationIT
365-
method: testCloseSkipUnavailable
366-
issue: https://github.com/elastic/elasticsearch/issues/121627
367-
- class: org.elasticsearch.xpack.esql.action.CrossClustersCancellationIT
368-
method: testCancel
369-
issue: https://github.com/elastic/elasticsearch/issues/121632
370-
- class: org.elasticsearch.xpack.esql.action.CrossClustersCancellationIT
371-
method: testCancelSkipUnavailable
372-
issue: https://github.com/elastic/elasticsearch/issues/121631
373356
- class: org.elasticsearch.search.CrossClusterSearchUnavailableClusterIT
374357
method: testSearchSkipUnavailable
375358
issue: https://github.com/elastic/elasticsearch/issues/121497
@@ -384,35 +367,14 @@ tests:
384367
- class: org.elasticsearch.analysis.common.CommonAnalysisClientYamlTestSuiteIT
385368
method: test {yaml=analysis-common/40_token_filters/stemmer_override file access}
386369
issue: https://github.com/elastic/elasticsearch/issues/121625
387-
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
388-
method: test {yaml=update/100_synthetic_source/stored text}
389-
issue: https://github.com/elastic/elasticsearch/issues/121964
390-
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
391-
method: test {yaml=update/100_synthetic_source/keyword}
392-
issue: https://github.com/elastic/elasticsearch/issues/121965
393370
- class: org.elasticsearch.xpack.esql.plugin.DataNodeRequestSenderTests
394371
method: testDoNotRetryOnRequestLevelFailure
395372
issue: https://github.com/elastic/elasticsearch/issues/121966
396373
- class: org.elasticsearch.xpack.searchablesnapshots.hdfs.SecureHdfsSearchableSnapshotsIT
397374
issue: https://github.com/elastic/elasticsearch/issues/121967
398-
- class: org.elasticsearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT
399-
method: test {yaml=update/100_synthetic_source/stored text}
400-
issue: https://github.com/elastic/elasticsearch/issues/121991
401-
- class: org.elasticsearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT
402-
method: test {yaml=update/100_synthetic_source/keyword}
403-
issue: https://github.com/elastic/elasticsearch/issues/121992
404375
- class: org.elasticsearch.action.search.SearchQueryThenFetchAsyncActionTests
405376
method: testBottomFieldSort
406377
issue: https://github.com/elastic/elasticsearch/issues/121503
407-
- class: org.elasticsearch.xpack.logsdb.LogsdbTestSuiteIT
408-
method: test {yaml=/60_synthetic_source_recovery/synthetic recovery for synthetic source mode index}
409-
issue: https://github.com/elastic/elasticsearch/issues/122026
410-
- class: org.elasticsearch.xpack.logsdb.LogsdbTestSuiteIT
411-
method: test {yaml=/60_synthetic_source_recovery/synthetic recovery for time_series index}
412-
issue: https://github.com/elastic/elasticsearch/issues/122027
413-
- class: org.elasticsearch.xpack.logsdb.LogsdbTestSuiteIT
414-
method: test {yaml=/60_synthetic_source_recovery/synthetic recovery for logsdb index}
415-
issue: https://github.com/elastic/elasticsearch/issues/122028
416378
- class: org.elasticsearch.xpack.application.CohereServiceUpgradeIT
417379
issue: https://github.com/elastic/elasticsearch/issues/121537
418380
- class: org.elasticsearch.xpack.migrate.action.ReindexDatastreamIndexTransportActionIT
@@ -423,6 +385,29 @@ tests:
423385
- class: org.elasticsearch.xpack.restart.FullClusterRestartIT
424386
method: testWatcherWithApiKey {cluster=UPGRADED}
425387
issue: https://github.com/elastic/elasticsearch/issues/122061
388+
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
389+
method: test {yaml=update/100_synthetic_source/stored text}
390+
issue: https://github.com/elastic/elasticsearch/issues/122100
391+
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
392+
method: test {yaml=update/100_synthetic_source/keyword}
393+
issue: https://github.com/elastic/elasticsearch/issues/122101
394+
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
395+
method: test {yaml=snapshot.delete/10_basic/Delete a snapshot asynchronously}
396+
issue: https://github.com/elastic/elasticsearch/issues/122102
397+
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
398+
method: test {yaml=search/180_locale_dependent_mapping/Test Index and Search locale dependent mappings / dates}
399+
issue: https://github.com/elastic/elasticsearch/issues/122103
400+
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
401+
method: test {yaml=snapshot.delete/10_basic/Delete a snapshot asynchronously}
402+
issue: https://github.com/elastic/elasticsearch/issues/122104
403+
- class: org.elasticsearch.datastreams.TSDBPassthroughIndexingIT
404+
issue: https://github.com/elastic/elasticsearch/issues/121716
405+
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
406+
method: testWithOnlyTrainingRowsAndTrainingPercentIsFifty_DependentVariableIsBoolean
407+
issue: https://github.com/elastic/elasticsearch/issues/121680
408+
- class: org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT
409+
method: testExtractFields
410+
issue: https://github.com/elastic/elasticsearch/issues/122125
426411

427412
# Examples:
428413
#

qa/smoke-test-multinode/src/yamlRestTest/java/org/elasticsearch/smoketest/SmokeTestMultiNodeClientYamlTestSuiteIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class SmokeTestMultiNodeClientYamlTestSuiteIT extends ESClientYamlSuiteTe
3636
.node(0, n -> n.setting("node.roles", "[master,data,ml,remote_cluster_client,transform]"))
3737
.feature(FeatureFlag.TIME_SERIES_MODE)
3838
.feature(FeatureFlag.SUB_OBJECTS_AUTO_ENABLED)
39+
.feature(FeatureFlag.INDEX_RECOVERY_USE_SYNTHETIC_SOURCE)
3940
.build();
4041

4142
public SmokeTestMultiNodeClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {

rest-api-spec/src/yamlRestTest/java/org/elasticsearch/test/rest/ClientYamlTestSuiteIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class ClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
3636
.module("data-streams")
3737
.feature(FeatureFlag.TIME_SERIES_MODE)
3838
.feature(FeatureFlag.SUB_OBJECTS_AUTO_ENABLED)
39+
.feature(FeatureFlag.INDEX_RECOVERY_USE_SYNTHETIC_SOURCE)
3940
.build();
4041

4142
public ClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {

0 commit comments

Comments
 (0)