Expand scaling thread pool configuration coverage

This commit slightly expands the scaling thread pool configuration test
coverage. In particular, the test testScalingThreadPoolConfiguration is
expanded to include the case when min is equal to size, and the test
testDynamicThreadPoolSize is expanded to include all possible cases when
size is greater than or equal to min.
This commit is contained in:
Jason Tedor 2016-04-26 08:17:54 -04:00
parent fd679a7021
commit b89a935be5
1 changed files with 3 additions and 3 deletions

View File

@ -59,7 +59,7 @@ public class ScalingThreadPoolTests extends ESThreadPoolTestCase {
final int expectedSize;
if (sizeBasedOnNumberOfProcessors < min || randomBoolean()) {
expectedSize = randomIntBetween(min + 1, 16);
expectedSize = randomIntBetween(min, 16);
builder.put("threadpool." + threadPoolName + ".size", expectedSize);
} else {
expectedSize = sizeBasedOnNumberOfProcessors;
@ -188,12 +188,12 @@ public class ScalingThreadPoolTests extends ESThreadPoolTestCase {
final String threadPoolName = randomThreadPool(ThreadPool.ThreadPoolType.SCALING);
runScalingThreadPoolTest(Settings.EMPTY, (clusterSettings, threadPool) -> {
final Executor beforeExecutor = threadPool.executor(threadPoolName);
final int size = randomIntBetween(128, 512);
int expectedMin = "generic".equals(threadPoolName) ? 4 : 1;
final int size = randomIntBetween(expectedMin, Integer.MAX_VALUE);
clusterSettings.applySettings(settings("threadpool." + threadPoolName + ".size", size));
final Executor afterExecutor = threadPool.executor(threadPoolName);
assertSame(beforeExecutor, afterExecutor);
final ThreadPool.Info info = info(threadPool, threadPoolName);
int expectedMin = "generic".equals(threadPoolName) ? 4 : 1;
assertThat(info.getMin(), equalTo(expectedMin));
assertThat(info.getMax(), equalTo(size));