Testing: Properly terminate thread pools
Original commit: elastic/x-pack-elasticsearch@a16cbed365
This commit is contained in:
parent
a4a88c1a82
commit
3f9f0fcadb
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ public class FileUserPasswdStoreTests extends ElasticsearchTestCase {
|
|||
}
|
||||
|
||||
@After
|
||||
public void shutdown() {
|
||||
threadPool.shutdownNow();
|
||||
public void shutdown() throws InterruptedException {
|
||||
terminate(threadPool);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -174,9 +174,7 @@ public class FileRolesStoreTests extends ElasticsearchTestCase {
|
|||
if (watcherService != null) {
|
||||
watcherService.stop();
|
||||
}
|
||||
if (threadPool != null) {
|
||||
threadPool.shutdownNow();
|
||||
}
|
||||
terminate(threadPool);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ public class InternalSignatureServiceTests extends ElasticsearchTestCase {
|
|||
}
|
||||
|
||||
@After
|
||||
public void shutdown() {
|
||||
threadPool.shutdownNow();
|
||||
public void shutdown() throws InterruptedException {
|
||||
terminate(threadPool);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue