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 b0f5330ae RATIS-2291. Fix failing
TestInstallSnapshotNotificationWithGrpc#testAddNewFollowersNoSnapshot. (#1257)
b0f5330ae is described below
commit b0f5330aeae83c41e19be6759fe56240f6f6c105
Author: slfan1989 <[email protected]>
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 e180f3ecb..08ff17a4c 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
@@ -134,7 +134,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);
Throwable failed = null;
try {
@@ -144,7 +144,7 @@ public abstract class MiniRaftCluster implements Closeable {
testCase.accept(cluster);
} catch(Throwable t) {
LOG.info(cluster.printServers());
- LOG.error("Failed " + caller, t);
+ LOG.error("Failed {}", caller, t);
failed = t;
throw t;
} finally {
@@ -167,7 +167,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());
@@ -176,7 +176,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;
}
}
@@ -328,7 +328,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);
}
@@ -359,7 +359,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));
}
/**
@@ -546,7 +546,7 @@ public abstract class MiniRaftCluster implements Closeable {
}
public void killServer(RaftPeerId id) {
- LOG.info("killServer " + id);
+ LOG.info("killServer {}", id);
servers.get(id).close();
}