diff --git a/go.mod b/go.mod index 2d8f9ed72..34ee17e6b 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/kubernetes-csi/csi-lib-utils v0.19.0 - github.com/kubernetes-csi/csi-test/v5 v5.3.0 + github.com/kubernetes-csi/csi-test/v5 v5.3.1 google.golang.org/grpc v1.66.2 k8s.io/api v0.31.0 k8s.io/apimachinery v0.31.0 diff --git a/go.sum b/go.sum index 87016e876..49454c7de 100644 --- a/go.sum +++ b/go.sum @@ -71,8 +71,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kubernetes-csi/csi-lib-utils v0.19.0 h1:3sT8mL9+St2acyrEtuR7CQ5L78GR4lgsb+sfon9tGfA= github.com/kubernetes-csi/csi-lib-utils v0.19.0/go.mod h1:lBuMKvoyd8c3EG+itmnVWApLDHnLkU7ibxxZSPuOw0M= -github.com/kubernetes-csi/csi-test/v5 v5.3.0 h1:IbF3om4KZxH1KHvy+KfqJ7ZrdjYNLntAVkQXYra+9iM= -github.com/kubernetes-csi/csi-test/v5 v5.3.0/go.mod h1:NKklMyStHq8o5I30YCXxS7+v/Z4LRoft553EXR6zMS8= +github.com/kubernetes-csi/csi-test/v5 v5.3.1 h1:Wiukp1In+kif+BFo6q2ExjgB+MbrAz4jZWzGfijypuY= +github.com/kubernetes-csi/csi-test/v5 v5.3.1/go.mod h1:7hA2cSYJ6T8CraEZPA6zqkLZwemjBD54XAnPsPC3VpA= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= diff --git a/vendor/github.com/kubernetes-csi/csi-test/v5/utils/protobuf_matcher.go b/vendor/github.com/kubernetes-csi/csi-test/v5/utils/protobuf_matcher.go new file mode 100644 index 000000000..5a2a70165 --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/v5/utils/protobuf_matcher.go @@ -0,0 +1,33 @@ +package utils + +import ( + "github.com/golang/mock/gomock" + "google.golang.org/protobuf/encoding/prototext" + "google.golang.org/protobuf/proto" +) + +// Protobuf returns a Matcher that relies upon proto.Equal to compare Protobuf messages +// Example usage with mocked request: +// +// example.EXPECT().ExampleRequest(Protobuf(requestMsg)).Return(responseMsg, nil).AnyTimes() +func Protobuf(msg proto.Message) gomock.Matcher { + return &ProtobufMatcher{msg} +} + +type ProtobufMatcher struct { + msg proto.Message +} + +var _ gomock.Matcher = &ProtobufMatcher{} + +func (p *ProtobufMatcher) Matches(x interface{}) bool { + otherMsg, ok := x.(proto.Message) + if !ok { + return false + } + return proto.Equal(p.msg, otherMsg) +} + +func (p *ProtobufMatcher) String() string { + return prototext.Format(p.msg) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index d5036bea3..e0f176aa7 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -114,7 +114,7 @@ github.com/kubernetes-csi/csi-lib-utils/leaderelection github.com/kubernetes-csi/csi-lib-utils/metrics github.com/kubernetes-csi/csi-lib-utils/protosanitizer github.com/kubernetes-csi/csi-lib-utils/rpc -# github.com/kubernetes-csi/csi-test/v5 v5.3.0 +# github.com/kubernetes-csi/csi-test/v5 v5.3.1 ## explicit; go 1.18 github.com/kubernetes-csi/csi-test/v5/driver github.com/kubernetes-csi/csi-test/v5/utils