Remove support for -Des.* system properties in integration tests

This now requires that system properties passed to Gradle must be in the form of "-Dtests.es.*" instead of
"-Des.*". It then chops off "tests.es." and passes that as a "-E" property to Elasticsearch.

Also changed system properties:

- `tests.logger.level` became `tests.es.logger.level`
- `node.mode` became `tests.es.node.mode`
- `node.local` became `tests.es.node.local`
This commit is contained in:
Chris Earle 2016-05-23 13:19:25 -04:00
parent ef435d0099
commit b49635539d
4 changed files with 15 additions and 20 deletions

View File

@ -18,18 +18,18 @@ gradle assemble
== Other test options
To disable and enable network transport, set the `Des.node.mode`.
To disable and enable network transport, set the `tests.es.node.mode` system property.
Use network transport:
------------------------------------
-Des.node.mode=network
-Dtests.es.node.mode=network
------------------------------------
Use local transport (default since 1.3):
-------------------------------------
-Des.node.mode=local
-Dtests.es.node.mode=local
-------------------------------------
=== Running Elasticsearch from a checkout
@ -195,7 +195,7 @@ gradle test -Dtests.timeoutSuite=5000! ...
Change the logging level of ES (not gradle)
--------------------------------
gradle test -Dtests.logger.level=DEBUG
gradle test -Dtests.es.logger.level=DEBUG
--------------------------------
Print all the logging output from the test runs to the commandline

View File

@ -130,17 +130,13 @@ class NodeInfo {
env = [ 'JAVA_HOME' : project.javaHome ]
args.addAll("-E", "node.portsfile=true")
String loggerLevel = System.getProperty("tests.logger.level")
if (loggerLevel != null) {
args.addAll("-E", "logger.level=${loggerLevel}")
}
String collectedSystemProperties = config.systemProperties.collect { key, value -> "-D${key}=${value}" }.join(" ")
String esJavaOpts = config.jvmArgs.isEmpty() ? collectedSystemProperties : collectedSystemProperties + " " + config.jvmArgs
env.put('ES_JAVA_OPTS', esJavaOpts)
for (Map.Entry<String, String> property : System.properties.entrySet()) {
if (property.getKey().startsWith('es.')) {
if (property.key.startsWith('tests.es.')) {
args.add("-E")
args.add("${property.getKey()}=${property.getValue()}")
args.add("${property.key.substring('tests.es.'.size())}=${property.value}")
}
}
env.put('ES_JVM_OPTIONS', new File(confDir, 'jvm.options'))

View File

@ -80,7 +80,6 @@ import org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache;
import org.elasticsearch.indices.recovery.RecoverySettings;
import org.elasticsearch.node.MockNode;
import org.elasticsearch.node.Node;
import org.elasticsearch.node.internal.InternalSettingsPreparer;
import org.elasticsearch.node.service.NodeService;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.ScriptService;
@ -293,8 +292,8 @@ public final class InternalTestCluster extends TestCluster {
builder.put("http.port", HTTP_BASE_PORT + "-" + (HTTP_BASE_PORT + PORTS_PER_CLUSTER));
builder.put(Node.NODE_MODE_SETTING.getKey(), nodeMode);
builder.put("http.pipelining", enableHttpPipelining);
if (Strings.hasLength(System.getProperty("tests.logger.level"))) {
builder.put("logger.level", System.getProperty("tests.logger.level"));
if (Strings.hasLength(System.getProperty("tests.es.logger.level"))) {
builder.put("logger.level", System.getProperty("tests.es.logger.level"));
}
if (Strings.hasLength(System.getProperty("es.logger.prefix"))) {
builder.put("logger.prefix", System.getProperty("es.logger.prefix"));
@ -318,14 +317,14 @@ public final class InternalTestCluster extends TestCluster {
public static String configuredNodeMode() {
Builder builder = Settings.builder();
if (Strings.isEmpty(System.getProperty("node.mode")) && Strings.isEmpty(System.getProperty("node.local"))) {
if (Strings.isEmpty(System.getProperty("tests.es.node.mode")) && Strings.isEmpty(System.getProperty("tests.node.local"))) {
return "local"; // default if nothing is specified
}
if (Strings.hasLength(System.getProperty("node.mode"))) {
builder.put(Node.NODE_MODE_SETTING.getKey(), System.getProperty("node.mode"));
if (Strings.hasLength(System.getProperty("tests.es.node.mode"))) {
builder.put(Node.NODE_MODE_SETTING.getKey(), System.getProperty("tests.es.node.mode"));
}
if (Strings.hasLength(System.getProperty("node.local"))) {
builder.put(Node.NODE_LOCAL_SETTING.getKey(), System.getProperty("node.local"));
if (Strings.hasLength(System.getProperty("tests.es.node.local"))) {
builder.put(Node.NODE_LOCAL_SETTING.getKey(), System.getProperty("tests.es.node.local"));
}
if (DiscoveryNode.isLocalNode(builder.build())) {
return "local";

View File

@ -137,10 +137,10 @@ public class ReproduceInfoPrinter extends RunListener {
}
public ReproduceErrorMessageBuilder appendESProperties() {
appendProperties("tests.logger.level");
appendProperties("tests.es.logger.level");
if (inVerifyPhase()) {
// these properties only make sense for integration tests
appendProperties("node.mode", "node.local", TESTS_CLUSTER,
appendProperties("tests.es.node.mode", "tests.es.node.local", TESTS_CLUSTER,
ESIntegTestCase.TESTS_ENABLE_MOCK_MODULES);
}
appendProperties("tests.assertion.disabled", "tests.security.manager", "tests.nightly", "tests.jvms",