[Rollup] Don't randomize index name in test

The test job helper randomizes the index name with 1-10 characters,
which can lead to randomized index names to overlap and show fewer
caps than the test expects.

The solution is to just use index names "0"-"24" to ensure none
of the names overlap, and thus the caps don't overlap.

Original commit: elastic/x-pack-elasticsearch@74a6d13213
This commit is contained in:
polyfractal 2018-03-02 16:16:11 -08:00
parent 7fbe289d30
commit faac0d2a52
1 changed files with 4 additions and 1 deletions

View File

@ -139,12 +139,15 @@ public class GetRollupCapsActionRequestTests extends AbstractStreamableTestCase<
public void testAllIndices() throws IOException { public void testAllIndices() throws IOException {
int num = randomIntBetween(1,5); int num = randomIntBetween(1,5);
ImmutableOpenMap.Builder<String, IndexMetaData> indices = new ImmutableOpenMap.Builder<>(5); ImmutableOpenMap.Builder<String, IndexMetaData> indices = new ImmutableOpenMap.Builder<>(5);
int indexCounter = 0;
for (int j = 0; j < 5; j++) { for (int j = 0; j < 5; j++) {
Map<String, Object> jobs = new HashMap<>(num); Map<String, Object> jobs = new HashMap<>(num);
for (int i = 0; i < num; i++) { for (int i = 0; i < num; i++) {
String jobName = randomAlphaOfLength(10); String jobName = randomAlphaOfLength(10);
jobs.put(jobName, ConfigTestHelpers.getRollupJob(jobName).build()); String indexName = Integer.toString(indexCounter);
indexCounter += 1;
jobs.put(jobName, ConfigTestHelpers.getRollupJob(jobName).setIndexPattern(indexName).build());
} }
MappingMetaData mappingMeta = new MappingMetaData(RollupField.NAME, MappingMetaData mappingMeta = new MappingMetaData(RollupField.NAME,