Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop NodeTests from timing out in certain cases #49202

Merged
merged 4 commits into from
Nov 22, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions server/src/test/java/org/elasticsearch/node/NodeTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.elasticsearch.node;

import org.apache.lucene.util.Constants;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.bootstrap.BootstrapCheck;
import org.elasticsearch.bootstrap.BootstrapContext;
Expand Down Expand Up @@ -150,7 +149,6 @@ private static Settings.Builder baseSettings() {
}

public void testCloseOnOutstandingTask() throws Exception {
assumeFalse("https://github.com/elastic/elasticsearch/issues/44256", Constants.WINDOWS);
Node node = new MockNode(baseSettings().build(), basePlugins());
node.start();
ThreadPool threadpool = node.injector().getInstance(ThreadPool.class);
Expand All @@ -163,7 +161,7 @@ public void testCloseOnOutstandingTask() throws Exception {
threadRunning.await();
node.close();
shouldRun.set(false);
assertTrue(node.awaitClose(1, TimeUnit.DAYS));
assertTrue(node.awaitClose(10L, TimeUnit.SECONDS));
}

public void testCloseRaceWithTaskExecution() throws Exception {
Expand Down Expand Up @@ -205,7 +203,7 @@ public void testCloseRaceWithTaskExecution() throws Exception {
closeThread.join();

shouldRun.set(false);
assertTrue(node.awaitClose(1, TimeUnit.DAYS));
assertTrue(node.awaitClose(10L, TimeUnit.SECONDS));
}

public void testAwaitCloseTimeoutsOnNonInterruptibleTask() throws Exception {
Expand All @@ -222,7 +220,7 @@ public void testAwaitCloseTimeoutsOnNonInterruptibleTask() throws Exception {
node.close();
assertFalse(node.awaitClose(0, TimeUnit.MILLISECONDS));
shouldRun.set(false);
assertTrue(node.awaitClose(1, TimeUnit.DAYS));
assertTrue(node.awaitClose(10L, TimeUnit.SECONDS));
}

public void testCloseOnInterruptibleTask() throws Exception {
Expand All @@ -246,7 +244,7 @@ public void testCloseOnInterruptibleTask() throws Exception {
});
threadRunning.await();
node.close();
// close should not interrput ongoing tasks
// close should not interrupt ongoing tasks
assertFalse(interrupted.get());
// but awaitClose should
node.awaitClose(0, TimeUnit.SECONDS);
Expand All @@ -265,7 +263,7 @@ public void testCloseOnLeakedIndexReaderReference() throws Exception {
Searcher searcher = shard.acquireSearcher("test");
node.close();

IllegalStateException e = expectThrows(IllegalStateException.class, () -> node.awaitClose(1, TimeUnit.DAYS));
IllegalStateException e = expectThrows(IllegalStateException.class, () -> node.awaitClose(10L, TimeUnit.SECONDS));
searcher.close();
assertThat(e.getMessage(), Matchers.containsString("Something is leaking index readers or store references"));
}
Expand All @@ -281,7 +279,7 @@ public void testCloseOnLeakedStoreReference() throws Exception {
shard.store().incRef();
node.close();

IllegalStateException e = expectThrows(IllegalStateException.class, () -> node.awaitClose(1, TimeUnit.DAYS));
IllegalStateException e = expectThrows(IllegalStateException.class, () -> node.awaitClose(10L, TimeUnit.SECONDS));
shard.store().decRef();
assertThat(e.getMessage(), Matchers.containsString("Something is leaking index readers or store references"));
}
Expand Down