mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: add a single candidate test
This commit is contained in:
@@ -195,6 +195,16 @@ func TestCandidateConcede(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSingleNodeCandidate(t *testing.T) {
|
||||
tt := newNetwork(nil)
|
||||
tt.Step(Message{To: 0, Type: msgHup})
|
||||
|
||||
sm := tt.ss[0].(*nsm)
|
||||
if sm.state != stateLeader {
|
||||
t.Errorf("state = %d, want %d", sm.state, stateLeader)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOldMessages(t *testing.T) {
|
||||
tt := newNetwork(nil, nil, nil)
|
||||
// make 0 leader @ term 3
|
||||
|
||||
Reference in New Issue
Block a user