|
20 | 20 | package org.elasticsearch.snapshots;
|
21 | 21 |
|
22 | 22 | import org.apache.lucene.util.SetOnce;
|
| 23 | +import org.elasticsearch.ElasticsearchException; |
23 | 24 | import org.elasticsearch.ExceptionsHelper;
|
24 | 25 | import org.elasticsearch.Version;
|
25 | 26 | import org.elasticsearch.action.ActionFuture;
|
@@ -768,7 +769,7 @@ public void testIncludeGlobalState() throws Exception {
|
768 | 769 |
|
769 | 770 | }
|
770 | 771 |
|
771 |
| - public void testSnapshotFileFailureDuringSnapshot() throws Exception { |
| 772 | + public void testSnapshotFileFailureDuringSnapshot() { |
772 | 773 | Client client = client();
|
773 | 774 |
|
774 | 775 | logger.info("--> creating repository");
|
@@ -817,8 +818,12 @@ public void testSnapshotFileFailureDuringSnapshot() throws Exception {
|
817 | 818 | } catch (Exception ex) {
|
818 | 819 | logger.info("--> caught a top level exception, asserting what's expected", ex);
|
819 | 820 | assertThat(getFailureCount("test-repo"), greaterThan(0L));
|
820 |
| - assertThat(ex.getCause(), notNullValue()); |
821 |
| - assertThat(ex.getCause().getMessage(), containsString("Random IOException")); |
| 821 | + |
| 822 | + final Throwable cause = ex.getCause(); |
| 823 | + assertThat(cause, notNullValue()); |
| 824 | + final Throwable rootCause = new ElasticsearchException(cause).getRootCause(); |
| 825 | + assertThat(rootCause, notNullValue()); |
| 826 | + assertThat(rootCause.getMessage(), containsString("Random IOException")); |
822 | 827 | }
|
823 | 828 | }
|
824 | 829 |
|
|
0 commit comments