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 d79b730)
  • Loading branch information
deepthidevaki committed Aug 29, 2022
1 parent 0a72e69 commit 1f1ed1e
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -480,14 +480,18 @@ private void assertNoGapsInLog(final MemberId memberId) {
long nextIndex = firstIndex;
try (final var reader = s.getLog().openCommittedReader()) {
while (reader.hasNext()) {
assertThat(reader.next().index()).isEqualTo(nextIndex);
assertThat(reader.next().index())
.describedAs("There is no gap in the log %s", memberId.id())
.isEqualTo(nextIndex);
nextIndex++;
}
}

if (firstIndex != 1) {
final var currentSnapshotIndex = snapshotStores.get(memberId).getCurrentSnapshotIndex();
assertThat(currentSnapshotIndex).isGreaterThanOrEqualTo(firstIndex - 1);
assertThat(currentSnapshotIndex)
.describedAs("The log is compacted in %s. Hence a snapshot must exist.")
.isGreaterThanOrEqualTo(firstIndex - 1);
}
}
}

0 comments on commit 1f1ed1e

Please sign in to comment.