mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: replace 'reflect.DeepEqual' with bytes.Equal
This commit is contained in:
parent
ec5c5d9ddf
commit
4ff6c72257
@ -15,6 +15,7 @@
|
||||
package raft
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
@ -137,7 +138,7 @@ func TestNodePropose(t *testing.T) {
|
||||
if msgs[0].Type != raftpb.MsgProp {
|
||||
t.Errorf("msg type = %d, want %d", msgs[0].Type, raftpb.MsgProp)
|
||||
}
|
||||
if !reflect.DeepEqual(msgs[0].Entries[0].Data, []byte("somedata")) {
|
||||
if !bytes.Equal(msgs[0].Entries[0].Data, []byte("somedata")) {
|
||||
t.Errorf("data = %v, want %v", msgs[0].Entries[0].Data, []byte("somedata"))
|
||||
}
|
||||
}
|
||||
@ -165,7 +166,7 @@ func TestNodeReadIndex(t *testing.T) {
|
||||
t.Errorf("ReadIndex = %d, want %d", rd.Index, wreadIndex)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(rd.RequestCtx, wrequestCtx) {
|
||||
if !bytes.Equal(rd.RequestCtx, wrequestCtx) {
|
||||
t.Errorf("RequestCtx = %v, want %v", rd.RequestCtx, wrequestCtx)
|
||||
}
|
||||
|
||||
@ -189,7 +190,7 @@ func TestNodeReadIndex(t *testing.T) {
|
||||
if msgs[0].Type != raftpb.MsgReadIndex {
|
||||
t.Errorf("msg type = %d, want %d", msgs[0].Type, raftpb.MsgReadIndex)
|
||||
}
|
||||
if !reflect.DeepEqual(msgs[0].Entries[0].Data, wrequestCtx) {
|
||||
if !bytes.Equal(msgs[0].Entries[0].Data, wrequestCtx) {
|
||||
t.Errorf("data = %v, want %v", msgs[0].Entries[0].Data, wrequestCtx)
|
||||
}
|
||||
}
|
||||
@ -232,7 +233,7 @@ func TestNodeProposeConfig(t *testing.T) {
|
||||
if msgs[0].Type != raftpb.MsgProp {
|
||||
t.Errorf("msg type = %d, want %d", msgs[0].Type, raftpb.MsgProp)
|
||||
}
|
||||
if !reflect.DeepEqual(msgs[0].Entries[0].Data, ccdata) {
|
||||
if !bytes.Equal(msgs[0].Entries[0].Data, ccdata) {
|
||||
t.Errorf("data = %v, want %v", msgs[0].Entries[0].Data, ccdata)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user