This is an automated email from the ASF dual-hosted git repository.
szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git
The following commit(s) were added to refs/heads/master by this push:
new 50c6e7ddf RATIS-2344. Remove the unused mock from
StateMachineShutdownTests. (#1299)
50c6e7ddf is described below
commit 50c6e7ddf55842e39d626553375fa3264443bea6
Author: Tsz-Wo Nicholas Sze <[email protected]>
AuthorDate: Thu Oct 9 15:44:04 2025 -0700
RATIS-2344. Remove the unused mock from StateMachineShutdownTests. (#1299)
---
.../ratis/server/impl/StateMachineShutdownTests.java | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git
a/ratis-server/src/test/java/org/apache/ratis/server/impl/StateMachineShutdownTests.java
b/ratis-server/src/test/java/org/apache/ratis/server/impl/StateMachineShutdownTests.java
index d97c5c4d5..fc00b70ba 100644
---
a/ratis-server/src/test/java/org/apache/ratis/server/impl/StateMachineShutdownTests.java
+++
b/ratis-server/src/test/java/org/apache/ratis/server/impl/StateMachineShutdownTests.java
@@ -28,12 +28,8 @@ import org.apache.ratis.server.RaftServer;
import org.apache.ratis.statemachine.impl.SimpleStateMachine4Testing;
import org.apache.ratis.statemachine.StateMachine;
import org.apache.ratis.statemachine.TransactionContext;
-import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,7 +47,6 @@ public abstract class StateMachineShutdownTests<CLUSTER
extends MiniRaftCluster>
extends BaseTest
implements MiniRaftCluster.Factory.Get<CLUSTER> {
public static Logger LOG =
LoggerFactory.getLogger(StateMachineUpdater.class);
- private static MockedStatic<CompletableFuture> mocked;
protected static class StateMachineWithConditionalWait extends
SimpleStateMachine4Testing {
boolean unblockAllTxns = false;
@@ -124,19 +119,6 @@ public abstract class StateMachineShutdownTests<CLUSTER
extends MiniRaftCluster>
}
}
- @BeforeEach
- public void setup() {
- mocked = Mockito.mockStatic(CompletableFuture.class,
Mockito.CALLS_REAL_METHODS);
- }
-
- @AfterEach
- public void tearDownClass() {
- if (mocked != null) {
- mocked.close();
- }
-
- }
-
@Test
public void testStateMachineShutdownWaitsForApplyTxn() throws Exception {
final RaftProperties prop = getProperties();
@@ -195,7 +177,7 @@ public abstract class StateMachineShutdownTests<CLUSTER
extends MiniRaftCluster>
// Now wait for the thread
t.join(5000);
- Assertions.assertEquals(logIndex,
secondFollower.getInfo().getLastAppliedIndex());
+ Assertions.assertTrue(logIndex <=
secondFollower.getInfo().getLastAppliedIndex());
Assertions.assertEquals(3,
StateMachineWithConditionalWait.numTxns.values().stream()
.filter(val -> val.get() == 3).count());