Skip to content

Commit e137a14

Browse files
authored
Move common system properties for test clusters to default provider (#117928) (#117941)
This commit moves common system properties needed for test clusters to a SystemPropertyProvider which can be reused and extended by serverless.
1 parent 2e4931f commit e137a14

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/AbstractLocalSpecBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public T systemProperty(String key, Supplier<String> supplier) {
214214
return cast(this);
215215
}
216216

217-
public T systemProperty(SystemPropertyProvider systemPropertyProvider) {
217+
public T systemProperties(SystemPropertyProvider systemPropertyProvider) {
218218
this.systemPropertyProviders.add(systemPropertyProvider);
219219
return cast(this);
220220
}

test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/DefaultLocalClusterSpecBuilder.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ public final class DefaultLocalClusterSpecBuilder extends AbstractLocalClusterSp
1919

2020
public DefaultLocalClusterSpecBuilder() {
2121
super();
22-
this.apply(
23-
c -> c.systemProperty("ingest.geoip.downloader.enabled.default", "false").systemProperty("tests.testfeatures.enabled", "true")
24-
);
2522
this.apply(new FipsEnabledClusterConfigProvider());
23+
this.systemProperties(new DefaultSystemPropertyProvider());
2624
this.settings(new DefaultSettingsProvider());
2725
this.environment(new DefaultEnvironmentProvider());
2826
this.rolesFile(Resource.fromClasspath("default_test_roles.yml"));
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.test.cluster.local;
11+
12+
import org.elasticsearch.test.cluster.SystemPropertyProvider;
13+
14+
import java.util.Map;
15+
16+
import static java.util.Map.entry;
17+
18+
public class DefaultSystemPropertyProvider implements SystemPropertyProvider {
19+
@Override
20+
public Map<String, String> get(LocalClusterSpec.LocalNodeSpec nodeSpec) {
21+
return Map.ofEntries(entry("ingest.geoip.downloader.enabled.default", "false"), entry("tests.testfeatures.enabled", "true"));
22+
}
23+
}

test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/LocalSpecBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ interface LocalSpecBuilder<T extends LocalSpecBuilder<?>> {
137137
/**
138138
* Register a {@link SystemPropertyProvider}.
139139
*/
140-
T systemProperty(SystemPropertyProvider systemPropertyProvider);
140+
T systemProperties(SystemPropertyProvider systemPropertyProvider);
141141

142142
/**
143143
* Adds an additional command line argument to node JVM arguments.

0 commit comments

Comments
 (0)