Randomize node level setting per node not per cluster
This commit is contained in:
parent
f52a080eec
commit
11ceaccc20
|
@ -70,7 +70,6 @@ public class IndexGatewayTests extends ElasticsearchIntegrationTest {
|
|||
if (between(0, 5) == 0) {
|
||||
builder.put("gateway.fs.chunk_size", between(1, 100) + "kb");
|
||||
}
|
||||
|
||||
builder.put("index.number_of_replicas", "1");
|
||||
builder.put("index.number_of_shards", rarely() ? Integer.toString(between(2, 6)) : "1");
|
||||
storeType = rarely() ? "ram" : "fs";
|
||||
|
|
|
@ -150,6 +150,43 @@ public final class TestCluster implements Iterable<Client> {
|
|||
sharedNodesSeeds[i] = random.nextLong();
|
||||
}
|
||||
logger.info("Setup TestCluster [{}] with seed [{}] using [{}] nodes", clusterName, SeedUtils.formatSeed(clusterSeed), numSharedNodes);
|
||||
this.nodeSettingsSource = nodeSettingsSource;
|
||||
Builder builder = ImmutableSettings.settingsBuilder();
|
||||
// randomize (multi/single) data path, special case for 0, don't set it at all...
|
||||
int numOfDataPaths = random.nextInt(5);
|
||||
if (numOfDataPaths > 0) {
|
||||
StringBuilder dataPath = new StringBuilder();
|
||||
for (int i = 0; i < numOfDataPaths; i++) {
|
||||
dataPath.append("data/d").append(i).append(',');
|
||||
}
|
||||
builder.put("path.data", dataPath.toString());
|
||||
}
|
||||
defaultSettings = builder.build();
|
||||
|
||||
}
|
||||
|
||||
private static boolean isLocalTransportConfigured() {
|
||||
if ("local".equals(System.getProperty("es.node.mode", "network"))) {
|
||||
return true;
|
||||
}
|
||||
return Boolean.parseBoolean(System.getProperty("es.node.local", "false"));
|
||||
}
|
||||
|
||||
private Settings getSettings(int nodeOrdinal, long nodeSeed, Settings others) {
|
||||
Builder builder = ImmutableSettings.settingsBuilder().put(defaultSettings)
|
||||
.put(getRandomNodeSettings(nodeSeed, clusterName));
|
||||
Settings settings = nodeSettingsSource.settings(nodeOrdinal);
|
||||
if (settings != null) {
|
||||
builder.put(settings);
|
||||
}
|
||||
if (others != null) {
|
||||
builder.put(others);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private static Settings getRandomNodeSettings(long seed, String clusterName) {
|
||||
Random random = new Random(seed);
|
||||
Builder builder = ImmutableSettings.settingsBuilder()
|
||||
/* use RAM directories in 10% of the runs */
|
||||
//.put("index.store.type", random.nextInt(10) == 0 ? MockRamIndexStoreModule.class.getName() : MockFSIndexStoreModule.class.getName())
|
||||
|
@ -165,37 +202,7 @@ public final class TestCluster implements Iterable<Client> {
|
|||
} else {
|
||||
builder.put(Transport.TransportSettings.TRANSPORT_TCP_COMPRESS, random.nextInt(10) == 0);
|
||||
}
|
||||
// randomize (multi/single) data path, special case for 0, don't set it at all...
|
||||
int numOfDataPaths = random.nextInt(5);
|
||||
if (numOfDataPaths > 0) {
|
||||
StringBuilder dataPath = new StringBuilder();
|
||||
for (int i = 0; i < numOfDataPaths; i++) {
|
||||
dataPath.append("data/d").append(i).append(',');
|
||||
}
|
||||
builder.put("path.data", dataPath.toString());
|
||||
}
|
||||
builder.put("type", CacheRecycler.Type.values()[random.nextInt(CacheRecycler.Type.values().length)]);
|
||||
|
||||
this.defaultSettings = builder.build();
|
||||
this.nodeSettingsSource = nodeSettingsSource;
|
||||
}
|
||||
|
||||
private static boolean isLocalTransportConfigured() {
|
||||
if ("local".equals(System.getProperty("es.node.mode", "network"))) {
|
||||
return true;
|
||||
}
|
||||
return Boolean.parseBoolean(System.getProperty("es.node.local", "false"));
|
||||
}
|
||||
|
||||
private Settings getSettings(int nodeOrdinal, Settings others) {
|
||||
Builder builder = ImmutableSettings.settingsBuilder().put(defaultSettings);
|
||||
Settings settings = nodeSettingsSource.settings(nodeOrdinal);
|
||||
if (settings != null) {
|
||||
builder.put(settings);
|
||||
}
|
||||
if (others != null) {
|
||||
builder.put(others);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
@ -298,7 +305,7 @@ public final class TestCluster implements Iterable<Client> {
|
|||
|
||||
private NodeAndClient buildNode(int nodeId, long seed, Settings settings) {
|
||||
ensureOpen();
|
||||
settings = getSettings(nodeId, settings);
|
||||
settings = getSettings(nodeId, seed, settings);
|
||||
String name = buildNodeName(nodeId);
|
||||
assert !nodes.containsKey(name);
|
||||
Settings finalSettings = settingsBuilder()
|
||||
|
@ -616,7 +623,7 @@ public final class TestCluster implements Iterable<Client> {
|
|||
NodeAndClient nodeAndClient = nodes.get(buildNodeName);
|
||||
if (nodeAndClient == null) {
|
||||
changed = true;
|
||||
nodeAndClient = buildNode(i, sharedNodesSeeds[i], defaultSettings);
|
||||
nodeAndClient = buildNode(i, sharedNodesSeeds[i], null);
|
||||
nodeAndClient.node.start();
|
||||
logger.info("Start Shared Node [{}] not shared", nodeAndClient.name);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue