File tree 1 file changed +5
-1
lines changed
server/src/internalClusterTest/java/org/opensearch/action/admin/indices/create
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 73
73
import java .util .UUID ;
74
74
import java .util .concurrent .CountDownLatch ;
75
75
import java .util .concurrent .atomic .AtomicInteger ;
76
+ import java .util .concurrent .atomic .AtomicReference ;
76
77
import java .util .function .BiFunction ;
77
78
78
79
import static org .opensearch .cluster .metadata .IndexMetadata .SETTING_WAIT_FOR_ACTIVE_SHARDS ;
@@ -257,6 +258,7 @@ public void testCreateAndDeleteIndexConcurrently() throws InterruptedException {
257
258
synchronized (indexVersionLock ) { // not necessarily needed here but for completeness we lock here too
258
259
indexVersion .incrementAndGet ();
259
260
}
261
+ final AtomicReference <Exception > deleteFailure = new AtomicReference <>();
260
262
client ().admin ().indices ().prepareDelete ("test" ).execute (new ActionListener <AcknowledgedResponse >() { // this happens async!!!
261
263
@ Override
262
264
public void onResponse (AcknowledgedResponse deleteIndexResponse ) {
@@ -284,7 +286,8 @@ public void run() {
284
286
285
287
@ Override
286
288
public void onFailure (Exception e ) {
287
- throw new RuntimeException (e );
289
+ deleteFailure .set (e );
290
+ latch .countDown ();
288
291
}
289
292
});
290
293
numDocs = randomIntBetween (100 , 200 );
@@ -304,6 +307,7 @@ public void onFailure(Exception e) {
304
307
}
305
308
}
306
309
latch .await ();
310
+ assertNull (deleteFailure .get ());
307
311
refresh ();
308
312
309
313
// we only really assert that we never reuse segments of old indices or anything like this here and that nothing fails with
You can’t perform that action at this time.
0 commit comments