1313import org .elasticsearch .action .admin .indices .create .CreateIndexResponse ;
1414import org .elasticsearch .action .admin .indices .exists .indices .IndicesExistsResponse ;
1515import org .elasticsearch .action .admin .indices .readonly .AddIndexBlockRequestBuilder ;
16+ import org .elasticsearch .action .admin .indices .readonly .AddIndexBlockResponse ;
1617import org .elasticsearch .action .admin .indices .settings .put .UpdateSettingsRequestBuilder ;
1718import org .elasticsearch .action .index .IndexRequestBuilder ;
1819import org .elasticsearch .action .index .IndexResponse ;
2829import org .elasticsearch .index .IndexNotFoundException ;
2930import org .elasticsearch .test .BackgroundIndexer ;
3031import org .elasticsearch .test .ESIntegTestCase ;
32+ import org .elasticsearch .test .junit .annotations .TestLogging ;
3133
3234import java .util .ArrayList ;
3335import java .util .Arrays ;
@@ -362,14 +364,16 @@ public void testConcurrentAddBlock() throws InterruptedException {
362364 }
363365 }
364366
367+ @ TestLogging (
368+ reason = "https://github.com/elastic/elasticsearch/issues/74345" ,
369+ value = "org.elasticsearch.action.admin.indices.readonly:DEBUG,org.elasticsearch.cluster.metadata:DEBUG"
370+ )
365371 public void testAddBlockWhileIndexingDocuments () throws Exception {
366372 final String indexName = randomAlphaOfLength (10 ).toLowerCase (Locale .ROOT );
367373 createIndex (indexName );
368374
369375 final APIBlock block = randomAddableBlock ();
370-
371376 int nbDocs = 0 ;
372-
373377 try {
374378 try (BackgroundIndexer indexer = new BackgroundIndexer (indexName , "_doc" , client (), 1000 )) {
375379 indexer .setFailureAssertion (t -> {
@@ -381,11 +385,11 @@ public void testAddBlockWhileIndexingDocuments() throws Exception {
381385 });
382386
383387 waitForDocs (randomIntBetween (10 , 50 ), indexer );
384- assertAcked (client ().admin ().indices ().prepareAddBlock (block , indexName ));
388+ final AddIndexBlockResponse response = client ().admin ().indices ().prepareAddBlock (block , indexName ).get ();
389+ assertTrue ("Add Index Block request was not acknowledged: " + response , response .isAcknowledged ());
385390 indexer .stopAndAwaitStopped ();
386391 nbDocs += indexer .totalIndexedDocs ();
387392 }
388-
389393 assertIndexHasBlock (block , indexName );
390394 } finally {
391395 disableIndexBlock (indexName , block );
0 commit comments