Skip to content

Commit 4992962

Browse files
authored
[7.17] Unwrap exception more tenaciously in testQueuedOperationsAndBrokenRepoOnMasterFailOver (#102352) (#102368)
* Unwrap exception more tenaciously in testQueuedOperationsAndBrokenRepoOnMasterFailOver (#102352) There can be more than 10 layers of wrapping RTEs, see #102351. As a workaround to address the test failure, this commit just manually unwraps them all. Closes #102348 * Fixup
1 parent b45d4c0 commit 4992962

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

server/src/internalClusterTest/java/org/elasticsearch/snapshots/ConcurrentSnapshotsIT.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.elasticsearch.test.ESIntegTestCase;
3737
import org.elasticsearch.test.disruption.NetworkDisruption;
3838
import org.elasticsearch.test.transport.MockTransportService;
39+
import org.elasticsearch.transport.RemoteTransportException;
3940

4041
import java.io.IOException;
4142
import java.nio.file.Files;
@@ -719,7 +720,18 @@ public void testQueuedOperationsAndBrokenRepoOnMasterFailOver() throws Exception
719720
ensureStableCluster(3);
720721

721722
awaitNoMoreRunningOperations();
722-
expectThrows(RepositoryException.class, deleteFuture::actionGet);
723+
RuntimeException innerException = expectThrows(ExecutionException.class, RuntimeException.class, deleteFuture::get);
724+
725+
// There may be many layers of RTE to unwrap here, see https://github.com/elastic/elasticsearch/issues/102351.
726+
// ExceptionsHelper#unwrapCause gives up at 10 layers of wrapping so we must unwrap more tenaciously by hand here:
727+
while (true) {
728+
if (innerException instanceof RemoteTransportException) {
729+
innerException = (RuntimeException) innerException.getCause();
730+
} else {
731+
assertThat(innerException, instanceOf(RepositoryException.class));
732+
break;
733+
}
734+
}
723735
}
724736

725737
public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOver() throws Exception {

0 commit comments

Comments
 (0)