add wait for green to prevent test failure

This commit is contained in:
Britta Weber 2013-09-13 14:50:51 +02:00
parent a6fffae6df
commit e3b826f87e
1 changed files with 2 additions and 1 deletions

View File

@ -20,6 +20,7 @@
package org.elasticsearch.cluster;
import com.google.common.base.Predicate;
import org.elasticsearch.AbstractNodesTests;
import org.elasticsearch.action.percolate.PercolateSourceBuilder;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.common.settings.Settings;
@ -28,7 +29,6 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.discovery.Discovery;
import org.elasticsearch.node.Node;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.AbstractNodesTests;
import org.junit.After;
import org.junit.Test;
@ -64,6 +64,7 @@ public class NoMasterNodeTests extends AbstractNodesTests {
// start a second node, create an index, and then shut it down so we have no master block
Node node2 = startNode("node2", settings);
node.client().admin().indices().prepareCreate("test").execute().actionGet();
node.client().admin().cluster().prepareHealth("test").setWaitForGreenStatus().execute().actionGet();
node2.close();
awaitBusy(new Predicate<Object>() {
public boolean apply(Object o) {