Documentation
¶
Index ¶
- func HaveErrorInfoDomain(matcher types.GomegaMatcher) *matchersimpl.GRPCStatusMatcher
- func HaveErrorInfoMetadata(matcher types.GomegaMatcher) *matchersimpl.GRPCStatusMatcher
- func HaveErrorInfoReason(matcher types.GomegaMatcher) *matchersimpl.GRPCStatusMatcher
- func HaveFieldViolation(fieldAndDescription ...string) *matchersimpl.GRPCStatusMatcher
- func HaveStatusCode(matcher types.GomegaMatcher) *matchersimpl.GRPCStatusMatcher
- func HaveStatusMessage(matcher types.GomegaMatcher) *matchersimpl.GRPCStatusMatcher
- func ProtoEqual(m proto.Message) types.GomegaMatcher
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HaveErrorInfoDomain ¶
func HaveErrorInfoDomain(matcher types.GomegaMatcher) *matchersimpl.GRPCStatusMatcher
HaveErrorInfoDomain will match the *errdetails.ErrorInfo Reason property against the given matcher.
Example ¶
st, err := status.New(codes.Internal, "message").WithDetails(&errdetails.ErrorInfo{ Domain: "some domain", }) Expect(err).ToNot(HaveOccurred()) Expect(st).To(HaveErrorInfoDomain(Equal("some domain")))
Output:
func HaveErrorInfoMetadata ¶
func HaveErrorInfoMetadata(matcher types.GomegaMatcher) *matchersimpl.GRPCStatusMatcher
HaveErrorInfoMetadata will match the *errdetails.ErrorInfo Reason property against the given matcher.
Example ¶
st, err := status.New(codes.Internal, "message").WithDetails(&errdetails.ErrorInfo{ Metadata: map[string]string{ "key1": "value1", }, }) Expect(err).ToNot(HaveOccurred()) Expect(st).To(HaveErrorInfoMetadata(HaveKey("key1")))
Output:
func HaveErrorInfoReason ¶
func HaveErrorInfoReason(matcher types.GomegaMatcher) *matchersimpl.GRPCStatusMatcher
HaveErrorInfoReason will match the *errdetails.ErrorInfo Reason property against the given matcher.
Example ¶
st, err := status.New(codes.Internal, "message").WithDetails(&errdetails.ErrorInfo{ Reason: "some reason", }) Expect(err).ToNot(HaveOccurred()) Expect(st).To(HaveErrorInfoReason(Equal("some reason")))
Output:
func HaveFieldViolation ¶
func HaveFieldViolation(fieldAndDescription ...string) *matchersimpl.GRPCStatusMatcher
HaveFieldValidation matches a given field and description (if informed) for a given errdetails.BadRequest or errdetails.BadRequest_FieldViolation[] or errdetails.BadRequest_FieldViolation.
func HaveStatusCode ¶
func HaveStatusCode(matcher types.GomegaMatcher) *matchersimpl.GRPCStatusMatcher
HaveStatusCode will match the *status.Status Code property against the given matcher.
Example ¶
err := status.New(codes.Internal, "message").Err() Expect(err).To(HaveStatusCode(Equal(codes.Internal)))
Output:
func HaveStatusMessage ¶
func HaveStatusMessage(matcher types.GomegaMatcher) *matchersimpl.GRPCStatusMatcher
HaveStatusMessage will match the *status.Status Message property against the given matcher.
Example ¶
err := status.New(codes.Internal, "this is a message").Err() Expect(err).To(HaveStatusMessage(Equal("this is a message"))) Expect(err).To(HaveStatusMessage(ContainSubstring("message")))
Output:
func ProtoEqual ¶
func ProtoEqual(m proto.Message) types.GomegaMatcher
ProtoEqual is the matcher for comparing proto.Message values. This matcher is powered by the proto.Equal function, provided by the default GRPC implementation.
Example ¶
errInfo := &errdetails.ErrorInfo{ Reason: "some reason", } Expect(errInfo).To(ProtoEqual(&errdetails.ErrorInfo{ Reason: "some reason", }))
Output:
Types ¶
This section is empty.