File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
server/src/test/java/org/elasticsearch/index/engine Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -334,8 +334,16 @@ public void testIORateIsAdjustedForAllRunningMergeTasks() throws Exception {
334334 MergeTask mergeTask = mock (MergeTask .class );
335335 // all tasks support IO throttling in this test case
336336 when (mergeTask .supportsIOThrottling ()).thenReturn (true );
337- // {@link Schedule.BACKLOG} complicates the test too much because the set of running merge tasks is not stable
338- when (mergeTask .schedule ()).thenReturn (randomFrom (RUN , ABORT ));
337+ doAnswer (mock -> {
338+ Schedule schedule = randomFrom (Schedule .values ());
339+ if (schedule == BACKLOG ) {
340+ testThreadPool .executor (ThreadPool .Names .GENERIC ).execute (() -> {
341+ // reenqueue backlogged merge task
342+ threadPoolMergeExecutorService .reEnqueueBackloggedMergeTask (mergeTask );
343+ });
344+ }
345+ return schedule ;
346+ }).when (mergeTask ).schedule ();
339347 doAnswer (mock -> {
340348 currentlyRunningMergeTasksSet .add (mergeTask );
341349 // wait to be signalled before completing
You can’t perform that action at this time.
0 commit comments