Skip to content

Commit d7a063c

Browse files
committed
Merge branch 'master' into remove-failing-sanity-check
2 parents ae1eda6 + 5310804 commit d7a063c

File tree

58 files changed

+1299
-576
lines changed

Some content is hidden

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

58 files changed

+1299
-576
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public class RestTestBasePlugin implements Plugin<Project> {
3434
private static final String TESTS_REST_CLUSTER = "tests.rest.cluster";
3535
private static final String TESTS_CLUSTER = "tests.cluster";
3636
private static final String TESTS_CLUSTER_NAME = "tests.clustername";
37+
private static final String TESTS_CLUSTER_READINESS = "tests.cluster.readiness";
38+
3739
private ProviderFactory providerFactory;
3840

3941
@Inject
@@ -66,6 +68,7 @@ public void apply(Project project) {
6668
runnerNonInputProperties.systemProperty(TESTS_REST_CLUSTER, () -> String.join(",", cluster.getAllHttpSocketURI()));
6769
runnerNonInputProperties.systemProperty(TESTS_CLUSTER, () -> String.join(",", cluster.getAllTransportPortURI()));
6870
runnerNonInputProperties.systemProperty(TESTS_CLUSTER_NAME, cluster::getName);
71+
runnerNonInputProperties.systemProperty(TESTS_CLUSTER_READINESS, () -> String.join(",", cluster.getAllReadinessPortURI()));
6972
} else {
7073
if (systemProperty(TESTS_CLUSTER) == null || systemProperty(TESTS_CLUSTER_NAME) == null) {
7174
throw new IllegalArgumentException(

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public void apply(Project project) {
6262
nonInputProperties.systemProperty("tests.rest.cluster", () -> String.join(",", cluster.getAllHttpSocketURI()));
6363
nonInputProperties.systemProperty("tests.cluster", () -> String.join(",", cluster.getAllTransportPortURI()));
6464
nonInputProperties.systemProperty("tests.clustername", () -> cluster.getName());
65+
nonInputProperties.systemProperty("tests.cluster.readiness", () -> String.join(",", cluster.getAllReadinessPortURI()));
6566
task.getJvmArgumentProviders().add(nonInputProperties);
6667
});
6768

build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchCluster.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ public void setNumberOfNodes(int numberOfNodes) {
146146
}
147147
}
148148

149+
public void setReadinessEnabled(boolean enabled) {
150+
if (enabled) {
151+
for (ElasticsearchNode node : nodes) {
152+
node.setting("readiness.port", "0"); // ephemeral port
153+
}
154+
}
155+
}
156+
149157
@Internal
150158
public ElasticsearchNode getFirstNode() {
151159
return nodes.getAt(clusterName + "-0");
@@ -455,6 +463,13 @@ public String getTransportPortURI() {
455463
return getFirstNode().getTransportPortURI();
456464
}
457465

466+
@Override
467+
@Internal
468+
public String getReadinessPortURI() {
469+
waitForAllConditions();
470+
return getFirstNode().getReadinessPortURI();
471+
}
472+
458473
@Override
459474
@Internal
460475
public List<String> getAllHttpSocketURI() {
@@ -469,6 +484,13 @@ public List<String> getAllTransportPortURI() {
469484
return nodes.stream().flatMap(each -> each.getAllTransportPortURI().stream()).collect(Collectors.toList());
470485
}
471486

487+
@Override
488+
@Internal
489+
public List<String> getAllReadinessPortURI() {
490+
waitForAllConditions();
491+
return nodes.stream().flatMap(each -> each.getAllReadinessPortURI().stream()).collect(Collectors.toList());
492+
}
493+
472494
public void waitForAllConditions() {
473495
writeUnicastHostsFiles();
474496

build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ public class ElasticsearchNode implements TestClusterConfiguration {
159159
private final Path confPathLogs;
160160
private final Path transportPortFile;
161161
private final Path httpPortsFile;
162+
private final Path readinessPortsFile;
162163
private final Path esLogFile;
163164
private final Path esStdinFile;
164165
private final Path tmpDir;
@@ -209,6 +210,7 @@ public class ElasticsearchNode implements TestClusterConfiguration {
209210
confPathLogs = workingDir.resolve("logs");
210211
transportPortFile = confPathLogs.resolve("transport.ports");
211212
httpPortsFile = confPathLogs.resolve("http.ports");
213+
readinessPortsFile = confPathLogs.resolve("readiness.ports");
212214
esLogFile = confPathLogs.resolve(clusterName + ".log");
213215
esStdinFile = workingDir.resolve("es.stdin");
214216
tmpDir = workingDir.resolve("tmp");
@@ -955,6 +957,12 @@ public String getTransportPortURI() {
955957
return getTransportPortInternal().get(0);
956958
}
957959

960+
@Override
961+
@Internal
962+
public String getReadinessPortURI() {
963+
return getReadinessPortInternal().get(0);
964+
}
965+
958966
@Override
959967
@Internal
960968
public List<String> getAllHttpSocketURI() {
@@ -969,6 +977,13 @@ public List<String> getAllTransportPortURI() {
969977
return getTransportPortInternal();
970978
}
971979

980+
@Override
981+
@Internal
982+
public List<String> getAllReadinessPortURI() {
983+
waitForAllConditions();
984+
return getReadinessPortInternal();
985+
}
986+
972987
@Internal
973988
public File getServerLog() {
974989
return confPathLogs.resolve(defaultConfig.get("cluster.name") + "_server.json").toFile();
@@ -989,6 +1004,9 @@ public synchronized void stop(boolean tailLogs) {
9891004
if (Files.exists(transportPortFile)) {
9901005
Files.delete(transportPortFile);
9911006
}
1007+
if (Files.exists(readinessPortsFile)) {
1008+
Files.delete(readinessPortsFile);
1009+
}
9921010
} catch (IOException e) {
9931011
throw new UncheckedIOException(e);
9941012
}
@@ -1011,6 +1029,9 @@ public synchronized void stop(boolean tailLogs) {
10111029
if (Files.exists(transportPortFile)) {
10121030
Files.delete(transportPortFile);
10131031
}
1032+
if (Files.exists(readinessPortsFile)) {
1033+
Files.delete(readinessPortsFile);
1034+
}
10141035
} catch (IOException e) {
10151036
throw new UncheckedIOException(e);
10161037
}
@@ -1409,6 +1430,14 @@ private List<String> getHttpPortInternal() {
14091430
}
14101431
}
14111432

1433+
private List<String> getReadinessPortInternal() {
1434+
try {
1435+
return readPortsFile(readinessPortsFile);
1436+
} catch (IOException e) {
1437+
return new ArrayList<>();
1438+
}
1439+
}
1440+
14121441
private List<String> readPortsFile(Path file) throws IOException {
14131442
try (Stream<String> lines = Files.lines(file, StandardCharsets.UTF_8)) {
14141443
return lines.map(String::trim).collect(Collectors.toList());

build-tools/src/main/java/org/elasticsearch/gradle/testclusters/TestClusterConfiguration.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,14 @@ public interface TestClusterConfiguration {
113113

114114
String getTransportPortURI();
115115

116+
String getReadinessPortURI();
117+
116118
List<String> getAllHttpSocketURI();
117119

118120
List<String> getAllTransportPortURI();
119121

122+
List<String> getAllReadinessPortURI();
123+
120124
void stop(boolean tailLogs);
121125

122126
void setNameCustomization(Function<String, String> nameSupplier);

distribution/src/config/elasticsearch.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@
7575
#
7676
# For more information, consult the discovery and cluster formation module documentation.
7777
#
78+
# --------------------------------- Readiness ----------------------------------
79+
#
80+
# Enable an unauthenticated TCP readiness endpoint on localhost
81+
#
82+
#readiness.port: 9399
83+
#
7884
# ---------------------------------- Various -----------------------------------
7985
#
8086
# Allow wildcard deletion of indices:

docs/changelog/84375.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 84375
2+
summary: Introduce an unauthenticated endpoint for readiness checks
3+
area: Infra/Core
4+
type: feature
5+
issues:
6+
- 81168

docs/changelog/85383.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 85383
2+
summary: Fixes to making old ML indices hidden
3+
area: Machine Learning
4+
type: bug
5+
issues: []

modules/data-streams/src/test/java/org/elasticsearch/datastreams/DataStreamIndexSettingsProviderTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ public void testGetAdditionalIndexSettingsDataStreamAlreadyCreatedTimeSettingsMi
119119
mb.put(
120120
new DataStream(
121121
ds.getName(),
122-
ds.getTimeStampField(),
123122
ds.getIndices(),
124123
ds.getGeneration(),
125124
ds.getMetadata(),

modules/data-streams/src/test/java/org/elasticsearch/datastreams/MetadataDataStreamRolloverServiceTests.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public void testRolloverClusterStateForDataStream() throws Exception {
5353
String dataStreamName = "logs-my-app";
5454
final DataStream dataStream = new DataStream(
5555
dataStreamName,
56-
new DataStream.TimestampField("@timestamp"),
5756
List.of(new Index(DataStream.getDefaultBackingIndexName(dataStreamName, 1, now.toEpochMilli()), "uuid")),
5857
1,
5958
null,
@@ -152,7 +151,6 @@ public void testRolloverAndMigrateDataStream() throws Exception {
152151
IndexMode dsIndexMode = randomBoolean() ? null : IndexMode.STANDARD;
153152
final DataStream dataStream = new DataStream(
154153
dataStreamName,
155-
new DataStream.TimestampField("@timestamp"),
156154
List.of(new Index(DataStream.getDefaultBackingIndexName(dataStreamName, 1, now.toEpochMilli()), "uuid")),
157155
1,
158156
null,
@@ -237,7 +235,6 @@ public void testChangingIndexModeFromTimeSeriesToSomethingElseNoEffectOnExisting
237235
String dataStreamName = "logs-my-app";
238236
final DataStream dataStream = new DataStream(
239237
dataStreamName,
240-
new DataStream.TimestampField("@timestamp"),
241238
List.of(new Index(DataStream.getDefaultBackingIndexName(dataStreamName, 1, now.toEpochMilli()), "uuid")),
242239
1,
243240
null,

0 commit comments

Comments
 (0)