From 2cc2372165081c7828122eeb9bc6ff1e7fb293e7 Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Wed, 29 Jun 2016 12:29:36 -0700 Subject: [PATCH] raft: give correct offset in unstable test `unstable.entries[i] has raft log position i+unstable.offset` So, this fixes some test cases by giving them correct offsets. --- raft/log_unstable_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/raft/log_unstable_test.go b/raft/log_unstable_test.go index af042f9df..88af7f373 100644 --- a/raft/log_unstable_test.go +++ b/raft/log_unstable_test.go @@ -237,9 +237,9 @@ func TestUnstableStableTo(t *testing.T) { 6, 1, }, { - []pb.Entry{{Index: 6, Term: 2}}, 5, nil, + []pb.Entry{{Index: 6, Term: 2}}, 6, nil, 6, 1, // stable to the first entry and term mismatch - 5, 1, + 6, 1, }, { []pb.Entry{{Index: 5, Term: 1}}, 5, nil, @@ -263,9 +263,9 @@ func TestUnstableStableTo(t *testing.T) { 6, 1, }, { - []pb.Entry{{Index: 6, Term: 2}}, 5, &pb.Snapshot{Metadata: pb.SnapshotMetadata{Index: 5, Term: 1}}, + []pb.Entry{{Index: 6, Term: 2}}, 6, &pb.Snapshot{Metadata: pb.SnapshotMetadata{Index: 5, Term: 1}}, 6, 1, // stable to the first entry and term mismatch - 5, 1, + 6, 1, }, { []pb.Entry{{Index: 5, Term: 1}}, 5, &pb.Snapshot{Metadata: pb.SnapshotMetadata{Index: 4, Term: 1}},