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
commit 464b468c4a0980f75d51e05c5cfe06bf00077056 Author: slfan1989 <55643692+slfan1...@users.noreply.github.com> AuthorDate: Mon May 12 23:50:32 2025 +0800 RATIS-2291. Fix failing TestInstallSnapshotNotificationWithGrpc#testAddNewFollowersNoSnapshot. (#1257) --- .../org/apache/ratis/InstallSnapshotNotificationTests.java | 4 ++-- .../java/org/apache/ratis/server/impl/MiniRaftCluster.java | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests.java b/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests.java index 6aaa8acc3..ae5d79224 100644 --- a/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests.java +++ b/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests.java @@ -220,7 +220,7 @@ public abstract class InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC // delete the log segments from the leader LOG.info("Delete logs {}", logs); for (LogSegmentPath path : logs) { - FileUtils.deleteFully(path.getPath()); // the log may be already puged + FileUtils.deleteFully(path.getPath()); // the log may be already purged } // restart the peer @@ -252,7 +252,7 @@ public abstract class InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC // Check the installed snapshot index on each Follower matches with the // leader snapshot. for (RaftServer.Division follower : cluster.getFollowers()) { - final long expected = shouldInstallSnapshot ? leaderSnapshotInfo.getIndex() : RaftLog.INVALID_LOG_INDEX; + final long expected = leaderSnapshotInfo.getIndex(); Assert.assertEquals(expected, RaftServerTestUtil.getLatestInstalledSnapshotIndex(follower)); RaftSnapshotBaseTest.assertLogContent(follower, false); } diff --git a/ratis-server/src/test/java/org/apache/ratis/server/impl/MiniRaftCluster.java b/ratis-server/src/test/java/org/apache/ratis/server/impl/MiniRaftCluster.java index 1dc9e8f52..f4785ce90 100644 --- a/ratis-server/src/test/java/org/apache/ratis/server/impl/MiniRaftCluster.java +++ b/ratis-server/src/test/java/org/apache/ratis/server/impl/MiniRaftCluster.java @@ -133,7 +133,7 @@ public abstract class MiniRaftCluster implements Closeable { default void runWithNewCluster(int numServers, int numListeners, boolean startCluster, CheckedConsumer<CLUSTER, Exception> testCase) throws Exception { final StackTraceElement caller = JavaUtils.getCallerStackTraceElement(); - LOG.info("Running " + caller.getMethodName()); + LOG.info("Running {}", caller.getMethodName()); final CLUSTER cluster = newCluster(numServers, numListeners); try { if (startCluster) { @@ -142,7 +142,7 @@ public abstract class MiniRaftCluster implements Closeable { testCase.accept(cluster); } catch(Exception t) { LOG.info(cluster.printServers()); - LOG.error("Failed " + caller, t); + LOG.error("Failed {}", caller, t); throw t; } finally { cluster.shutdown(); @@ -156,7 +156,7 @@ public abstract class MiniRaftCluster implements Closeable { default void runWithSameCluster(int numServers, int numListeners, CheckedConsumer<CLUSTER, Exception> testCase) throws Exception { final StackTraceElement caller = JavaUtils.getCallerStackTraceElement(); - LOG.info("Running " + caller.getMethodName()); + LOG.info("Running {}", caller.getMethodName()); CLUSTER cluster = null; try { cluster = getFactory().reuseCluster(numServers, numListeners, getProperties()); @@ -165,7 +165,7 @@ public abstract class MiniRaftCluster implements Closeable { if (cluster != null) { LOG.info(cluster.printServers()); } - LOG.error("Failed " + caller, t); + LOG.error("Failed {}", caller, t); throw t; } } @@ -317,7 +317,7 @@ public abstract class MiniRaftCluster implements Closeable { } public MiniRaftCluster initServers() { - LOG.info("servers = " + servers); + LOG.info("servers = {}", servers); if (servers.isEmpty()) { putNewServers(CollectionUtils.as(group.getPeers(), RaftPeer::getId), true, group); } @@ -348,7 +348,7 @@ public abstract class MiniRaftCluster implements Closeable { startServers(servers.values()); this.timer.updateAndGet(t -> t != null? t - : JavaUtils.runRepeatedly(() -> LOG.info("TIMED-PRINT: " + printServers()), 10, 10, TimeUnit.SECONDS)); + : JavaUtils.runRepeatedly(() -> LOG.info("TIMED-PRINT: {}.", printServers()), 10, 10, TimeUnit.SECONDS)); } /** @@ -535,7 +535,7 @@ public abstract class MiniRaftCluster implements Closeable { } public void killServer(RaftPeerId id) { - LOG.info("killServer " + id); + LOG.info("killServer {}", id); servers.get(id).close(); }