allow settings to be passed to client for external test cluster

This change allows custom settings to be passed to the client for the external test cluster,
which is necessary when additional settings need to be passed to the client in order to
properly communicate with the external test cluster.
This commit is contained in:
jaymode 2015-07-09 09:27:47 -04:00
parent e406baf59e
commit a3e30a89a7
2 changed files with 7 additions and 2 deletions

View File

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

View File

@ -65,9 +65,10 @@ public final class ExternalTestCluster extends TestCluster {
private final int numDataNodes;
private final int numMasterAndDataNodes;
public ExternalTestCluster(Path tempDir, TransportAddress... transportAddresses) {
public ExternalTestCluster(Path tempDir, Settings additionalSettings, TransportAddress... transportAddresses) {
super(0);
Settings clientSettings = Settings.settingsBuilder()
.put(additionalSettings)
.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("client.transport.ignore_cluster_name", true)