Documentation ¶
Overview ¶
Package chk implements checks against the gRIBI client return values, it can be used to determine whether there are expected results within a specific set of return values.
Package chk relies on the testing package, and therefore is a test only package - that should be used as a helper to tets that are executed by 'go test'.
Index ¶
- func AllowUnimplemented() *allowUnimplemented
- func GetResponseHasEntries(t testing.TB, getres *spb.GetResponse, wants ...fluent.GRIBIEntry)
- func HasNRecvErrors(t testing.TB, err error, count int)
- func HasNSendErrors(t testing.TB, err error, count int)
- func HasRecvClientErrorWithStatus(t testing.TB, err error, want *status.Status, opts ...ErrorOpt)
- func HasResult(t testing.TB, res []*client.OpResult, want *client.OpResult, opt ...resultOpt)
- func HasResultsCache(t testing.TB, res, wants []*client.OpResult, opt ...resultOpt)
- func IgnoreDetails() *ignoreDetails
- func IgnoreOperationID() *ignoreOpID
- func IncludeServerError() *includeServerError
- type ErrorOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllowUnimplemented ¶
func AllowUnimplemented() *allowUnimplemented
AllowUnimplemented specifies that receive error with a particular status can be unimplemented OR the specified error type. It can be used to not return a fatal error when a server does not support a particular functionality. When AllowUnimplemented is specified, the details of the error are not checked.
func GetResponseHasEntries ¶
func GetResponseHasEntries(t testing.TB, getres *spb.GetResponse, wants ...fluent.GRIBIEntry)
GetResponseHasEntries checks whether the supplied GetResponse has the gRIBI entry described by the specified want within it. It calls t.Fatalf if no such entry is found.
func HasNRecvErrors ¶
HasNRecvErrors checks that the error contains N receive errors.
func HasNSendErrors ¶
HasNSendErrors checks that the error contains N sender errors.
func HasRecvClientErrorWithStatus ¶
HasRecvClientErrorWithStatus checks whether the supplied ClientErr ce contains a status with the code and details set to the values supplied in want.
TODO(robjs): Add unit test for this check.
func HasResult ¶
HasResult checks whether the specified res slice contains a result containing with the value of want.
func HasResultsCache ¶
HasResultsCache implements an efficient mechanism to call HasResults across a large set of operations results. HasResultsCache checks whether each result in wants is present in res, using the options specified.
func IgnoreDetails ¶
func IgnoreDetails() *ignoreDetails
IgnoreDetails set Details as nil in modifyError
func IgnoreOperationID ¶
func IgnoreOperationID() *ignoreOpID
IgnoreOperationID specifies that the comparison of OpResult structs should ignore the OperationID field. It can be used to match the occurrence of a transaction related to a particular prefix, NHG, or NH without caring about the order that the transaction was sent to the server.
func IncludeServerError ¶
func IncludeServerError() *includeServerError
IncludeServerError specifies that the comparison of OpResult structs should include the ServerError field, which includes a text error that the server supplied. Typically, such comparisons should not be used since they are likely to be implementation specific.