Wait for reloctations in utility methods
This commit is contained in:
parent
a4fc11b3d1
commit
25f19f8b87
|
@ -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;
|
||||
|
|
|
@ -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("<em>logica</em>c<em>m</em>g ehe<em>m</em>als avinci - the know how co<em>m</em>pany"));
|
||||
|
||||
|
|
Loading…
Reference in New Issue