Fix DestructiveOperationsIntegrationTests to wait for index to be allocated before closing

This commit is contained in:
Simon Willnauer 2014-01-14 19:38:39 +01:00
parent 9440655ab9
commit d1a4f889ae
1 changed files with 15 additions and 15 deletions

View File

@ -53,12 +53,12 @@ public class DestructiveOperationsIntegrationTests extends ElasticsearchIntegrat
try {
// should fail since index1 is the only index.
client().admin().indices().prepareDelete("i*").get();
assert false;
fail();
} catch (ElasticsearchIllegalArgumentException e) {}
try {
client().admin().indices().prepareDelete("_all").get();
assert false;
fail();
} catch (ElasticsearchIllegalArgumentException e) {}
settings = ImmutableSettings.builder()
@ -78,26 +78,26 @@ public class DestructiveOperationsIntegrationTests extends ElasticsearchIntegrat
assertAcked(client().admin().indices().prepareCreate("index1").get());
assertAcked(client().admin().indices().prepareCreate("1index").get());
ensureYellow();// wait for primaries to be allocated
// Should succeed, since no wildcards
assertAcked(client().admin().indices().prepareClose("1index").get());
try {
client().admin().indices().prepareClose("_all").get();
assert false;
fail();
} catch (ElasticsearchIllegalArgumentException e) {}
try {
assertAcked(client().admin().indices().prepareOpen("_all").get());
assert false;
fail();
} catch (ElasticsearchIllegalArgumentException e) {
}
try {
client().admin().indices().prepareClose("*").get();
assert false;
fail();
} catch (ElasticsearchIllegalArgumentException e) {}
try {
assertAcked(client().admin().indices().prepareOpen("*").get());
assert false;
fail();
} catch (ElasticsearchIllegalArgumentException e) {
}
@ -124,12 +124,12 @@ public class DestructiveOperationsIntegrationTests extends ElasticsearchIntegrat
try {
client().prepareDeleteByQuery("_all").setQuery(QueryBuilders.matchAllQuery()).get();
assert false;
fail();
} catch (ElasticsearchIllegalArgumentException e) {}
try {
client().prepareDeleteByQuery().setQuery(QueryBuilders.matchAllQuery()).get();
assert false;
fail();
} catch (ElasticsearchIllegalArgumentException e) {}
settings = ImmutableSettings.builder()
@ -157,12 +157,12 @@ public class DestructiveOperationsIntegrationTests extends ElasticsearchIntegrat
client().admin().indices().prepareDeleteMapping("1index").setType("1").get();
try {
client().admin().indices().prepareDeleteMapping("_all").setType("1").get();
assert false;
fail();
} catch (ElasticsearchIllegalArgumentException e) {}
try {
client().admin().indices().prepareDeleteMapping().setType("1").get();
assert false;
fail();
} catch (ElasticsearchIllegalArgumentException e) {}
settings = ImmutableSettings.builder()
@ -170,10 +170,10 @@ public class DestructiveOperationsIntegrationTests extends ElasticsearchIntegrat
.build();
assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(settings));
client().admin().indices().preparePutMapping("1index").setType("1").setSource("field1", "type=string").get();
client().admin().indices().prepareDeleteMapping().setType("1").get();
client().admin().indices().preparePutMapping("1index").setType("1").setSource("field1", "type=string").get();
client().admin().indices().prepareDeleteMapping("_all").setType("1").get();
assertAcked(client().admin().indices().preparePutMapping("1index").setType("1").setSource("field1", "type=string"));
assertAcked(client().admin().indices().prepareDeleteMapping().setType("1"));
assertAcked(client().admin().indices().preparePutMapping("1index").setType("1").setSource("field1", "type=string"));
assertAcked(client().admin().indices().prepareDeleteMapping("_all").setType("1"));
}
}