Skip to content

Commit

Permalink
Tests: Add back tests.cluster
Browse files Browse the repository at this point in the history
This setting is used by the release script to run rest tests against
the version being released.  It used to work only for tests using
the global cluster.  Now it supercedes both SUITE and TEST scope
test clusters.

closes elastic#9916
  • Loading branch information
rjernst committed Feb 27, 2015
1 parent 4ca57ab commit f87fa81
Showing 1 changed file with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,8 @@ public boolean apply(Object o) {
*/
public void setMinimumMasterNodes(int n) {
assertTrue(client().admin().cluster().prepareUpdateSettings().setTransientSettings(
settingsBuilder().put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, n))
.get().isAcknowledged());
settingsBuilder().put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, n))
.get().isAcknowledged());
}

/**
Expand Down Expand Up @@ -1593,8 +1593,34 @@ protected Settings nodeSettings(int nodeOrdinal) {
protected Settings transportClientSettings() {
return ImmutableSettings.EMPTY;
}

private ExternalTestCluster buildExternalCluster(String clusterAddresses) {
String[] stringAddresses = clusterAddresses.split(",");
TransportAddress[] transportAddresses = new TransportAddress[stringAddresses.length];
int i = 0;
for (String stringAddress : stringAddresses) {
String[] split = stringAddress.split(":");
if (split.length < 2) {
throw new IllegalArgumentException("address [" + clusterAddresses + "] not valid");
}
try {
transportAddresses[i++] = new InetSocketTransportAddress(split[0], Integer.valueOf(split[1]));
} catch (NumberFormatException e) {
throw new IllegalArgumentException("port is not valid, expected number but was [" + split[1] + "]");
}
}
return new ExternalTestCluster(transportAddresses);
}

protected TestCluster buildTestCluster(Scope scope, long seed) throws IOException {
String clusterAddresses = System.getProperty(TESTS_CLUSTER);
if (Strings.hasLength(clusterAddresses)) {
if (scope == Scope.TEST) {
throw new IllegalArgumentException("Cannot run TEST scope test with " + TESTS_CLUSTER);
}
return buildExternalCluster(clusterAddresses);
}

final String nodePrefix;
switch (scope) {
case TEST:
Expand Down

0 comments on commit f87fa81

Please sign in to comment.