Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadRequestMatcher ¶
type BadRequestMatcher interface { Match(actual *errdetails.BadRequest) (bool, error) FailureMessage(actual *errdetails.BadRequest) string NegatedFailureMessage(actual *errdetails.BadRequest) string }
BadRequestMatcher abstracts a matcher specialized on errdetails.BadRequest types.
type ErrorInfoMatcher ¶
type ErrorInfoMatcher interface { Match(errInfo *errdetails.ErrorInfo) (bool, error) FailureMessage(errInfo *errdetails.ErrorInfo) string NegatedFailureMessage(errInfo *errdetails.ErrorInfo) string }
ErrorInfoMatcher abstracts a matcher specialized on errdetails.ErrorInfo types.
type GRPCBadRequestFieldViolation ¶
GRPCBadRequestFieldViolation tries matching the matching the Field of a given errdetails.BadRequest_FieldViolation. If the given Description is not empty, this will only match if both Field and Description match.
func (*GRPCBadRequestFieldViolation) FailureMessage ¶
func (m *GRPCBadRequestFieldViolation) FailureMessage(actual *errdetails.BadRequest) string
func (*GRPCBadRequestFieldViolation) Match ¶
func (m *GRPCBadRequestFieldViolation) Match(actual *errdetails.BadRequest) (bool, error)
func (*GRPCBadRequestFieldViolation) NegatedFailureMessage ¶
func (m *GRPCBadRequestFieldViolation) NegatedFailureMessage(actual *errdetails.BadRequest) string
type GRPCBadRequestMatcher ¶
type GRPCBadRequestMatcher struct {
// contains filtered or unexported fields
}
GRPCBadRequestMatcher implements a StatusMatcher that finds a errdetails.BadRequest instance on the given status.Status.
This is a helper for dealing with BadRequest matcher.
func (*GRPCBadRequestMatcher) FailureMessage ¶
func (m *GRPCBadRequestMatcher) FailureMessage(st *status.Status) string
func (*GRPCBadRequestMatcher) Match ¶
func (m *GRPCBadRequestMatcher) Match(st *status.Status) (bool, error)
func (*GRPCBadRequestMatcher) NegatedFailureMessage ¶
func (m *GRPCBadRequestMatcher) NegatedFailureMessage(st *status.Status) string
type GRPCErrorCodeMatcher ¶
type GRPCErrorCodeMatcher struct {
// contains filtered or unexported fields
}
func MatchGRPCStatusCode ¶
func MatchGRPCStatusCode(code codes.Code) *GRPCErrorCodeMatcher
MatchGRPCStatusCode expects an error to match the given code.
func (*GRPCErrorCodeMatcher) FailureMessage ¶
func (matcher *GRPCErrorCodeMatcher) FailureMessage(actual interface{}) (message string)
FailureMessage returns the error messages when this matcher does not receive an error, neither a status.Status or the status code does not match.
func (*GRPCErrorCodeMatcher) Match ¶
func (matcher *GRPCErrorCodeMatcher) Match(actual interface{}) (success bool, err error)
Match checks if the given actual is an error and a status.Status. If so, it tries to match the actual status code with the expected one.
func (*GRPCErrorCodeMatcher) NegatedFailureMessage ¶
func (matcher *GRPCErrorCodeMatcher) NegatedFailureMessage(actual interface{}) (message string)
NegatedFailureMessage returns the error messages when this matcher does not receive an error, neither a status.Status or the status code does not match negating the sentence.
type GRPCErrorInfoMatcher ¶
type GRPCErrorInfoMatcher struct {
// contains filtered or unexported fields
}
GRPCErrorInfoMatcher implements a StatusMatcher that finds a errdetails.ErrorInfo instance on the given status.Status.
This is a helper for dealing with ErrorInfo matcher.
func (*GRPCErrorInfoMatcher) FailureMessage ¶
func (m *GRPCErrorInfoMatcher) FailureMessage(st *status.Status) string
func (*GRPCErrorInfoMatcher) Match ¶
func (m *GRPCErrorInfoMatcher) Match(st *status.Status) (bool, error)
func (*GRPCErrorInfoMatcher) NegatedFailureMessage ¶
func (m *GRPCErrorInfoMatcher) NegatedFailureMessage(st *status.Status) string
type GRPCErrorInfoReasonMatcher ¶
type GRPCErrorInfoReasonMatcher struct { PropMap func(errInfo *errdetails.ErrorInfo) interface{} Matcher types.GomegaMatcher }
func (*GRPCErrorInfoReasonMatcher) FailureMessage ¶
func (m *GRPCErrorInfoReasonMatcher) FailureMessage(errInfo *errdetails.ErrorInfo) string
func (*GRPCErrorInfoReasonMatcher) Match ¶
func (m *GRPCErrorInfoReasonMatcher) Match(errInfo *errdetails.ErrorInfo) (bool, error)
func (*GRPCErrorInfoReasonMatcher) NegatedFailureMessage ¶
func (m *GRPCErrorInfoReasonMatcher) NegatedFailureMessage(errInfo *errdetails.ErrorInfo) string
type GRPCStatusMatcher ¶
type GRPCStatusMatcher struct {
// contains filtered or unexported fields
}
GRPCStatusMatcher implements a gomega.Matcher that makes creating status.Status checks easier by abstracting all the validation when receiving a Match call. Then, it uses the given functions (matchFunc, failureMessageFunc and negatedfailureMessageFunc) to extend its behaviour.
For reference, you can check MatchErrorInfoReason.
func NewGRPCMatchBadRequest ¶
func NewGRPCMatchBadRequest(matcher BadRequestMatcher) *GRPCStatusMatcher
func NewGRPCMatchErrorInfo ¶
func NewGRPCMatchErrorInfo(matcher ErrorInfoMatcher) *GRPCStatusMatcher
func NewGRPCStatusMatcher ¶
func NewGRPCStatusMatcher(statusMatcher StatusMatcher) *GRPCStatusMatcher
NewGRPCStatusMatcher is the constructor for the GRPCStatusMatcher.
func (*GRPCStatusMatcher) FailureMessage ¶
func (matcher *GRPCStatusMatcher) FailureMessage(actual interface{}) (message string)
func (*GRPCStatusMatcher) Match ¶
func (matcher *GRPCStatusMatcher) Match(actual interface{}) (success bool, err error)
Match validates if the given actual is a status.Status, if so it will call the matchFunc.
func (*GRPCStatusMatcher) NegatedFailureMessage ¶
func (matcher *GRPCStatusMatcher) NegatedFailureMessage(actual interface{}) (message string)
type GRPCStatusPropMatcher ¶
type GRPCStatusPropMatcher struct { PropMap func(status *status.Status) interface{} Matcher gomega.OmegaMatcher }
func (*GRPCStatusPropMatcher) FailureMessage ¶
func (matcher *GRPCStatusPropMatcher) FailureMessage(st *status.Status) string
func (*GRPCStatusPropMatcher) Match ¶
func (matcher *GRPCStatusPropMatcher) Match(st *status.Status) (bool, error)
func (*GRPCStatusPropMatcher) NegatedFailureMessage ¶
func (matcher *GRPCStatusPropMatcher) NegatedFailureMessage(st *status.Status) string
type ProtoEqualMatcher ¶
func (*ProtoEqualMatcher) FailureMessage ¶
func (matcher *ProtoEqualMatcher) FailureMessage(actual interface{}) (message string)
func (*ProtoEqualMatcher) Match ¶
func (matcher *ProtoEqualMatcher) Match(actual interface{}) (success bool, err error)
func (*ProtoEqualMatcher) NegatedFailureMessage ¶
func (matcher *ProtoEqualMatcher) NegatedFailureMessage(actual interface{}) (message string)