kaybhutani commented on code in PR #3659:
URL: https://github.com/apache/celeborn/pull/3659#discussion_r3179860235


##########
master/src/test/java/org/apache/celeborn/service/deploy/master/clustermeta/ha/RatisMasterStatusSystemSuiteJ.java:
##########
@@ -1872,6 +1872,56 @@ public void testReviseShuffles() throws 
InterruptedException {
     Assert.assertEquals(STATUSSYSTEM3.registeredShuffleCount(), 8);
   }
 
+  @Test
+  public void testGracefulLeaderShutdownStepDown() {
+    // Identify the current leader
+    HARaftServer leader = null;
+    for (HARaftServer server : Arrays.asList(RATISSERVER1, RATISSERVER2, 
RATISSERVER3)) {
+      if (server.isLeader()) {
+        leader = server;
+        break;
+      }
+    }
+    Assert.assertNotNull("A leader should exist before the test", leader);
+    Assert.assertTrue("Leader node should report isLeader=true", 
leader.isLeader());
+
+    // Do not stop() the shared static server used by the suite, since that 
permanently
+    // closes one of RATISSERVER1/2/3 and can break later tests depending on 
execution order.
+    // Instead, trigger the leader to step down without closing the underlying 
server.
+    leader
+        .getMasterStateMachine()
+        .notifyLogFailed(new Exception("test leader graceful step down"), 
null);
+
+    Assert.assertFalse(
+        "Leader should step down without closing the shared server", 
leader.isLeader());

Review Comment:
   transferLeadership synchronously triggers LeaderStateImpl.stop() -> 
StateMachine.notifyNotLeader -> updateServerRole() before returning, so the 
cache is already fresh when notifyLogFailed returns. Adding a manual refresh 
would bypass the chain this test is meant to cover.     



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to