Documentation
¶
Index ¶
- func CompareObjects(actual interface{}, expected interface{}) error
- func FailOnError(t *testing.T, err error)
- func FailOnNil(t *testing.T, obj interface{})
- func GenerateUPIRequest(n int, m int) *upiv1.PredictValuesRequest
- func MakeTestMisisonControlResponse() mchttp.Response
- func MakeTestRequest(t *testing.T, httpRequestModifier func(*http.Request)) *http.Request
- func NopHTTPRequestModifier(_ *http.Request)
- func ReadFile(filepath string) ([]byte, error)
- func RunTestUPIHttpServer(port int)
- func RunTestUPIServer(port int) *grpc.Server
- type GrpcTestServer
- type HTTPTestServer
- type MemorySink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareObjects ¶
func CompareObjects(actual interface{}, expected interface{}) error
CompareObjects checks equality of 2 objects and returns a formatted error on failure. If the object types have unexported fields, a custom marshaler is required to be defined.
func FailOnError ¶
FailOnError logs the error and terminates the test immediately
func FailOnNil ¶
FailOnNil terminates the test immediately if the argument is nil and logs the reason
func GenerateUPIRequest ¶
func GenerateUPIRequest(n int, m int) *upiv1.PredictValuesRequest
func MakeTestMisisonControlResponse ¶
MakeTestMisisonControlResponse makes a success response with a dummy json body for testing
func MakeTestRequest ¶
MakeTestRequest creates a dummy request for testing
func NopHTTPRequestModifier ¶
NopHTTPRequestModifier makes no modification to the input request
func RunTestUPIHttpServer ¶
func RunTestUPIHttpServer(port int)
func RunTestUPIServer ¶
Types ¶
type GrpcTestServer ¶
type GrpcTestServer struct { }
func (*GrpcTestServer) PredictValues ¶
func (s *GrpcTestServer) PredictValues( _ context.Context, req *upiv1.PredictValuesRequest, ) (*upiv1.PredictValuesResponse, error)
type HTTPTestServer ¶
type HTTPTestServer struct { }
func (*HTTPTestServer) ServeHTTP ¶
func (h *HTTPTestServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type MemorySink ¶
MemorySink implements zap.Sink by writing all messages to a buffer.
func NewLoggerWithMemorySink ¶
func NewLoggerWithMemorySink() (*zap.SugaredLogger, *MemorySink, error)
NewLoggerWithMemorySink creates a new zap logger with a memory sink, to which all output is redirected. Calling sink.String() / sink.Bytes() ... will give access to its contents.
func (*MemorySink) Close ¶
func (s *MemorySink) Close() error
Close is a nop method to satisfy the zap.Sink interface
func (*MemorySink) Sync ¶
func (s *MemorySink) Sync() error
Sync is a nop method to satisfy the zap.Sink interface