Skip to content

Commit 60824c8

Browse files
authored
Fix sequence of test setup/teardown (#2387)
Signed-off-by: owenhalpert <ohalpert@gmail.com>
1 parent 2f021dd commit 60824c8

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

src/test/java/org/opensearch/knn/index/memory/NativeMemoryCacheManagerTests.java

+2-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
package org.opensearch.knn.index.memory;
1313

1414
import com.google.common.cache.CacheStats;
15-
import org.junit.After;
1615
import org.junit.Before;
1716
import org.opensearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
1817
import org.opensearch.common.settings.Settings;
@@ -41,18 +40,11 @@ public class NativeMemoryCacheManagerTests extends OpenSearchSingleNodeTestCase
4140
private ThreadPool threadPool;
4241

4342
@Before
44-
public void setUp() throws Exception {
45-
super.setUp();
43+
public void setThreadPool() {
4644
threadPool = new ThreadPool(Settings.builder().put("node.name", "NativeMemoryCacheManagerTests").build());
4745
NativeMemoryCacheManager.setThreadPool(threadPool);
4846
}
4947

50-
@After
51-
public void shutdown() throws Exception {
52-
super.tearDown();
53-
terminate(threadPool);
54-
}
55-
5648
@Override
5749
public void tearDown() throws Exception {
5850
// Clear out persistent metadata
@@ -61,6 +53,7 @@ public void tearDown() throws Exception {
6153
clusterUpdateSettingsRequest.persistentSettings(circuitBreakerSettings);
6254
client().admin().cluster().updateSettings(clusterUpdateSettingsRequest).get();
6355
NativeMemoryCacheManager.getInstance().close();
56+
terminate(threadPool);
6457
super.tearDown();
6558
}
6659

src/test/java/org/opensearch/knn/quantization/models/quantizationState/QuantizationStateCacheTests.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,13 @@ public class QuantizationStateCacheTests extends KNNTestCase {
3636
private ThreadPool threadPool;
3737

3838
@Before
39-
public void setUp() throws Exception {
40-
super.setUp();
39+
public void setThreadPool() {
4140
threadPool = new ThreadPool(Settings.builder().put("node.name", "QuantizationStateCacheTests").build());
4241
QuantizationStateCache.setThreadPool(threadPool);
4342
}
4443

4544
@After
46-
public void shutdown() throws Exception {
47-
super.tearDown();
45+
public void terminateThreadPool() {
4846
terminate(threadPool);
4947
}
5048

0 commit comments

Comments
 (0)