diff --git a/src/test/java/org/elasticsearch/test/integration/AbstractSharedClusterTest.java b/src/test/java/org/elasticsearch/test/integration/AbstractSharedClusterTest.java index 9e10229b078..b5d0adbb3a5 100644 --- a/src/test/java/org/elasticsearch/test/integration/AbstractSharedClusterTest.java +++ b/src/test/java/org/elasticsearch/test/integration/AbstractSharedClusterTest.java @@ -275,7 +275,7 @@ public abstract class AbstractSharedClusterTest extends ElasticsearchTestCase { public ClusterHealthStatus ensureGreen() { ClusterHealthResponse actionGet = client().admin().cluster() - .health(Requests.clusterHealthRequest().waitForGreenStatus().waitForEvents(Priority.LANGUID)).actionGet(); + .health(Requests.clusterHealthRequest().waitForGreenStatus().waitForEvents(Priority.LANGUID).waitForRelocatingShards(0)).actionGet(); assertThat(actionGet.isTimedOut(), equalTo(false)); assertThat(actionGet.getStatus(), equalTo(ClusterHealthStatus.GREEN)); return actionGet.getStatus(); @@ -324,6 +324,7 @@ public abstract class AbstractSharedClusterTest extends ElasticsearchTestCase { } protected RefreshResponse refresh() { + waitForRelocation(); // TODO RANDOMIZE with flush? RefreshResponse actionGet = client().admin().indices().prepareRefresh().execute().actionGet(); assertNoFailures(actionGet); @@ -331,12 +332,14 @@ public abstract class AbstractSharedClusterTest extends ElasticsearchTestCase { } protected FlushResponse flush() { + waitForRelocation(); FlushResponse actionGet = client().admin().indices().prepareFlush().setRefresh(true).execute().actionGet(); assertNoFailures(actionGet); return actionGet; } protected OptimizeResponse optimize() { + waitForRelocation(); OptimizeResponse actionGet = client().admin().indices().prepareOptimize().execute().actionGet(); assertNoFailures(actionGet); return actionGet; diff --git a/src/test/java/org/elasticsearch/test/integration/search/highlight/HighlighterSearchTests.java b/src/test/java/org/elasticsearch/test/integration/search/highlight/HighlighterSearchTests.java index f492fd14bcb..e9d7ec47027 100644 --- a/src/test/java/org/elasticsearch/test/integration/search/highlight/HighlighterSearchTests.java +++ b/src/test/java/org/elasticsearch/test/integration/search/highlight/HighlighterSearchTests.java @@ -297,7 +297,7 @@ public class HighlighterSearchTests extends AbstractSharedClusterTest { .endObject()) .execute().actionGet(); refresh(); - ensureYellow(); + ensureGreen(); SearchResponse search = client().prepareSearch().setQuery(matchQuery("name", "logica m")).addHighlightedField("name").execute().actionGet(); assertHighlight(search, 0, "name", 0, equalTo("logicacmg ehemals avinci - the know how company"));