Documentation ¶
Overview ¶
Package testutil provides many test helpers/assertions used to simplify common testing patterns.
Index ¶
- func DiffErr(op string, resp interface{}, compare interface{}, t *testing.T, ...)
- func FatalOnErr(op string, e error, t *testing.T)
- func FatalOnNoErr(op string, e error, t *testing.T)
- func ResolvePath(t *testing.T, path string) string
- func WantErr(op string, err error, want bool, t *testing.T)
- type FakeClientStream
- type FakeServerStream
- func (f *FakeServerStream) Context() context.Context
- func (*FakeServerStream) RecvMsg(interface{}) error
- func (*FakeServerStream) SendHeader(metadata.MD) error
- func (*FakeServerStream) SendMsg(interface{}) error
- func (*FakeServerStream) SetHeader(metadata.MD) error
- func (*FakeServerStream) SetTrailer(metadata.MD)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiffErr ¶
DiffErr compares 2 messages (including optional transforms) and throws a testing Fatal on diff. This assumes they are usually proto messages so will automatically include protocmp.Transform() for the caller. It's harmless for the non-proto case. Reduces 3 lines to 1 for common error checking.
func FatalOnErr ¶
FatalOnErr is a testing helper function to test and abort on an error. Reduces 3 lines to 1 for common error checking.
func FatalOnNoErr ¶
FatalOnNoErr is a testing helper function to test and abort when we get no error. Reduces 3 lines to 1 for common error checking.
func ResolvePath ¶
ResolvePath takes a binary name and attempts to resolve it for testing or fatal out.
Types ¶
type FakeClientStream ¶
type FakeClientStream struct{}
FakeClientStream provides a null ClientStream for testing.
func (*FakeClientStream) CloseSend ¶
func (*FakeClientStream) CloseSend() error
CloseSend - see grpc.ClientStream
func (*FakeClientStream) Context ¶
func (*FakeClientStream) Context() context.Context
Context - see grpc.ClientStream
func (*FakeClientStream) Header ¶
func (*FakeClientStream) Header() (metadata.MD, error)
Header - see grpc.ClientStream
func (*FakeClientStream) RecvMsg ¶
func (*FakeClientStream) RecvMsg(interface{}) error
RecvMsg - see grpc.ClientStream
func (*FakeClientStream) SendMsg ¶
func (*FakeClientStream) SendMsg(interface{}) error
SendMsg - see grpc.ClientStream
func (*FakeClientStream) Trailer ¶
func (*FakeClientStream) Trailer() metadata.MD
Trailer - see grpc.ClientStream
type FakeServerStream ¶
FakeServerStream provides a null ServerStream for testing
func (*FakeServerStream) Context ¶
func (f *FakeServerStream) Context() context.Context
Context - see grpc.ServerStream
func (*FakeServerStream) RecvMsg ¶
func (*FakeServerStream) RecvMsg(interface{}) error
RecvMsg - see grpc.ServerStream
func (*FakeServerStream) SendHeader ¶
func (*FakeServerStream) SendHeader(metadata.MD) error
SendHeader - see grpc.ServerStream
func (*FakeServerStream) SendMsg ¶
func (*FakeServerStream) SendMsg(interface{}) error
SendMsg - see grpc.ServerStream
func (*FakeServerStream) SetHeader ¶
func (*FakeServerStream) SetHeader(metadata.MD) error
SetHeader - see grpc.ServerStream
func (*FakeServerStream) SetTrailer ¶
func (*FakeServerStream) SetTrailer(metadata.MD)
SetTrailer - see grpc.ServerStream