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.
This commit is contained in:
Jason Tedor 2016-05-20 08:54:13 -04:00
parent 80fee8666f
commit 140f9dfe5f
1 changed files with 1 additions and 1 deletions

View File

@ -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;