diff --git a/server/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java b/server/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java index 944917719b673..624e1f5c7c086 100644 --- a/server/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java +++ b/server/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java @@ -20,6 +20,7 @@ package org.elasticsearch.snapshots; import org.apache.lucene.util.SetOnce; +import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.Version; import org.elasticsearch.action.ActionFuture; @@ -768,7 +769,7 @@ public void testIncludeGlobalState() throws Exception { } - public void testSnapshotFileFailureDuringSnapshot() throws Exception { + public void testSnapshotFileFailureDuringSnapshot() { Client client = client(); logger.info("--> creating repository"); @@ -817,8 +818,12 @@ public void testSnapshotFileFailureDuringSnapshot() throws Exception { } catch (Exception ex) { logger.info("--> caught a top level exception, asserting what's expected", ex); assertThat(getFailureCount("test-repo"), greaterThan(0L)); - assertThat(ex.getCause(), notNullValue()); - assertThat(ex.getCause().getMessage(), containsString("Random IOException")); + + final Throwable cause = ex.getCause(); + assertThat(cause, notNullValue()); + final Throwable rootCause = new ElasticsearchException(cause).getRootCause(); + assertThat(rootCause, notNullValue()); + assertThat(rootCause.getMessage(), containsString("Random IOException")); } }