From 8e5543dea05124f99552912c1c445add2e122dde Mon Sep 17 00:00:00 2001 From: Igor Motov Date: Tue, 28 Apr 2015 15:59:57 -0400 Subject: [PATCH] Test: ignore cluster state differences on the nodes that disconnected from the master --- .../org/elasticsearch/test/ElasticsearchIntegrationTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java index f160e4cb653..187afe1b658 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java @@ -1150,6 +1150,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase masterClusterState = ClusterState.Builder.fromBytes(masterClusterStateBytes, null); Map masterStateMap = convertToMap(masterClusterState); int masterClusterStateSize = ClusterState.Builder.toBytes(masterClusterState).length; + String masterId = masterClusterState.nodes().masterNodeId(); for (Client client : cluster()) { ClusterState localClusterState = client.admin().cluster().prepareState().all().setLocal(true).get().getState(); byte[] localClusterStateBytes = ClusterState.Builder.toBytes(localClusterState); @@ -1157,7 +1158,8 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase localClusterState = ClusterState.Builder.fromBytes(localClusterStateBytes, null); Map localStateMap = convertToMap(localClusterState); int localClusterStateSize = localClusterStateBytes.length; - if (masterClusterState.version() == localClusterState.version()) { + // Check that the non-master node has the same version of the cluster state as the master and that this node didn't disconnect from the master + if (masterClusterState.version() == localClusterState.version() && localClusterState.nodes().nodes().containsKey(masterId)) { try { assertThat(masterClusterState.uuid(), equalTo(localClusterState.uuid())); // We cannot compare serialization bytes since serialization order of maps is not guaranteed