[TEST] don't use multiple names (e.g. aliases) pointing to the same concrete index when using indexRandom

indexRandom will try to delete bogus documents multiple times since they get tracked by indexOrAlias/id, and after the actual deletion any other attempt throws error and fails the test
This commit is contained in:
javanna 2014-08-12 14:33:18 +02:00 committed by Luca Cavanna
parent 5d987ad5e2
commit 0ec7aa4492
1 changed files with 2 additions and 2 deletions

View File

@ -136,12 +136,12 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa
*/ */
@Test @Test
public void testIndexAndSearch() throws Exception { public void testIndexAndSearch() throws Exception {
assertAcked(prepareCreate("test").addAlias(new Alias("alias"))); createIndex("test");
int numDocs = randomIntBetween(10, 20); int numDocs = randomIntBetween(10, 20);
List<IndexRequestBuilder> builder = new ArrayList<>(); List<IndexRequestBuilder> builder = new ArrayList<>();
for (int i = 0; i < numDocs; i++) { for (int i = 0; i < numDocs; i++) {
String id = Integer.toString(i); String id = Integer.toString(i);
builder.add(client().prepareIndex(indexOrAlias(), "type1", id).setSource("field1", English.intToEnglish(i), "the_id", id)); builder.add(client().prepareIndex("test", "type1", id).setSource("field1", English.intToEnglish(i), "the_id", id));
} }
indexRandom(true, builder); indexRandom(true, builder);
for (int i = 0; i < numDocs; i++) { for (int i = 0; i < numDocs; i++) {