Respond to rename random ASCII helper methods

This commit is response to the renaming of the random ASCII helper
methods in ESTestCase. The name of this method was changed because these
methods only produce random strings generated from [a-zA-Z], not from
all ASCII characters.
This commit is contained in:
Jason Tedor 2017-04-04 11:04:37 -04:00 committed by Martijn van Groningen
parent 5b45b167bd
commit 97822dbea3
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
4 changed files with 19 additions and 19 deletions

View File

@ -271,7 +271,7 @@ public class PersistentTasksClusterServiceTests extends ESTestCase {
// add a node if there are unassigned tasks
if (clusterState.nodes().getNodes().isEmpty()) {
logger.info("added random node");
builder.nodes(DiscoveryNodes.builder(clusterState.nodes()).add(newNode(randomAsciiOfLength(10))));
builder.nodes(DiscoveryNodes.builder(clusterState.nodes()).add(newNode(randomAlphaOfLength(10))));
tasksOrNodesChanged = true;
}
@ -317,7 +317,7 @@ public class PersistentTasksClusterServiceTests extends ESTestCase {
// we don't have any unassigned tasks - adding a node or changing a routing table shouldn't affect anything
if (randomBoolean()) {
logger.info("added random node");
builder.nodes(DiscoveryNodes.builder(clusterState.nodes()).add(newNode(randomAsciiOfLength(10))));
builder.nodes(DiscoveryNodes.builder(clusterState.nodes()).add(newNode(randomAlphaOfLength(10))));
}
if (randomBoolean()) {
logger.info("added random unassignable task");
@ -365,7 +365,7 @@ public class PersistentTasksClusterServiceTests extends ESTestCase {
}
}
// Just add a random index - that shouldn't change anything
IndexMetaData indexMetaData = IndexMetaData.builder(randomAsciiOfLength(10))
IndexMetaData indexMetaData = IndexMetaData.builder(randomAlphaOfLength(10))
.settings(Settings.builder().put("index.version.created", VersionUtils.randomVersion(random())))
.numberOfShards(1)
.numberOfReplicas(1)
@ -395,15 +395,15 @@ public class PersistentTasksClusterServiceTests extends ESTestCase {
private ClusterState.Builder addRandomTask(ClusterState.Builder clusterStateBuilder,
MetaData.Builder metaData, PersistentTasksCustomMetaData.Builder tasks,
String node) {
return addRandomTask(clusterStateBuilder, metaData, tasks, new Assignment(node, randomAsciiOfLength(10)),
randomAsciiOfLength(10));
return addRandomTask(clusterStateBuilder, metaData, tasks, new Assignment(node, randomAlphaOfLength(10)),
randomAlphaOfLength(10));
}
private ClusterState.Builder addRandomTask(ClusterState.Builder clusterStateBuilder,
MetaData.Builder metaData, PersistentTasksCustomMetaData.Builder tasks,
Assignment assignment, String param) {
return clusterStateBuilder.metaData(metaData.putCustom(PersistentTasksCustomMetaData.TYPE,
tasks.addTask(randomAsciiOfLength(10), new TestRequest(param), assignment).build()));
tasks.addTask(randomAlphaOfLength(10), new TestRequest(param), assignment).build()));
}
private void addTask(PersistentTasksCustomMetaData.Builder tasks, String action, String param, String node) {
@ -437,7 +437,7 @@ public class PersistentTasksClusterServiceTests extends ESTestCase {
}
private void changeRoutingTable(MetaData.Builder metaData, RoutingTable.Builder routingTable) {
IndexMetaData indexMetaData = IndexMetaData.builder(randomAsciiOfLength(10))
IndexMetaData indexMetaData = IndexMetaData.builder(randomAlphaOfLength(10))
.settings(Settings.builder().put("index.version.created", VersionUtils.randomVersion(random())))
.numberOfShards(1)
.numberOfReplicas(1)

View File

@ -57,11 +57,11 @@ public class PersistentTasksCustomMetaDataTests extends AbstractDiffableSerializ
int numberOfTasks = randomInt(10);
PersistentTasksCustomMetaData.Builder tasks = PersistentTasksCustomMetaData.builder();
for (int i = 0; i < numberOfTasks; i++) {
tasks.addTask(TestPersistentTasksExecutor.NAME, new TestRequest(randomAsciiOfLength(10)),
tasks.addTask(TestPersistentTasksExecutor.NAME, new TestRequest(randomAlphaOfLength(10)),
randomAssignment());
if (randomBoolean()) {
// From time to time update status
tasks.updateTaskStatus(tasks.getCurrentId(), new Status(randomAsciiOfLength(10)));
tasks.updateTaskStatus(tasks.getCurrentId(), new Status(randomAlphaOfLength(10)));
}
}
return tasks.build();
@ -101,7 +101,7 @@ public class PersistentTasksCustomMetaDataTests extends AbstractDiffableSerializ
if (tasksInProgress.tasks().isEmpty()) {
addRandomTask(builder);
} else {
builder.updateTaskStatus(pickRandomTask(tasksInProgress), randomBoolean() ? new Status(randomAsciiOfLength(10)) : null);
builder.updateTaskStatus(pickRandomTask(tasksInProgress), randomBoolean() ? new Status(randomAlphaOfLength(10)) : null);
}
break;
case 3:
@ -148,7 +148,7 @@ public class PersistentTasksCustomMetaDataTests extends AbstractDiffableSerializ
}
private Builder addRandomTask(Builder builder) {
builder.addTask(TestPersistentTasksExecutor.NAME, new TestRequest(randomAsciiOfLength(10)), randomAssignment());
builder.addTask(TestPersistentTasksExecutor.NAME, new TestRequest(randomAlphaOfLength(10)), randomAssignment());
return builder;
}
@ -247,7 +247,7 @@ public class PersistentTasksCustomMetaDataTests extends AbstractDiffableSerializ
if (builder.hasTask(lastKnownTask)) {
changed = true;
}
builder.updateTaskStatus(lastKnownTask, randomBoolean() ? new Status(randomAsciiOfLength(10)) : null);
builder.updateTaskStatus(lastKnownTask, randomBoolean() ? new Status(randomAlphaOfLength(10)) : null);
break;
case 4:
if (builder.hasTask(lastKnownTask)) {
@ -274,9 +274,9 @@ public class PersistentTasksCustomMetaDataTests extends AbstractDiffableSerializ
if (randomBoolean()) {
return NO_NODE_FOUND;
} else {
return new Assignment(null, randomAsciiOfLength(10));
return new Assignment(null, randomAlphaOfLength(10));
}
}
return new Assignment(randomAsciiOfLength(10), randomAsciiOfLength(10));
return new Assignment(randomAlphaOfLength(10), randomAlphaOfLength(10));
}
}

View File

@ -33,15 +33,15 @@ public class StartPersistentActionRequestTests extends AbstractStreamableTestCas
protected Request createTestInstance() {
TestRequest testRequest = new TestRequest();
if (randomBoolean()) {
testRequest.setTestParam(randomAsciiOfLengthBetween(1, 20));
testRequest.setTestParam(randomAlphaOfLengthBetween(1, 20));
}
if (randomBoolean()) {
testRequest.setParentTask(randomAsciiOfLengthBetween(1, 20), randomLong());
testRequest.setParentTask(randomAlphaOfLengthBetween(1, 20), randomLong());
}
if (randomBoolean()) {
testRequest.setExecutorNodeAttr(randomAsciiOfLengthBetween(1, 20));
testRequest.setExecutorNodeAttr(randomAlphaOfLengthBetween(1, 20));
}
return new Request(randomAsciiOfLengthBetween(1, 20), new TestRequest());
return new Request(randomAlphaOfLengthBetween(1, 20), new TestRequest());
}
@Override

View File

@ -30,7 +30,7 @@ public class UpdatePersistentTaskRequestTests extends AbstractStreamableTestCase
@Override
protected Request createTestInstance() {
return new Request(randomLong(), randomLong(), new Status(randomAsciiOfLength(10)));
return new Request(randomLong(), randomLong(), new Status(randomAlphaOfLength(10)));
}
@Override