Testing: Fix running of rest tests against external cluster

The TransportClient specified in the ExternalCluster was missing a
`path.home` setting and thus would not start.
This commit is contained in:
Alexander Reelsen 2015-06-29 09:54:21 +02:00
parent 70fbc53869
commit 185dbac8fe
2 changed files with 4 additions and 2 deletions

View File

@ -1650,7 +1650,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
throw new IllegalArgumentException("port is not valid, expected number but was [" + split[1] + "]"); throw new IllegalArgumentException("port is not valid, expected number but was [" + split[1] + "]");
} }
} }
return new ExternalTestCluster(transportAddresses); return new ExternalTestCluster(createTempDir(), transportAddresses);
} }
protected TestCluster buildTestCluster(Scope scope, long seed) throws IOException { protected TestCluster buildTestCluster(Scope scope, long seed) throws IOException {

View File

@ -37,6 +37,7 @@ import org.elasticsearch.node.internal.InternalSettingsPreparer;
import java.io.IOException; import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.nio.file.Path;
import java.util.Iterator; import java.util.Iterator;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -64,12 +65,13 @@ public final class ExternalTestCluster extends TestCluster {
private final int numDataNodes; private final int numDataNodes;
private final int numMasterAndDataNodes; private final int numMasterAndDataNodes;
public ExternalTestCluster(TransportAddress... transportAddresses) { public ExternalTestCluster(Path tempDir, TransportAddress... transportAddresses) {
super(0); super(0);
Settings clientSettings = Settings.settingsBuilder() Settings clientSettings = Settings.settingsBuilder()
.put("name", InternalTestCluster.TRANSPORT_CLIENT_PREFIX + EXTERNAL_CLUSTER_PREFIX + counter.getAndIncrement()) .put("name", InternalTestCluster.TRANSPORT_CLIENT_PREFIX + EXTERNAL_CLUSTER_PREFIX + counter.getAndIncrement())
.put(InternalSettingsPreparer.IGNORE_SYSTEM_PROPERTIES_SETTING, true) // prevents any settings to be replaced by system properties. .put(InternalSettingsPreparer.IGNORE_SYSTEM_PROPERTIES_SETTING, true) // prevents any settings to be replaced by system properties.
.put("client.transport.ignore_cluster_name", true) .put("client.transport.ignore_cluster_name", true)
.put("path.home", tempDir)
.put("node.mode", "network").build(); // we require network here! .put("node.mode", "network").build(); // we require network here!
this.client = TransportClient.builder().settings(clientSettings).build().addTransportAddresses(transportAddresses); this.client = TransportClient.builder().settings(clientSettings).build().addTransportAddresses(transportAddresses);