[TEST] Verify that all pending tasks are rely executed on *all* nodes.

This commit is contained in:
Martijn van Groningen 2014-06-20 23:12:52 +02:00
parent 73e4a9b3f7
commit 11251bca92
1 changed files with 11 additions and 6 deletions

View File

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