Skip to content

Commit b0f5330

Browse files
authored
RATIS-2291. Fix failing TestInstallSnapshotNotificationWithGrpc#testAddNewFollowersNoSnapshot. (#1257)
1 parent 21f9e5b commit b0f5330

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ private void testAddNewFollowers(CLUSTER cluster, int numRequests) throws Except
220220
// delete the log segments from the leader
221221
LOG.info("Delete logs {}", logs);
222222
for (LogSegmentPath path : logs) {
223-
FileUtils.deleteFully(path.getPath()); // the log may be already puged
223+
FileUtils.deleteFully(path.getPath()); // the log may be already purged
224224
}
225225

226226
// restart the peer
@@ -252,7 +252,7 @@ private void testAddNewFollowers(CLUSTER cluster, int numRequests) throws Except
252252
// Check the installed snapshot index on each Follower matches with the
253253
// leader snapshot.
254254
for (RaftServer.Division follower : cluster.getFollowers()) {
255-
final long expected = shouldInstallSnapshot ? leaderSnapshotInfo.getIndex() : RaftLog.INVALID_LOG_INDEX;
255+
final long expected = leaderSnapshotInfo.getIndex();
256256
Assert.assertEquals(expected, RaftServerTestUtil.getLatestInstalledSnapshotIndex(follower));
257257
RaftSnapshotBaseTest.assertLogContent(follower, false);
258258
}

ratis-server/src/test/java/org/apache/ratis/server/impl/MiniRaftCluster.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ default void runWithNewCluster(int numServers, int numListeners, CheckedConsumer
134134
default void runWithNewCluster(int numServers, int numListeners, boolean startCluster,
135135
CheckedConsumer<CLUSTER, Exception> testCase) throws Exception {
136136
final StackTraceElement caller = JavaUtils.getCallerStackTraceElement();
137-
LOG.info("Running " + caller.getMethodName());
137+
LOG.info("Running {}", caller.getMethodName());
138138
final CLUSTER cluster = newCluster(numServers, numListeners);
139139
Throwable failed = null;
140140
try {
@@ -144,7 +144,7 @@ default void runWithNewCluster(int numServers, int numListeners, boolean startCl
144144
testCase.accept(cluster);
145145
} catch(Throwable t) {
146146
LOG.info(cluster.printServers());
147-
LOG.error("Failed " + caller, t);
147+
LOG.error("Failed {}", caller, t);
148148
failed = t;
149149
throw t;
150150
} finally {
@@ -167,7 +167,7 @@ default void runWithSameCluster(int numServers, CheckedConsumer<CLUSTER, Excepti
167167
default void runWithSameCluster(int numServers, int numListeners, CheckedConsumer<CLUSTER, Exception> testCase)
168168
throws Exception {
169169
final StackTraceElement caller = JavaUtils.getCallerStackTraceElement();
170-
LOG.info("Running " + caller.getMethodName());
170+
LOG.info("Running {}", caller.getMethodName());
171171
CLUSTER cluster = null;
172172
try {
173173
cluster = getFactory().reuseCluster(numServers, numListeners, getProperties());
@@ -176,7 +176,7 @@ default void runWithSameCluster(int numServers, int numListeners, CheckedConsume
176176
if (cluster != null) {
177177
LOG.info(cluster.printServers());
178178
}
179-
LOG.error("Failed " + caller, t);
179+
LOG.error("Failed {}", caller, t);
180180
throw t;
181181
}
182182
}
@@ -328,7 +328,7 @@ public RaftProperties getProperties() {
328328
}
329329

330330
public MiniRaftCluster initServers() {
331-
LOG.info("servers = " + servers);
331+
LOG.info("servers = {}", servers);
332332
if (servers.isEmpty()) {
333333
putNewServers(CollectionUtils.as(group.getPeers(), RaftPeer::getId), true, group);
334334
}
@@ -359,7 +359,7 @@ public void start() throws IOException {
359359
startServers(servers.values());
360360

361361
this.timer.updateAndGet(t -> t != null? t
362-
: JavaUtils.runRepeatedly(() -> LOG.info("TIMED-PRINT: " + printServers()), 10, 10, TimeUnit.SECONDS));
362+
: JavaUtils.runRepeatedly(() -> LOG.info("TIMED-PRINT: {}.", printServers()), 10, 10, TimeUnit.SECONDS));
363363
}
364364

365365
/**
@@ -546,7 +546,7 @@ public PeerChanges removePeers(int number, boolean removeLeader,
546546
}
547547

548548
public void killServer(RaftPeerId id) {
549-
LOG.info("killServer " + id);
549+
LOG.info("killServer {}", id);
550550
servers.get(id).close();
551551
}
552552

0 commit comments

Comments
 (0)