[TEST] Print out the `tests.cluster` sys prop if available to be able to reproduce failures when using the external cluster
Relates to #5630
This commit is contained in:
parent
be33c99835
commit
6ef45a9ae3
|
@ -148,6 +148,11 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
*/
|
||||
public static final String TESTS_CLIENT_RATIO = "tests.client.ratio";
|
||||
|
||||
/**
|
||||
* Key used to eventually switch to using an external cluster and provide its transport addresses
|
||||
*/
|
||||
public static final String TESTS_CLUSTER = "tests.cluster";
|
||||
|
||||
/**
|
||||
* Threshold at which indexing switches from frequently async to frequently bulk.
|
||||
*/
|
||||
|
@ -190,7 +195,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
// Initialize lazily. No need for volatiles/ CASs since each JVM runs at most one test
|
||||
// suite at any given moment.
|
||||
if (GLOBAL_CLUSTER == null) {
|
||||
String cluster = System.getProperty("tests.cluster");
|
||||
String cluster = System.getProperty(TESTS_CLUSTER);
|
||||
if (Strings.hasLength(cluster)) {
|
||||
String[] stringAddresses = cluster.split(",");
|
||||
TransportAddress[] transportAddresses = new TransportAddress[stringAddresses.length];
|
||||
|
|
|
@ -24,6 +24,8 @@ import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
|
|||
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.transport.TransportClient;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.transport.InetSocketTransportAddress;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
|
@ -38,6 +40,8 @@ import java.util.Iterator;
|
|||
*/
|
||||
public final class ExternalTestCluster extends ImmutableTestCluster {
|
||||
|
||||
private final ESLogger logger = Loggers.getLogger(getClass());
|
||||
|
||||
private final Client client;
|
||||
|
||||
private final InetSocketAddress[] httpAddresses;
|
||||
|
@ -59,6 +63,7 @@ public final class ExternalTestCluster extends ImmutableTestCluster {
|
|||
}
|
||||
}
|
||||
this.dataNodes = dataNodes;
|
||||
logger.info("Setup ExternalTestCluster [{}] made of [{}] nodes", nodeInfos.getClusterName().value(), size());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.junit.runner.notification.Failure;
|
|||
import org.junit.runner.notification.RunListener;
|
||||
|
||||
import static com.carrotsearch.randomizedtesting.SysGlobals.SYSPROP_ITERATIONS;
|
||||
import static org.elasticsearch.test.ElasticsearchIntegrationTest.TESTS_CLUSTER;
|
||||
|
||||
/**
|
||||
* A {@link RunListener} that emits to {@link System#err} a string with command
|
||||
|
@ -114,7 +115,7 @@ public class ReproduceInfoPrinter extends RunListener {
|
|||
}
|
||||
|
||||
public ReproduceErrorMessageBuilder appendESProperties() {
|
||||
appendProperties("es.logger.level", "es.node.mode", "es.node.local", TestCluster.TESTS_ENABLE_MOCK_MODULES,
|
||||
appendProperties("es.logger.level", "es.node.mode", "es.node.local", TESTS_CLUSTER, TestCluster.TESTS_ENABLE_MOCK_MODULES,
|
||||
"tests.assertion.disabled", "tests.security.manager", "tests.nighly", "tests.jvms", "tests.client.ratio", "tests.heap.size");
|
||||
if (System.getProperty("tests.jvm.argline") != null && !System.getProperty("tests.jvm.argline").isEmpty()) {
|
||||
appendOpt("tests.jvm.argline", "\"" + System.getProperty("tests.jvm.argline") + "\"");
|
||||
|
|
Loading…
Reference in New Issue