Wait for green status when index is created

This commit is contained in:
Martijn van Groningen 2013-08-02 20:56:54 +02:00
parent 263c5808bb
commit 5cf429d144
1 changed files with 3 additions and 1 deletions

View File

@ -123,6 +123,8 @@ public class MoreLikeThisActionTests extends AbstractSharedClusterTest {
.endObject()
.endObject().endObject().string();
client().admin().indices().prepareCreate("foo").addMapping("bar", mapping).execute().actionGet();
ensureGreen();
client().prepareIndex("foo", "bar", "1")
.setSource(jsonBuilder().startObject().startObject("foo").field("bar", "boz").endObject())
.setRouting("2")
@ -141,7 +143,7 @@ public class MoreLikeThisActionTests extends AbstractSharedClusterTest {
prepareCreate("foo", 2, ImmutableSettings.builder().put("index.number_of_replicas", 0)
.put("index.number_of_shards", 2))
.execute().actionGet();
client().admin().cluster().prepareHealth("foo").setWaitForGreenStatus().execute().actionGet();
ensureGreen();
client().prepareIndex("foo", "bar", "1")
.setSource(jsonBuilder().startObject().startObject("foo").field("bar", "boz").endObject())