Tests: Compare the length of cluster states serialized as a String, not the binary representation.

Due to the fact that the binary representation uses some compression, we can't
be sure that they will be equal even if they store the same content.
This commit is contained in:
Adrien Grand 2015-05-20 12:05:04 +02:00
parent 51c9f73947
commit 42ad677127
1 changed files with 2 additions and 2 deletions

View File

@ -1170,7 +1170,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
// remove local node reference
masterClusterState = ClusterState.Builder.fromBytes(masterClusterStateBytes, null);
Map<String, Object> masterStateMap = convertToMap(masterClusterState);
int masterClusterStateSize = ClusterState.Builder.toBytes(masterClusterState).length;
int masterClusterStateSize = masterClusterState.toString().length();
String masterId = masterClusterState.nodes().masterNodeId();
for (Client client : cluster()) {
ClusterState localClusterState = client.admin().cluster().prepareState().all().setLocal(true).get().getState();
@ -1178,7 +1178,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
// remove local node reference
localClusterState = ClusterState.Builder.fromBytes(localClusterStateBytes, null);
Map<String, Object> localStateMap = convertToMap(localClusterState);
int localClusterStateSize = localClusterStateBytes.length;
int localClusterStateSize = localClusterState.toString().length();
// 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 {