Skip to content

Commit b34e7d4

Browse files
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
1 parent 0cc8770 commit b34e7d4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

server/src/test/java/org/elasticsearch/discovery/SnapshotDisruptionIT.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.elasticsearch.common.settings.Settings;
3535
import org.elasticsearch.common.unit.ByteSizeUnit;
3636
import org.elasticsearch.plugins.Plugin;
37+
import org.elasticsearch.snapshots.ConcurrentSnapshotExecutionException;
3738
import org.elasticsearch.snapshots.SnapshotInfo;
3839
import org.elasticsearch.snapshots.SnapshotMissingException;
3940
import org.elasticsearch.snapshots.SnapshotState;
@@ -165,11 +166,15 @@ public void clusterChanged(ClusterChangedEvent event) {
165166
try {
166167
future.get();
167168
} catch (Exception ex) {
168-
logger.info("--> got exception from hanged master", ex);
169169
Throwable cause = ex.getCause();
170-
assertThat(cause, instanceOf(MasterNotDiscoveredException.class));
171-
cause = cause.getCause();
172-
assertThat(cause, instanceOf(FailedToCommitClusterStateException.class));
170+
if (cause.getCause() instanceof ConcurrentSnapshotExecutionException) {
171+
logger.info("--> got exception from race in master operation retries");
172+
} else {
173+
logger.info("--> got exception from hanged master", ex);
174+
assertThat(cause, instanceOf(MasterNotDiscoveredException.class));
175+
cause = cause.getCause();
176+
assertThat(cause, instanceOf(FailedToCommitClusterStateException.class));
177+
}
173178
}
174179

175180
logger.info("--> verify that snapshot eventually will be created due to retries");

0 commit comments

Comments
 (0)