[TEST] Wait for cluster consistency before tests starts

This commit is contained in:
Simon Willnauer 2014-07-03 11:55:40 +02:00
parent b9a09c2b06
commit 97793358ea
2 changed files with 5 additions and 1 deletions

View File

@ -209,6 +209,7 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa
@Test
public void testIndexUpgradeSingleNode() throws Exception {
assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder().put("index.routing.allocation.exclude._name", backwardsCluster().newNodePattern()).put(indexSettings())));
ensureYellow();
int numDocs = randomIntBetween(100, 150);
IndexRequestBuilder[] docs = new IndexRequestBuilder[numDocs];
for (int i = 0; i < numDocs; i++) {
@ -222,7 +223,7 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa
CountResponse countResponse = client().prepareCount().get();
assertHitCount(countResponse, numDocs);
backwardsCluster().upgradeOneNode();
ensureYellow("test");
ensureYellow();
if (randomBoolean()) {
for (int i = 0; i < numDocs; i++) {
docs[i] = client().prepareIndex("test", "type1", String.valueOf(i)).setSource("field1", English.intToEnglish(i));

View File

@ -75,6 +75,9 @@ public class CompositeTestCluster extends TestCluster {
}
externalNodes[i].reset(random.nextLong());
}
if (size() > 0) {
client().admin().cluster().prepareHealth().setWaitForNodes(">=" + Integer.toString(this.size())).get();
}
}
private Collection<ExternalNode> runningNodes() {