From e7adfb0ebf6ef42593556c44a969a096db1897ce Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Wed, 9 May 2018 15:18:57 -0700 Subject: [PATCH] raft: use different parameters for tests Signed-off-by: Gyuho Lee --- raft/raft_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/raft/raft_test.go b/raft/raft_test.go index 6540d0f72..7fe05e4e9 100644 --- a/raft/raft_test.go +++ b/raft/raft_test.go @@ -1182,7 +1182,7 @@ func TestCommit(t *testing.T) { storage.Append(tt.logs) storage.hardState = pb.HardState{Term: tt.smTerm} - sm := newTestRaft(1, []uint64{1}, 5, 1, storage) + sm := newTestRaft(1, []uint64{1}, 10, 2, storage) for j := 0; j < len(tt.matches); j++ { sm.setProgress(uint64(j)+1, tt.matches[j], tt.matches[j]+1, false) } @@ -2733,7 +2733,7 @@ func TestRestoreWithLearner(t *testing.T) { } storage := NewMemoryStorage() - sm := newTestLearnerRaft(3, []uint64{1, 2}, []uint64{3}, 10, 1, storage) + sm := newTestLearnerRaft(3, []uint64{1, 2}, []uint64{3}, 8, 2, storage) if ok := sm.restore(s); !ok { t.Error("restore fail, want succeed") } @@ -4070,16 +4070,16 @@ func (nw *network) drop(from, to uint64, perc float64) { } func (nw *network) cut(one, other uint64) { - nw.drop(one, other, 1) - nw.drop(other, one, 1) + nw.drop(one, other, 2.0) // always drop + nw.drop(other, one, 2.0) // always drop } func (nw *network) isolate(id uint64) { for i := 0; i < len(nw.peers); i++ { nid := uint64(i) + 1 if nid != id { - nw.drop(id, nid, 1.0) - nw.drop(nid, id, 1.0) + nw.drop(id, nid, 1.0) // always drop + nw.drop(nid, id, 1.0) // always drop } } }