@@ -182,6 +182,7 @@ public void testForceMergeIsBlockedThenUnblocked() throws Exception {
182182 indexName ,
183183 Settings .builder ().put (IndexMetadata .SETTING_NUMBER_OF_REPLICAS , 0 ).put (IndexMetadata .SETTING_NUMBER_OF_SHARDS , 1 ).build ()
184184 );
185+ ensureGreen (indexName );
185186 // get current disk space usage (for all indices on the node)
186187 IndicesStatsResponse stats = indicesAdmin ().prepareStats ().clear ().setStore (true ).get ();
187188 long usedDiskSpaceAfterIndexing = stats .getTotal ().getStore ().sizeInBytes ();
@@ -257,6 +258,7 @@ public void testRelocationWhileForceMerging() throws Exception {
257258 indexName ,
258259 Settings .builder ().put (IndexMetadata .SETTING_NUMBER_OF_REPLICAS , 0 ).put (IndexMetadata .SETTING_NUMBER_OF_SHARDS , 1 ).build ()
259260 );
261+ ensureGreen (indexName );
260262 // get current disk space usage (for all indices on the node)
261263 IndicesStatsResponse stats = indicesAdmin ().prepareStats ().clear ().setStore (true ).get ();
262264 long usedDiskSpaceAfterIndexing = stats .getTotal ().getStore ().sizeInBytes ();
@@ -290,8 +292,8 @@ public void testRelocationWhileForceMerging() throws Exception {
290292 ThreadPoolMergeExecutorService threadPoolMergeExecutorService = internalCluster ().getInstance (IndicesService .class , node1 )
291293 .getThreadPoolMergeExecutorService ();
292294 assertBusy (() -> {
293- // merge executor says merging is blocked due to insufficient disk space while there is a single merge task enqueued
294- assertThat (threadPoolMergeExecutorService .getMergeTasksQueueLength (), equalTo ( 1 ));
295+ // merge executor says merging is blocked due to insufficient disk space
296+ assertThat (threadPoolMergeExecutorService .getMergeTasksQueueLength (), greaterThan ( 0 ));
295297 assertTrue (threadPoolMergeExecutorService .isMergingBlockedDueToInsufficientDiskSpace ());
296298 // indices stats also says that no merge is currently running (blocked merges are NOT considered as "running")
297299 IndicesStatsResponse indicesStatsResponse = client ().admin ().indices ().prepareStats (indexName ).setMerge (true ).get ();
0 commit comments