Improve ThreadPoolManagerTest stability (#4035)

When the CPU load of a system is high these timeouts may not be realistic.

Fixes #3254

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2024-01-12 21:42:02 +01:00
committed by GitHub
parent 18d9b531ff
commit b77f954848
@@ -125,7 +125,7 @@ public class ThreadPoolManagerTest {
ExecutorService threadPool = ThreadPoolManager.getPool(poolName);
CountDownLatch cdl = new CountDownLatch(1);
threadPool.execute(cdl::countDown);
assertTrue(cdl.await(1, TimeUnit.SECONDS), "Checking if thread pool " + poolName + " works");
assertTrue(cdl.await(5, TimeUnit.SECONDS), "Checking if thread pool " + poolName + " works");
assertFalse(threadPool.isShutdown(), "Checking if thread pool is not shut down");
}
@@ -133,7 +133,7 @@ public class ThreadPoolManagerTest {
ScheduledExecutorService threadPool = ThreadPoolManager.getScheduledPool(poolName);
CountDownLatch cdl = new CountDownLatch(1);
threadPool.schedule(cdl::countDown, 100, TimeUnit.MILLISECONDS);
assertTrue(cdl.await(1, TimeUnit.SECONDS), "Checking if thread pool " + poolName + " works");
assertTrue(cdl.await(5, TimeUnit.SECONDS), "Checking if thread pool " + poolName + " works");
assertFalse(threadPool.isShutdown(), "Checking if thread pool is not shut down");
}
}