Skip to content

Commit

Permalink
Fix SearchableSnapshotsPrewarmingIntegTests (Backport #101203)
Browse files Browse the repository at this point in the history
Closes #112422
  • Loading branch information
nicktindall committed Sep 4, 2024
1 parent 6e057bd commit fcf25ff
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,13 @@ public void testConcurrentPrewarming() throws Exception {
final CountDownLatch startPrewarmingLatch = new CountDownLatch(1);
final ThreadPool threadPool = getInstanceFromNode(ThreadPool.class);
final int maxUploadTasks = threadPool.info(CACHE_PREWARMING_THREAD_POOL_NAME).getMax();
final CountDownLatch maxUploadTasksCreated = new CountDownLatch(maxUploadTasks);
for (int i = 0; i < maxUploadTasks; i++) {
threadPool.executor(CACHE_PREWARMING_THREAD_POOL_NAME).execute(new AbstractRunnable() {

@Override
protected void doRun() throws Exception {
maxUploadTasksCreated.countDown();
startPrewarmingLatch.await();
}

Expand All @@ -287,6 +289,7 @@ public void onFailure(Exception e) {
});
}

safeAwait(maxUploadTasksCreated);
ExecutorService prewarmingExecutor = threadPool.executor(SearchableSnapshots.CACHE_PREWARMING_THREAD_POOL_NAME);
assertThat(prewarmingExecutor, instanceOf(ThreadPoolExecutor.class));
assertThat(((ThreadPoolExecutor) prewarmingExecutor).getActiveCount(), equalTo(maxUploadTasks));
Expand Down

0 comments on commit fcf25ff

Please sign in to comment.