Skip to content

Commit

Permalink
Make the run task honor tests.es properties (elastic#47860)
Browse files Browse the repository at this point in the history
* Make the run task honor tests.es properties

Closes elastic#47797

With this PR we now again honor tests.es and tests.heap.size

* remove debuging
  • Loading branch information
alpar-t authored and howardhuanghua committed Oct 14, 2019
1 parent a141313 commit 3a4c6d7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Expand Up @@ -660,7 +660,8 @@ private Map<String, String> getESEnvironment() {
})
.collect(Collectors.joining(" "));
}
defaultEnv.put("ES_JAVA_OPTS", "-Xms512m -Xmx512m -ea -esa " +
String heapSize = System.getProperty("tests.heap.size", "512m");
defaultEnv.put("ES_JAVA_OPTS", "-Xms" + heapSize + " -Xmx" + heapSize + " -ea -esa " +
systemPropertiesString + " " +
jvmArgsString + " " +
// Support passing in additional JVM arguments
Expand Down
Expand Up @@ -10,11 +10,14 @@
import java.io.IOException;
import java.nio.file.Files;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

public class RunTask extends DefaultTestClustersTask {

private static final Logger logger = Logging.getLogger(RunTask.class);
public static final String CUSTOM_SETTINGS_PREFIX = "tests.es.";

private Boolean debug = false;

Expand All @@ -36,12 +39,19 @@ public void beforeStart() {
int debugPort = 8000;
int httpPort = 9200;
int transportPort = 9300;
Map<String, String> additionalSettings = System.getProperties().entrySet().stream()
.filter(entry -> entry.getKey().toString().startsWith(CUSTOM_SETTINGS_PREFIX))
.collect(Collectors.toMap(
entry -> entry.getKey().toString().substring(CUSTOM_SETTINGS_PREFIX.length()),
entry -> entry.getValue().toString()
));
for (ElasticsearchCluster cluster : getClusters()) {
cluster.getFirstNode().setHttpPort(String.valueOf(httpPort));
httpPort++;
cluster.getFirstNode().setTransportPort(String.valueOf(transportPort));
transportPort++;
for (ElasticsearchNode node : cluster.getNodes()) {
additionalSettings.forEach(node::setting);
if (debug) {
logger.lifecycle(
"Running elasticsearch in debug mode, {} suspending until connected on debugPort {}",
Expand Down

0 comments on commit 3a4c6d7

Please sign in to comment.