Speed up rejected execution contains node name test
This commit addresses slowness in the test that a rejected execution contains the node name. The slowness came from setting the count on a countdown latch too high (two in the case of the search thread pool) where there would never be a second countdown on the latch. This means that when then test node is shutting down, closing the node would have to wait a full ten seconds before forcefully terminating the thread pool. This commit fixes the issue so that the node can close immediately, shaving ten seconds off the run time of the test. Relates #27663
This commit is contained in:
parent
8c8b1dc2cf
commit
87f7b9c0f9
|
@ -50,7 +50,7 @@ public class EsThreadPoolExecutorTests extends ESSingleNodeTestCase {
|
|||
}
|
||||
|
||||
private void runThreadPoolExecutorTest(final int fill, final String executor) {
|
||||
final CountDownLatch latch = new CountDownLatch(fill);
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
for (int i = 0; i < fill; i++) {
|
||||
node().injector().getInstance(ThreadPool.class).executor(executor).execute(() -> {
|
||||
try {
|
||||
|
@ -64,12 +64,12 @@ public class EsThreadPoolExecutorTests extends ESSingleNodeTestCase {
|
|||
final AtomicBoolean rejected = new AtomicBoolean();
|
||||
node().injector().getInstance(ThreadPool.class).executor(executor).execute(new AbstractRunnable() {
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
public void onFailure(final Exception e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRejection(Exception e) {
|
||||
public void onRejection(final Exception e) {
|
||||
rejected.set(true);
|
||||
assertThat(e, hasToString(containsString("name = es-thread-pool-executor-tests/" + executor + ", ")));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue