[TEST] Reduce possible number of indices in the test - 10 indices can create tons of shards
This commit is contained in:
parent
43a1435d3b
commit
fe762c0eb5
|
@ -54,9 +54,9 @@ public class PreBuiltAnalyzerIntegrationTests extends ElasticsearchIntegrationTe
|
||||||
@Test
|
@Test
|
||||||
public void testThatPreBuiltAnalyzersAreNotClosedOnIndexClose() throws Exception {
|
public void testThatPreBuiltAnalyzersAreNotClosedOnIndexClose() throws Exception {
|
||||||
Map<PreBuiltAnalyzers, List<Version>> loadedAnalyzers = Maps.newHashMap();
|
Map<PreBuiltAnalyzers, List<Version>> loadedAnalyzers = Maps.newHashMap();
|
||||||
|
|
||||||
List<String> indexNames = Lists.newArrayList();
|
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);
|
String indexName = randomAsciiOfLength(10).toLowerCase(Locale.ROOT);
|
||||||
indexNames.add(indexName);
|
indexNames.add(indexName);
|
||||||
|
|
||||||
|
@ -87,13 +87,14 @@ public class PreBuiltAnalyzerIntegrationTests extends ElasticsearchIntegrationTe
|
||||||
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
|
final int numDocs = randomIntBetween(10, 100);
|
||||||
// index some amount of data
|
// 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 randomIndex = indexNames.get(randomInt(indexNames.size()-1));
|
||||||
String randomId = randomInt() + "";
|
String randomId = randomInt() + "";
|
||||||
|
|
||||||
Map<String, Object> data = Maps.newHashMap();
|
Map<String, Object> data = Maps.newHashMap();
|
||||||
data.put("foo", randomAsciiOfLength(50));
|
data.put("foo", randomAsciiOfLength(scaledRandomIntBetween(5, 50)));
|
||||||
|
|
||||||
index(randomIndex, "type", randomId, data);
|
index(randomIndex, "type", randomId, data);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +102,7 @@ public class PreBuiltAnalyzerIntegrationTests extends ElasticsearchIntegrationTe
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
// close some of the indices
|
// close some of the indices
|
||||||
int amountOfIndicesToClose = randomInt(10-1);
|
int amountOfIndicesToClose = randomInt(numIndices-1);
|
||||||
for (int i = 0; i < amountOfIndicesToClose; i++) {
|
for (int i = 0; i < amountOfIndicesToClose; i++) {
|
||||||
String indexName = indexNames.get(i);
|
String indexName = indexNames.get(i);
|
||||||
client().admin().indices().prepareClose(indexName).execute().actionGet();
|
client().admin().indices().prepareClose(indexName).execute().actionGet();
|
||||||
|
|
Loading…
Reference in New Issue