From 364de19251730514d96180bb922c26e6a0d9a724 Mon Sep 17 00:00:00 2001 From: Britta Weber Date: Tue, 16 Sep 2014 10:06:09 +0200 Subject: [PATCH] [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. --- src/test/java/org/elasticsearch/test/CompositeTestCluster.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/java/org/elasticsearch/test/CompositeTestCluster.java b/src/test/java/org/elasticsearch/test/CompositeTestCluster.java index ef4c762b48f..b9d855b2af6 100644 --- a/src/test/java/org/elasticsearch/test/CompositeTestCluster.java +++ b/src/test/java/org/elasticsearch/test/CompositeTestCluster.java @@ -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;