From 9de9f579cfec76ddfe263de0c3fd8eda7d75b9b9 Mon Sep 17 00:00:00 2001 From: ggao Date: Thu, 7 May 2026 11:06:52 -0700 Subject: [PATCH] Fix TaskExecutorReconnectionIntegrationTest not stop old actors --- ...skExecutorReconnectionIntegrationTest.java | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/TaskExecutorReconnectionIntegrationTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/TaskExecutorReconnectionIntegrationTest.java index 0d5d3c62b..3d6f2c55a 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/TaskExecutorReconnectionIntegrationTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/TaskExecutorReconnectionIntegrationTest.java @@ -65,9 +65,8 @@ import java.util.concurrent.CompletableFuture; import lombok.extern.slf4j.Slf4j; -import org.junit.AfterClass; +import org.junit.After; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -94,7 +93,7 @@ public class TaskExecutorReconnectionIntegrationTest { private static final WorkerId WORKER_ID_1 = WorkerId.fromIdUnsafe("test-job-1-worker-0-1"); - private static ActorSystem actorSystem; + private ActorSystem actorSystem; private final TestingRpcService rpcService = new TestingRpcService(); private final TaskExecutorGateway gateway = mock(TaskExecutorGateway.class); @@ -106,19 +105,9 @@ public class TaskExecutorReconnectionIntegrationTest { private final MantisPropertiesLoader propertiesLoader = new DefaultMantisPropertiesLoader(System.getProperties()); - @BeforeClass - public static void setup() { - actorSystem = ActorSystem.create(); - } - - @AfterClass - public static void teardown() { - TestKit.shutdownActorSystem(actorSystem); - actorSystem = null; - } - @Before public void setupTest() throws Exception { + actorSystem = ActorSystem.create(); rpcService.registerGateway(TASK_EXECUTOR_ADDRESS, gateway); mantisJobStore = mock(MantisJobStore.class); @@ -167,6 +156,12 @@ public void setupTest() throws Exception { new LongDynamicProperty(propertiesLoader, "resourcecluster.gateway.maxConcurrentRequests.test", 100000L)); } + @After + public void teardownTest() { + TestKit.shutdownActorSystem(actorSystem); + actorSystem = null; + } + @Test public void testJobMessageRouterIntegration() { // This test verifies that the jobMessageRouter is properly configured