From 140f9dfe5f660aac896d15c4b977ee29a91e1b0d Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 20 May 2016 08:54:13 -0400 Subject: [PATCH] Fix scaling thread pool test bug This commit fixes a test bug in the scaling thread pool configuration test. In particular, the test randomization could select min and max for a thread pool configuration where both are equal to zero. This is a violation of the requirements of the ThreadPoolExecutor. With this commit, we now ensure that the max is bounded below by one. --- .../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 94d6d075589..86223ccd1fc 100644 --- a/core/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java +++ b/core/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java @@ -59,7 +59,7 @@ public class ScalingThreadPoolTests extends ESThreadPoolTestCase { final int expectedSize; if (sizeBasedOnNumberOfProcessors < min || randomBoolean()) { - expectedSize = randomIntBetween(min, 16); + expectedSize = randomIntBetween(Math.max(1, min), 16); builder.put("threadpool." + threadPoolName + ".size", expectedSize); } else { expectedSize = sizeBasedOnNumberOfProcessors;