Merge pull request #12155 from jaymode/external_test_cluster_settings

allow settings to be passed to client for external test cluster
This commit is contained in:
Jay Modi 2015-07-09 09:57:17 -04:00
commit 15d62713b1
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)