Test: ignore cluster state differences on the nodes that disconnected from the master
This commit is contained in:
parent
bac135261c
commit
8e5543dea0
|
@ -1150,6 +1150,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
||||||
masterClusterState = ClusterState.Builder.fromBytes(masterClusterStateBytes, null);
|
masterClusterState = ClusterState.Builder.fromBytes(masterClusterStateBytes, null);
|
||||||
Map<String, Object> masterStateMap = convertToMap(masterClusterState);
|
Map<String, Object> masterStateMap = convertToMap(masterClusterState);
|
||||||
int masterClusterStateSize = ClusterState.Builder.toBytes(masterClusterState).length;
|
int masterClusterStateSize = ClusterState.Builder.toBytes(masterClusterState).length;
|
||||||
|
String masterId = masterClusterState.nodes().masterNodeId();
|
||||||
for (Client client : cluster()) {
|
for (Client client : cluster()) {
|
||||||
ClusterState localClusterState = client.admin().cluster().prepareState().all().setLocal(true).get().getState();
|
ClusterState localClusterState = client.admin().cluster().prepareState().all().setLocal(true).get().getState();
|
||||||
byte[] localClusterStateBytes = ClusterState.Builder.toBytes(localClusterState);
|
byte[] localClusterStateBytes = ClusterState.Builder.toBytes(localClusterState);
|
||||||
|
@ -1157,7 +1158,8 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
||||||
localClusterState = ClusterState.Builder.fromBytes(localClusterStateBytes, null);
|
localClusterState = ClusterState.Builder.fromBytes(localClusterStateBytes, null);
|
||||||
Map<String, Object> localStateMap = convertToMap(localClusterState);
|
Map<String, Object> localStateMap = convertToMap(localClusterState);
|
||||||
int localClusterStateSize = localClusterStateBytes.length;
|
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 {
|
try {
|
||||||
assertThat(masterClusterState.uuid(), equalTo(localClusterState.uuid()));
|
assertThat(masterClusterState.uuid(), equalTo(localClusterState.uuid()));
|
||||||
// We cannot compare serialization bytes since serialization order of maps is not guaranteed
|
// We cannot compare serialization bytes since serialization order of maps is not guaranteed
|
||||||
|
|
Loading…
Reference in New Issue