From 9728119b82dff639d24b648841d85ad7c66f4fc9 Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Tue, 13 Nov 2018 20:57:50 +0100 Subject: [PATCH] [CI] AllocationIdIT testFailedRecoveryOnAllocateStalePrimaryRequiresAnotherAllocateStalePrimary failure Closes #35504 --- .../cluster/routing/AllocationIdIT.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/cluster/routing/AllocationIdIT.java b/server/src/test/java/org/elasticsearch/cluster/routing/AllocationIdIT.java index f9da7a1aa8e..c6d7f925a2c 100644 --- a/server/src/test/java/org/elasticsearch/cluster/routing/AllocationIdIT.java +++ b/server/src/test/java/org/elasticsearch/cluster/routing/AllocationIdIT.java @@ -224,15 +224,17 @@ public class AllocationIdIT extends ESIntegTestCase { } private void checkNoValidShardCopy(String indexName, ShardId shardId) throws Exception { - final ClusterAllocationExplanation explanation = - client().admin().cluster().prepareAllocationExplain() - .setIndex(indexName).setShard(shardId.id()).setPrimary(true) - .get().getExplanation(); + assertBusy(() -> { + final ClusterAllocationExplanation explanation = + client().admin().cluster().prepareAllocationExplain() + .setIndex(indexName).setShard(shardId.id()).setPrimary(true) + .get().getExplanation(); - final ShardAllocationDecision shardAllocationDecision = explanation.getShardAllocationDecision(); - assertThat(shardAllocationDecision.isDecisionTaken(), equalTo(true)); - assertThat(shardAllocationDecision.getAllocateDecision().getAllocationDecision(), - equalTo(AllocationDecision.NO_VALID_SHARD_COPY)); + final ShardAllocationDecision shardAllocationDecision = explanation.getShardAllocationDecision(); + assertThat(shardAllocationDecision.isDecisionTaken(), equalTo(true)); + assertThat(shardAllocationDecision.getAllocateDecision().getAllocationDecision(), + equalTo(AllocationDecision.NO_VALID_SHARD_COPY)); + }); } }