[TEST] wait until all nodes have joined the cluster after upgrade

upgradeOneNode() only checked if the new node is in the nodes info.
However, this does not guarantee that all nodes have joined the cluster
already. For example the new node could be the master and might not yet
know about all nodes and the other nodes might not know about the new
master yet.
Depending on which client is picked later, the client might then try to
send request to the old node that was shut down instead of the new one.
Instead of just checking if the new node is in the nodes info we should
therefore also check if the all nodes are in the nodes info.
This commit is contained in:
Britta Weber 2014-09-16 10:06:09 +02:00
parent 76657251e0
commit 364de19251
1 changed files with 2 additions and 0 deletions

View File

@ -41,6 +41,7 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.Random;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoTimeout;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
@ -147,6 +148,7 @@ public class CompositeTestCluster extends TestCluster {
externalNode.stop();
String s = cluster.startNode(nodeSettings);
ExternalNode.waitForNode(existingClient, s);
assertNoTimeout(existingClient.admin().cluster().prepareHealth().setWaitForNodes(Integer.toString(size())).get());
return true;
}
return false;