mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: add tests for IsLocalMsg (#6357)
* raft: add tests for IsLocalMsg * report index of failed tests
This commit is contained in:
parent
b24527f2f0
commit
ce49fb6ec4
@ -70,3 +70,35 @@ func TestLimitSize(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsLocalMsg(t *testing.T) {
|
||||
tests := []struct {
|
||||
msgt pb.MessageType
|
||||
isLocal bool
|
||||
}{
|
||||
{pb.MsgHup, true},
|
||||
{pb.MsgBeat, true},
|
||||
{pb.MsgUnreachable, true},
|
||||
{pb.MsgSnapStatus, true},
|
||||
{pb.MsgCheckQuorum, true},
|
||||
{pb.MsgTransferLeader, false},
|
||||
{pb.MsgProp, false},
|
||||
{pb.MsgApp, false},
|
||||
{pb.MsgAppResp, false},
|
||||
{pb.MsgVote, false},
|
||||
{pb.MsgVoteResp, false},
|
||||
{pb.MsgSnap, false},
|
||||
{pb.MsgHeartbeat, false},
|
||||
{pb.MsgHeartbeatResp, false},
|
||||
{pb.MsgTimeoutNow, false},
|
||||
{pb.MsgReadIndex, false},
|
||||
{pb.MsgReadIndexResp, false},
|
||||
}
|
||||
|
||||
for i, tt := range tests {
|
||||
got := IsLocalMsg(tt.msgt)
|
||||
if got != tt.isLocal {
|
||||
t.Errorf("#%d: got %v, want %v", i, got, tt.isLocal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user