From 3ae4a714fc4eb55fa5a07779677e0affc39b1069 Mon Sep 17 00:00:00 2001 From: Nhat Nguyen Date: Thu, 24 Jan 2019 15:33:34 -0500 Subject: [PATCH] Relax cluster metadata version check If the in_sync_allocations of index-1 or index-2 is changed, the metadata version will be increased. This leads to the failure in the metadata version checks. We need to relax them. Closes #37820 --- .../elasticsearch/cluster/SimpleClusterStateIT.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/cluster/SimpleClusterStateIT.java b/server/src/test/java/org/elasticsearch/cluster/SimpleClusterStateIT.java index 45c4d5d3927f7..a22b3c42b931e 100644 --- a/server/src/test/java/org/elasticsearch/cluster/SimpleClusterStateIT.java +++ b/server/src/test/java/org/elasticsearch/cluster/SimpleClusterStateIT.java @@ -119,20 +119,19 @@ public void testMetadata() throws Exception { assertThat(clusterStateResponse.getState().metaData().indices().size(), is(0)); } - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37820") public void testMetadataVersion() { createIndex("index-1"); createIndex("index-2"); - long metadataVersion = client().admin().cluster().prepareState().get().getState().metaData().version(); - assertThat(metadataVersion, greaterThan(0L)); + long baselineVersion = client().admin().cluster().prepareState().get().getState().metaData().version(); + assertThat(baselineVersion, greaterThan(0L)); assertThat(client().admin().cluster().prepareState().setIndices("index-1").get().getState().metaData().version(), - equalTo(metadataVersion)); + greaterThanOrEqualTo(baselineVersion)); assertThat(client().admin().cluster().prepareState().setIndices("index-2").get().getState().metaData().version(), - equalTo(metadataVersion)); + greaterThanOrEqualTo(baselineVersion)); assertThat(client().admin().cluster().prepareState().setIndices("*").get().getState().metaData().version(), - equalTo(metadataVersion)); + greaterThanOrEqualTo(baselineVersion)); assertThat(client().admin().cluster().prepareState().setIndices("not-found").get().getState().metaData().version(), - equalTo(metadataVersion)); + greaterThanOrEqualTo(baselineVersion)); assertThat(client().admin().cluster().prepareState().clear().setMetaData(false).get().getState().metaData().version(), equalTo(0L)); }