diff --git a/src/test/java/org/elasticsearch/percolator/PercolatorTests.java b/src/test/java/org/elasticsearch/percolator/PercolatorTests.java index f3d9778787b..d3f22d80d6e 100644 --- a/src/test/java/org/elasticsearch/percolator/PercolatorTests.java +++ b/src/test/java/org/elasticsearch/percolator/PercolatorTests.java @@ -61,7 +61,6 @@ import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilde import static org.elasticsearch.common.xcontent.XContentFactory.*; import static org.elasticsearch.index.query.FilterBuilders.termFilter; import static org.elasticsearch.index.query.QueryBuilders.*; -import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.exponentialDecayFunction; import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.scriptFunction; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; import static org.hamcrest.Matchers.*; @@ -1768,15 +1767,21 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { assertThat(response.getMatches(), arrayWithSize(0)); // wait until the mapping change has propagated - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).execute().actionGet(); - awaitBusy(new Predicate() { + client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).get(); + boolean applied = awaitBusy(new Predicate() { @Override public boolean apply(Object input) { - PendingClusterTasksResponse pendingTasks = client().admin().cluster().preparePendingClusterTasks().get(); - return pendingTasks.pendingTasks().isEmpty(); + for (Client client : clients()) { + PendingClusterTasksResponse pendingTasks = client.admin().cluster().preparePendingClusterTasks().get(); + if (!pendingTasks.pendingTasks().isEmpty()) { + return false; + } + } + return true; } }); - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).execute().actionGet(); + assertThat(applied, is(true)); + client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).get(); GetMappingsResponse mappingsResponse = client().admin().indices().prepareGetMappings("test").get(); assertThat(mappingsResponse.getMappings().get("test"), notNullValue());