From c82e5648865d2d732fd4172c6a42b4176b63f93e Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 29 Apr 2016 16:15:45 -0400 Subject: [PATCH] Remove racy but unnecessary assertion This commit removes a racy but unnecessary assertion in scaling thread pool idle test. Namely, the main test thread can reach the removed assertion before the last few threads in the thread pool have completed their tasks and caused the completed tasks count on the underlying executor to be updated. But this assertion is unnecessary. The main test thread already waits on a latch that is only decremented immediately before a task completes. This ensures that it was in fact the case that every submitted task was executed. Closes #18072 --- .../org/elasticsearch/threadpool/ScalingThreadPoolTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java b/core/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java index d27b43eeb8b..16c0a89e6c4 100644 --- a/core/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java +++ b/core/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java @@ -27,6 +27,7 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executor; +import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.function.BiConsumer; @@ -193,7 +194,6 @@ public class ScalingThreadPoolTests extends ESThreadPoolTestCase { } catch (InterruptedException e) { throw new RuntimeException(e); } - assertThat(stats(threadPool, threadPoolName).getCompleted(), equalTo(128L)); })); }