Skip to content

Commit e232afd

Browse files
committed
test jvm update
1 parent 1f85bcf commit e232afd

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
org.gradle.parallel=true
22
org.gradle.caching=false
33
org.gradle.configureondemand=true
4-
org.gradle.jvmargs=-Xmx1G "-XX:MaxMetaspaceSize=384m"
4+
org.gradle.jvmargs=-Xmx2G "-XX:MaxMetaspaceSize=512m"
5+
testJvmMaxHeap=2g

mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterActorClusterUsageAkkaTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
package io.mantisrx.master.resourcecluster;
1818

1919
import static org.junit.Assert.assertEquals;
20+
import static org.mockito.ArgumentMatchers.any;
2021
import static org.mockito.Mockito.mock;
22+
import static org.mockito.Mockito.when;
2123
import static org.testng.Assert.assertThrows;
2224

2325
import akka.actor.ActorRef;
@@ -62,6 +64,7 @@
6264
import java.util.Objects;
6365
import java.util.Optional;
6466
import java.util.Set;
67+
import java.util.concurrent.CompletableFuture;
6568
import java.util.concurrent.ExecutionException;
6669
import java.util.stream.Collectors;
6770
import org.junit.AfterClass;
@@ -157,6 +160,7 @@ public static void teardown() {
157160
@Before
158161
public void setupRpcService() {
159162
rpcService.registerGateway(TASK_EXECUTOR_ADDRESS, gateway);
163+
when(gateway.submitTask(any())).thenReturn(CompletableFuture.completedFuture(Ack.getInstance()));
160164
mantisJobStore = mock(MantisJobStore.class);
161165
jobMessageRouter = mock(JobMessageRouter.class);
162166
}

mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterActorTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ public void setupTest() throws Exception {
199199

200200
private void setupRpcService() throws Exception {
201201
rpcService.registerGateway(TASK_EXECUTOR_ADDRESS, gateway);
202+
when(gateway.submitTask(ArgumentMatchers.any())).thenReturn(CompletableFuture.completedFuture(Ack.getInstance()));
202203
mantisJobStore = mock(MantisJobStore.class);
203204
jobMessageRouter = mock(JobMessageRouter.class);
204205
doReturn(ImmutableList.of())
@@ -528,6 +529,11 @@ public void testGetTaskExecutorsUsageAndList() throws Exception {
528529

529530
@Test
530531
public void testAssignmentTimeout() throws Exception {
532+
// Override the default submitTask mock to return a hanging future that never completes
533+
// This simulates a task executor that times out during assignment
534+
CompletableFuture<Ack> hangingFuture = new CompletableFuture<>();
535+
when(gateway.submitTask(ArgumentMatchers.any())).thenReturn(hangingFuture);
536+
531537
assertEquals(Ack.getInstance(), resourceCluster.registerTaskExecutor(TASK_EXECUTOR_REGISTRATION).get());
532538
assertEquals(Ack.getInstance(),
533539
resourceCluster
@@ -546,6 +552,9 @@ public void testAssignmentTimeout() throws Exception {
546552
assertEquals(ImmutableList.of(), resourceCluster.getRegisteredTaskExecutors().get());
547553
assertEquals(ImmutableList.of(), resourceCluster.getAvailableTaskExecutors().get());
548554

555+
// Restore the submitTask mock to return a completed future for re-registration
556+
when(gateway.submitTask(ArgumentMatchers.any())).thenReturn(CompletableFuture.completedFuture(Ack.getInstance()));
557+
549558
// re-register TE
550559
when(mantisJobStore.getTaskExecutor(TASK_EXECUTOR_ID))
551560
.thenReturn(new TaskExecutorRegistration(TASK_EXECUTOR_ID, CLUSTER_ID, "", "", null, MACHINE_DEFINITION, ATTRIBUTES));

0 commit comments

Comments
 (0)