diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/create/CreateIndexIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/create/CreateIndexIT.java index b41b3f07d3ac1..62e417014eb86 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/create/CreateIndexIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/create/CreateIndexIT.java @@ -73,6 +73,7 @@ import java.util.UUID; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiFunction; import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_WAIT_FOR_ACTIVE_SHARDS; @@ -257,6 +258,7 @@ public void testCreateAndDeleteIndexConcurrently() throws InterruptedException { synchronized (indexVersionLock) { // not necessarily needed here but for completeness we lock here too indexVersion.incrementAndGet(); } + final AtomicReference deleteFailure = new AtomicReference<>(); client().admin().indices().prepareDelete("test").execute(new ActionListener() { // this happens async!!! @Override public void onResponse(AcknowledgedResponse deleteIndexResponse) { @@ -284,7 +286,8 @@ public void run() { @Override public void onFailure(Exception e) { - throw new RuntimeException(e); + deleteFailure.set(e); + latch.countDown(); } }); numDocs = randomIntBetween(100, 200); @@ -304,6 +307,7 @@ public void onFailure(Exception e) { } } latch.await(); + assertNull(deleteFailure.get()); refresh(); // we only really assert that we never reuse segments of old indices or anything like this here and that nothing fails with