Testing: Properly terminate thread pools

Original commit: elastic/x-pack-elasticsearch@a16cbed365
This commit is contained in:
Alexander Reelsen 2015-02-17 09:49:22 +01:00
parent a4a88c1a82
commit 3f9f0fcadb
7 changed files with 18 additions and 16 deletions

View File

@ -69,5 +69,11 @@ public class VersionCompatibilityTests extends ElasticsearchTestCase {
* since es core 1.5.0 introduced the AliasesRequest interface.
*/
assertThat("Remove special treatment for IndicesAliasesRequest and GetAliasesRequest", Version.CURRENT.onOrBefore(Version.V_1_4_2), is(true));
/**
* see https://github.com/elasticsearch/elasticsearch/pull/9508
* CheckFileCommand has been moved into ES-Core, please check the supported versions in the PR, if it can be removed completely
*/
assertThat("Remove built-in CheckFileCommand", Version.CURRENT.onOrBefore(Version.V_1_4_2), is(true));
}
}

View File

@ -60,8 +60,8 @@ public class FileUserPasswdStoreTests extends ElasticsearchTestCase {
}
@After
public void shutdown() {
threadPool.shutdownNow();
public void shutdown() throws InterruptedException {
terminate(threadPool);
}
@Test

View File

@ -59,8 +59,8 @@ public class FileUserRolesStoreTests extends ElasticsearchTestCase {
}
@After
public void shutdown() {
threadPool.shutdownNow();
public void shutdown() throws InterruptedException {
terminate(threadPool);
}
@Test
@ -239,9 +239,7 @@ public class FileUserRolesStoreTests extends ElasticsearchTestCase {
FileUserRolesStore store = new FileUserRolesStore(config, watcherService);
assertThat(store.roles("user"), equalTo(Strings.EMPTY_ARRAY));
} finally {
if (threadPool != null) {
threadPool.shutdownNow();
}
terminate(threadPool);
}
}

View File

@ -45,9 +45,9 @@ public class LdapRealmTest extends LdapTest {
}
@After
public void shutdown() {
public void shutdown() throws InterruptedException {
resourceWatcherService.stop();
threadPool.shutdownNow();
terminate(threadPool);
}
@Test

View File

@ -51,8 +51,8 @@ public abstract class AbstractGroupToRoleMapperTests extends ElasticsearchTestCa
}
@After
public void shutdown() {
threadPool.shutdownNow();
public void shutdown() throws InterruptedException {
terminate(threadPool);
}
protected abstract AbstractGroupToRoleMapper createMapper(Path file, ResourceWatcherService watcherService);

View File

@ -174,9 +174,7 @@ public class FileRolesStoreTests extends ElasticsearchTestCase {
if (watcherService != null) {
watcherService.stop();
}
if (threadPool != null) {
threadPool.shutdownNow();
}
terminate(threadPool);
}
}

View File

@ -49,8 +49,8 @@ public class InternalSignatureServiceTests extends ElasticsearchTestCase {
}
@After
public void shutdown() {
threadPool.shutdownNow();
public void shutdown() throws InterruptedException {
terminate(threadPool);
}
@Test