Skip to content

Commit

Permalink
test(raft): improve assertion failure message
Browse files Browse the repository at this point in the history
(cherry picked from commit 6a39814)
  • Loading branch information
deepthidevaki committed Aug 29, 2022
1 parent ceb890d commit a9e809b
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -435,17 +435,15 @@ boolean hasReplicatedAllEntries() {
}

public void assertAllEntriesCommittedAndReplicatedToAll() {
raftServers
.values()
.forEach(
s -> {
final var lastCommittedEntry = getLastCommittedEntry(s);
final var lastUncommittedEntry = getLastUncommittedEntry(s);

assertThat(lastCommittedEntry)
.describedAs("All entries should be committed")
.isEqualTo(lastUncommittedEntry);
});
raftServers.forEach(
(memberId, raftServer) -> {
final var lastCommittedEntry = getLastCommittedEntry(raftServer);
final var lastUncommittedEntry = getLastUncommittedEntry(raftServer);

assertThat(lastCommittedEntry)
.describedAs("All entries should be committed in %s", memberId.id())
.isEqualTo(lastUncommittedEntry);
});

assertThat(hasReplicatedAllEntries())
.describedAs("All entries are replicated to all followers")
Expand Down

0 comments on commit a9e809b

Please sign in to comment.