|
@@ -400,7 +400,7 @@ func testServer(t *testing.T, ns int64) {
|
|
|
Storage: &storageRecorder{},
|
|
Storage: &storageRecorder{},
|
|
|
Ticker: tk.C,
|
|
Ticker: tk.C,
|
|
|
}
|
|
}
|
|
|
- srv.Start()
|
|
|
|
|
|
|
+ srv.start()
|
|
|
// TODO(xiangli): randomize election timeout
|
|
// TODO(xiangli): randomize election timeout
|
|
|
// then remove this sleep.
|
|
// then remove this sleep.
|
|
|
time.Sleep(1 * time.Millisecond)
|
|
time.Sleep(1 * time.Millisecond)
|
|
@@ -469,7 +469,7 @@ func TestDoProposal(t *testing.T) {
|
|
|
Storage: &storageRecorder{},
|
|
Storage: &storageRecorder{},
|
|
|
Ticker: tk,
|
|
Ticker: tk,
|
|
|
}
|
|
}
|
|
|
- srv.Start()
|
|
|
|
|
|
|
+ srv.start()
|
|
|
resp, err := srv.Do(ctx, tt)
|
|
resp, err := srv.Do(ctx, tt)
|
|
|
srv.Stop()
|
|
srv.Stop()
|
|
|
|
|
|
|
@@ -539,7 +539,7 @@ func TestDoProposalStopped(t *testing.T) {
|
|
|
Storage: &storageRecorder{},
|
|
Storage: &storageRecorder{},
|
|
|
Ticker: tk,
|
|
Ticker: tk,
|
|
|
}
|
|
}
|
|
|
- srv.Start()
|
|
|
|
|
|
|
+ srv.start()
|
|
|
|
|
|
|
|
done := make(chan struct{})
|
|
done := make(chan struct{})
|
|
|
var err error
|
|
var err error
|
|
@@ -639,7 +639,7 @@ func TestSyncTrigger(t *testing.T) {
|
|
|
Storage: &storageRecorder{},
|
|
Storage: &storageRecorder{},
|
|
|
SyncTicker: st,
|
|
SyncTicker: st,
|
|
|
}
|
|
}
|
|
|
- srv.Start()
|
|
|
|
|
|
|
+ srv.start()
|
|
|
// trigger the server to become a leader and accept sync requests
|
|
// trigger the server to become a leader and accept sync requests
|
|
|
n.readyc <- raft.Ready{
|
|
n.readyc <- raft.Ready{
|
|
|
SoftState: &raft.SoftState{
|
|
SoftState: &raft.SoftState{
|
|
@@ -710,7 +710,7 @@ func TestTriggerSnap(t *testing.T) {
|
|
|
SnapCount: 10,
|
|
SnapCount: 10,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- s.Start()
|
|
|
|
|
|
|
+ s.start()
|
|
|
for i := 0; int64(i) < s.SnapCount; i++ {
|
|
for i := 0; int64(i) < s.SnapCount; i++ {
|
|
|
s.Do(ctx, pb.Request{Method: "PUT", ID: 1})
|
|
s.Do(ctx, pb.Request{Method: "PUT", ID: 1})
|
|
|
}
|
|
}
|
|
@@ -741,7 +741,7 @@ func TestRecvSnapshot(t *testing.T) {
|
|
|
Node: n,
|
|
Node: n,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- s.Start()
|
|
|
|
|
|
|
+ s.start()
|
|
|
n.readyc <- raft.Ready{Snapshot: raftpb.Snapshot{Index: 1}}
|
|
n.readyc <- raft.Ready{Snapshot: raftpb.Snapshot{Index: 1}}
|
|
|
// make goroutines move forward to receive snapshot
|
|
// make goroutines move forward to receive snapshot
|
|
|
pkg.ForceGosched()
|
|
pkg.ForceGosched()
|
|
@@ -769,7 +769,7 @@ func TestRecvSlowSnapshot(t *testing.T) {
|
|
|
Node: n,
|
|
Node: n,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- s.Start()
|
|
|
|
|
|
|
+ s.start()
|
|
|
n.readyc <- raft.Ready{Snapshot: raftpb.Snapshot{Index: 1}}
|
|
n.readyc <- raft.Ready{Snapshot: raftpb.Snapshot{Index: 1}}
|
|
|
// make goroutines move forward to receive snapshot
|
|
// make goroutines move forward to receive snapshot
|
|
|
pkg.ForceGosched()
|
|
pkg.ForceGosched()
|
|
@@ -794,7 +794,7 @@ func TestAddNode(t *testing.T) {
|
|
|
Send: func(_ []raftpb.Message) {},
|
|
Send: func(_ []raftpb.Message) {},
|
|
|
Storage: &storageRecorder{},
|
|
Storage: &storageRecorder{},
|
|
|
}
|
|
}
|
|
|
- s.Start()
|
|
|
|
|
|
|
+ s.start()
|
|
|
s.AddNode(context.TODO(), 1, []byte("foo"))
|
|
s.AddNode(context.TODO(), 1, []byte("foo"))
|
|
|
gaction := n.Action()
|
|
gaction := n.Action()
|
|
|
s.Stop()
|
|
s.Stop()
|
|
@@ -814,7 +814,7 @@ func TestRemoveNode(t *testing.T) {
|
|
|
Send: func(_ []raftpb.Message) {},
|
|
Send: func(_ []raftpb.Message) {},
|
|
|
Storage: &storageRecorder{},
|
|
Storage: &storageRecorder{},
|
|
|
}
|
|
}
|
|
|
- s.Start()
|
|
|
|
|
|
|
+ s.start()
|
|
|
s.RemoveNode(context.TODO(), 1)
|
|
s.RemoveNode(context.TODO(), 1)
|
|
|
gaction := n.Action()
|
|
gaction := n.Action()
|
|
|
s.Stop()
|
|
s.Stop()
|