tests: Use cmp.Equal to avoid mutating arguments
parent
c836905a1d
commit
43c1631f26
|
@ -179,6 +179,15 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"project": "github.com/google/go-cmp/cmp",
|
||||||
|
"licenses": [
|
||||||
|
{
|
||||||
|
"type": "BSD 3-clause \"New\" or \"Revised\" License",
|
||||||
|
"confidence": 0.9663865546218487
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"project": "github.com/gorilla/websocket",
|
"project": "github.com/gorilla/websocket",
|
||||||
"licenses": [
|
"licenses": [
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -48,6 +48,7 @@ require (
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
github.com/google/btree v1.0.1 // indirect
|
github.com/google/btree v1.0.1 // indirect
|
||||||
|
github.com/google/go-cmp v0.5.6 // indirect
|
||||||
github.com/gorilla/websocket v1.4.2 // indirect
|
github.com/gorilla/websocket v1.4.2 // indirect
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
|
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
|
||||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
|
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
|
||||||
|
@ -81,6 +82,7 @@ require (
|
||||||
golang.org/x/net v0.0.0-20220105145211-5b0dc2dfae98 // indirect
|
golang.org/x/net v0.0.0-20220105145211-5b0dc2dfae98 // indirect
|
||||||
golang.org/x/sys v0.0.0-20211123173158-ef496fb156ab // indirect
|
golang.org/x/sys v0.0.0-20211123173158-ef496fb156ab // indirect
|
||||||
golang.org/x/text v0.3.7 // indirect
|
golang.org/x/text v0.3.7 // indirect
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect
|
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect
|
||||||
google.golang.org/protobuf v1.27.1 // indirect
|
google.golang.org/protobuf v1.27.1 // indirect
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
||||||
|
|
|
@ -58,6 +58,8 @@ import (
|
||||||
"go.uber.org/zap/zapcore"
|
"go.uber.org/zap/zapcore"
|
||||||
"go.uber.org/zap/zaptest"
|
"go.uber.org/zap/zaptest"
|
||||||
|
|
||||||
|
"github.com/google/go-cmp/cmp"
|
||||||
|
"github.com/google/go-cmp/cmp/cmpopts"
|
||||||
"github.com/soheilhy/cmux"
|
"github.com/soheilhy/cmux"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
@ -483,16 +485,7 @@ func (c *Cluster) waitVersion() {
|
||||||
func isMembersEqual(membs []*pb.Member, wmembs []*pb.Member) bool {
|
func isMembersEqual(membs []*pb.Member, wmembs []*pb.Member) bool {
|
||||||
sort.Sort(SortableMemberSliceByPeerURLs(membs))
|
sort.Sort(SortableMemberSliceByPeerURLs(membs))
|
||||||
sort.Sort(SortableMemberSliceByPeerURLs(wmembs))
|
sort.Sort(SortableMemberSliceByPeerURLs(wmembs))
|
||||||
for i := range membs {
|
return cmp.Equal(membs, wmembs, cmpopts.IgnoreFields(pb.Member{}, "ID", "PeerURLs", "ClientURLs"))
|
||||||
membs[i].ID = 0
|
|
||||||
if membs[i].PeerURLs == nil {
|
|
||||||
membs[i].PeerURLs = []string{}
|
|
||||||
}
|
|
||||||
if membs[i].ClientURLs == nil {
|
|
||||||
membs[i].ClientURLs = []string{}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return reflect.DeepEqual(membs, wmembs)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func newLocalListener(t testutil.TB) net.Listener {
|
func newLocalListener(t testutil.TB) net.Listener {
|
||||||
|
|
|
@ -19,6 +19,7 @@ require (
|
||||||
github.com/dustin/go-humanize v1.0.0
|
github.com/dustin/go-humanize v1.0.0
|
||||||
github.com/gogo/protobuf v1.3.2
|
github.com/gogo/protobuf v1.3.2
|
||||||
github.com/golang/protobuf v1.5.2
|
github.com/golang/protobuf v1.5.2
|
||||||
|
github.com/google/go-cmp v0.5.6
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
|
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
|
||||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
|
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0
|
github.com/grpc-ecosystem/grpc-gateway v1.16.0
|
||||||
|
@ -77,6 +78,7 @@ require (
|
||||||
golang.org/x/net v0.0.0-20220105145211-5b0dc2dfae98 // indirect
|
golang.org/x/net v0.0.0-20220105145211-5b0dc2dfae98 // indirect
|
||||||
golang.org/x/sys v0.0.0-20211123173158-ef496fb156ab // indirect
|
golang.org/x/sys v0.0.0-20211123173158-ef496fb156ab // indirect
|
||||||
golang.org/x/text v0.3.7 // indirect
|
golang.org/x/text v0.3.7 // indirect
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect
|
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect
|
||||||
google.golang.org/protobuf v1.27.1 // indirect
|
google.golang.org/protobuf v1.27.1 // indirect
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
||||||
|
|
Loading…
Reference in New Issue