From 0b45fb98b97e43ddccba7bf511859563a46d5c19 Mon Sep 17 00:00:00 2001 From: Andrey Ershov Date: Wed, 28 Nov 2018 14:49:07 +0100 Subject: [PATCH] [Zen2] Generate coordinationMetaData with different configs (#35991) This PR fixes test failure, which is caused by equal randomly generated lastAcceptedConfiguration and lastCommittedConfguration. --- .../gateway/GatewayMetaStatePersistedStateTests.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/test/java/org/elasticsearch/gateway/GatewayMetaStatePersistedStateTests.java b/server/src/test/java/org/elasticsearch/gateway/GatewayMetaStatePersistedStateTests.java index 3c0c3b2c75f..c7bceb17831 100644 --- a/server/src/test/java/org/elasticsearch/gateway/GatewayMetaStatePersistedStateTests.java +++ b/server/src/test/java/org/elasticsearch/gateway/GatewayMetaStatePersistedStateTests.java @@ -221,7 +221,12 @@ public class GatewayMetaStatePersistedStateTests extends ESTestCase { public void testMarkAcceptedConfigAsCommitted() throws IOException { GatewayMetaStateUT gateway = newGateway(); - CoordinationMetaData coordinationMetaData = createCoordinationMetaData(randomNonNegativeLong()); + //generate random coordinationMetaData with different lastAcceptedConfiguration and lastCommittedConfiguration + CoordinationMetaData coordinationMetaData; + do { + coordinationMetaData = createCoordinationMetaData(randomNonNegativeLong()); + } while (coordinationMetaData.getLastAcceptedConfiguration().equals(coordinationMetaData.getLastCommittedConfiguration())); + ClusterState state = createClusterState(randomNonNegativeLong(), MetaData.builder().coordinationMetaData(coordinationMetaData).build()); gateway.setLastAcceptedState(state);