mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #4362 from gyuho/leaky_raft
raft: fix leaky goroutines in raft test
This commit is contained in:
commit
1ab99206bc
@ -26,6 +26,7 @@ func saveToDisk(ents []pb.Entry) {}
|
||||
func ExampleNode() {
|
||||
c := &Config{}
|
||||
n := StartNode(c, nil)
|
||||
defer n.Stop()
|
||||
|
||||
// stuff to n happens in other goroutines
|
||||
|
||||
|
@ -330,6 +330,7 @@ func TestNodeStart(t *testing.T) {
|
||||
MaxInflightMsgs: 256,
|
||||
}
|
||||
n := StartNode(c, []Peer{{ID: 1}})
|
||||
defer n.Stop()
|
||||
n.Campaign(ctx)
|
||||
g := <-n.Ready()
|
||||
if !reflect.DeepEqual(g, wants[0]) {
|
||||
@ -379,6 +380,7 @@ func TestNodeRestart(t *testing.T) {
|
||||
MaxInflightMsgs: 256,
|
||||
}
|
||||
n := RestartNode(c)
|
||||
defer n.Stop()
|
||||
if g := <-n.Ready(); !reflect.DeepEqual(g, want) {
|
||||
t.Errorf("g = %+v,\n w %+v", g, want)
|
||||
}
|
||||
@ -423,6 +425,7 @@ func TestNodeRestartFromSnapshot(t *testing.T) {
|
||||
MaxInflightMsgs: 256,
|
||||
}
|
||||
n := RestartNode(c)
|
||||
defer n.Stop()
|
||||
if g := <-n.Ready(); !reflect.DeepEqual(g, want) {
|
||||
t.Errorf("g = %+v,\n w %+v", g, want)
|
||||
} else {
|
||||
@ -450,6 +453,7 @@ func TestNodeAdvance(t *testing.T) {
|
||||
MaxInflightMsgs: 256,
|
||||
}
|
||||
n := StartNode(c, []Peer{{ID: 1}})
|
||||
defer n.Stop()
|
||||
n.Campaign(ctx)
|
||||
<-n.Ready()
|
||||
n.Propose(ctx, []byte("foo"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user