[TEST] Add back old way for naming clusters

This commit is contained in:
Simon Willnauer 2015-04-20 18:29:27 +02:00
parent 7ad138e17b
commit 24d1f595a5
3 changed files with 7 additions and 17 deletions

View File

@ -18,10 +18,7 @@
*/
package org.elasticsearch.test;
import com.carrotsearch.randomizedtesting.LifecycleScope;
import com.carrotsearch.randomizedtesting.RandomizedContext;
import com.carrotsearch.randomizedtesting.RandomizedTest;
import com.carrotsearch.randomizedtesting.Randomness;
import com.carrotsearch.randomizedtesting.*;
import com.carrotsearch.randomizedtesting.annotations.TestGroup;
import com.carrotsearch.randomizedtesting.generators.RandomInts;
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
@ -1709,9 +1706,8 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
minNumDataNodes = getMinNumDataNodes();
maxNumDataNodes = getMaxNumDataNodes();
}
return new InternalTestCluster(seed, createTempDir(), minNumDataNodes, maxNumDataNodes,
scope.name() + "-cluster", settingsSource, getNumClientNodes(),
InternalTestCluster.clusterName(scope.name(), seed) + "-cluster", settingsSource, getNumClientNodes(),
InternalTestCluster.DEFAULT_ENABLE_HTTP_PIPELINING, nodePrefix);
}

View File

@ -120,7 +120,7 @@ public abstract class ElasticsearchSingleNodeTest extends ElasticsearchTestCase
private static Node newNode() {
Node build = NodeBuilder.nodeBuilder().local(true).data(true).settings(ImmutableSettings.builder()
.put(ClusterName.SETTING, clusterName())
.put(ClusterName.SETTING, InternalTestCluster.clusterName("single-node-cluster", randomLong()))
.put("path.home", createTempDir())
.put("node.name", nodeName())
.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
@ -150,13 +150,6 @@ public abstract class ElasticsearchSingleNodeTest extends ElasticsearchTestCase
return "node_s_0";
}
/**
* Returns the name of the cluster used for the single test node.
*/
public static String clusterName() {
return "single-node-cluster";
}
/**
* Return a reference to the singleton node.
*/

View File

@ -471,10 +471,11 @@ public final class InternalTestCluster extends TestCluster {
return builder.build();
}
public static String clusterName(String prefix, String childVMId, long clusterSeed) {
public static String clusterName(String prefix, long clusterSeed) {
StringBuilder builder = new StringBuilder(prefix);
final int childVM = RandomizedTest.systemPropertyAsInt(SysGlobals.CHILDVM_SYSPROP_JVM_ID, 0);
builder.append('-').append(NetworkUtils.getLocalHostName("__default_host__"));
builder.append("-CHILD_VM=[").append(childVMId).append(']');
builder.append("-CHILD_VM=[").append(childVM).append(']');
builder.append("-CLUSTER_SEED=[").append(clusterSeed).append(']');
// if multiple maven task run on a single host we better have an identifier that doesn't rely on input params
builder.append("-HASH=[").append(SeedUtils.formatSeed(System.nanoTime())).append(']');