Skip to content

Commit fa0c54c

Browse files
Fix Test Failure in ScalingThreadPoolTests (#44898)
* Due to #44894 some constellations log a deprecation warning here now * Fixed by checking for that
1 parent 0f03de5 commit fa0c54c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

server/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,17 @@ public void testScalingThreadPoolConfiguration() throws InterruptedException {
4848
core = "generic".equals(threadPoolName) ? 4 : 1; // the defaults
4949
}
5050

51+
final int availableProcessors = Runtime.getRuntime().availableProcessors();
5152
final int maxBasedOnNumberOfProcessors;
53+
final int processorsUsed;
5254
if (randomBoolean()) {
5355
final int processors = randomIntBetween(1, 64);
5456
maxBasedOnNumberOfProcessors = expectedSize(threadPoolName, processors);
5557
builder.put("processors", processors);
58+
processorsUsed = processors;
5659
} else {
57-
maxBasedOnNumberOfProcessors = expectedSize(threadPoolName, Runtime.getRuntime().availableProcessors());
60+
maxBasedOnNumberOfProcessors = expectedSize(threadPoolName, availableProcessors);
61+
processorsUsed = availableProcessors;
5862
}
5963

6064
final int expectedMax;
@@ -93,6 +97,11 @@ public void testScalingThreadPoolConfiguration() throws InterruptedException {
9397
assertThat(info.getMax(), equalTo(expectedMax));
9498
assertThat(esThreadPoolExecutor.getMaximumPoolSize(), equalTo(expectedMax));
9599
});
100+
101+
if (processorsUsed > availableProcessors) {
102+
assertWarnings("setting processors to value [" + processorsUsed +
103+
"] which is more than available processors [" + availableProcessors + "] is deprecated");
104+
}
96105
}
97106

98107
private int expectedSize(final String threadPoolName, final int numberOfProcessors) {

0 commit comments

Comments
 (0)