[TEST] Reduce possible number of indices in the test - 10 indices can create tons of shards

This commit is contained in:
Simon Willnauer 2014-11-27 23:04:40 +01:00
parent 43a1435d3b
commit fe762c0eb5
1 changed files with 6 additions and 5 deletions

View File

@ -54,9 +54,9 @@ public class PreBuiltAnalyzerIntegrationTests extends ElasticsearchIntegrationTe
@Test
public void testThatPreBuiltAnalyzersAreNotClosedOnIndexClose() throws Exception {
Map<PreBuiltAnalyzers, List<Version>> loadedAnalyzers = Maps.newHashMap();
List<String> indexNames = Lists.newArrayList();
for (int i = 0; i < 10; i++) {
final int numIndices = scaledRandomIntBetween(2, 4);
for (int i = 0; i < numIndices; i++) {
String indexName = randomAsciiOfLength(10).toLowerCase(Locale.ROOT);
indexNames.add(indexName);
@ -87,13 +87,14 @@ public class PreBuiltAnalyzerIntegrationTests extends ElasticsearchIntegrationTe
ensureGreen();
final int numDocs = randomIntBetween(10, 100);
// index some amount of data
for (int i = 0; i < 100; i++) {
for (int i = 0; i < numDocs; i++) {
String randomIndex = indexNames.get(randomInt(indexNames.size()-1));
String randomId = randomInt() + "";
Map<String, Object> data = Maps.newHashMap();
data.put("foo", randomAsciiOfLength(50));
data.put("foo", randomAsciiOfLength(scaledRandomIntBetween(5, 50)));
index(randomIndex, "type", randomId, data);
}
@ -101,7 +102,7 @@ public class PreBuiltAnalyzerIntegrationTests extends ElasticsearchIntegrationTe
refresh();
// close some of the indices
int amountOfIndicesToClose = randomInt(10-1);
int amountOfIndicesToClose = randomInt(numIndices-1);
for (int i = 0; i < amountOfIndicesToClose; i++) {
String indexName = indexNames.get(i);
client().admin().indices().prepareClose(indexName).execute().actionGet();