From b34e7d4f192c089c202465ecbe7aed730aaa1a02 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Sat, 5 Jan 2019 17:52:24 +0100 Subject: [PATCH] SNAPSHOT+TESTS: Relax Assertion in DisruptionIT (#37144) * The retries on the failing master can lead to concurrently trying to create and delete a snapshot, catch this for now to fix this test * closes #36779 --- .../discovery/SnapshotDisruptionIT.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/discovery/SnapshotDisruptionIT.java b/server/src/test/java/org/elasticsearch/discovery/SnapshotDisruptionIT.java index 48fb6947479..bc699c905c0 100644 --- a/server/src/test/java/org/elasticsearch/discovery/SnapshotDisruptionIT.java +++ b/server/src/test/java/org/elasticsearch/discovery/SnapshotDisruptionIT.java @@ -34,6 +34,7 @@ import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.plugins.Plugin; +import org.elasticsearch.snapshots.ConcurrentSnapshotExecutionException; import org.elasticsearch.snapshots.SnapshotInfo; import org.elasticsearch.snapshots.SnapshotMissingException; import org.elasticsearch.snapshots.SnapshotState; @@ -165,11 +166,15 @@ public class SnapshotDisruptionIT extends ESIntegTestCase { try { future.get(); } catch (Exception ex) { - logger.info("--> got exception from hanged master", ex); Throwable cause = ex.getCause(); - assertThat(cause, instanceOf(MasterNotDiscoveredException.class)); - cause = cause.getCause(); - assertThat(cause, instanceOf(FailedToCommitClusterStateException.class)); + if (cause.getCause() instanceof ConcurrentSnapshotExecutionException) { + logger.info("--> got exception from race in master operation retries"); + } else { + logger.info("--> got exception from hanged master", ex); + assertThat(cause, instanceOf(MasterNotDiscoveredException.class)); + cause = cause.getCause(); + assertThat(cause, instanceOf(FailedToCommitClusterStateException.class)); + } } logger.info("--> verify that snapshot eventually will be created due to retries");