chk

package
v0.0.0-...-4f307a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 13 Imported by: 2

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

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

func HasNRecvErrors(t testing.TB, err error, count int)

HasNRecvErrors checks that the error contains N receive errors.

func HasNSendErrors

func HasNSendErrors(t testing.TB, err error, count int)

HasNSendErrors checks that the error contains N sender errors.

func HasRecvClientErrorWithStatus

func HasRecvClientErrorWithStatus(t testing.TB, err error, want *status.Status, opts ...ErrorOpt)

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

func HasResult(t testing.TB, res []*client.OpResult, want *client.OpResult, opt ...resultOpt)

HasResult checks whether the specified res slice contains a result containing with the value of want.

func HasResultsCache

func HasResultsCache(t testing.TB, res, wants []*client.OpResult, opt ...resultOpt)

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.

Types

type ErrorOpt

type ErrorOpt interface {
	// contains filtered or unexported methods
}

ErrorOpt is an interface that is implemented by functions that examine errrors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL