handlertest

package
v0.259.4 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	QueryDataFunc         backend.QueryDataHandlerFunc
	CallResourceFunc      backend.CallResourceHandlerFunc
	CheckHealthFunc       backend.CheckHealthHandlerFunc
	CollectMetricsFunc    backend.CollectMetricsHandlerFunc
	SubscribeStreamFunc   backend.SubscribeStreamHandlerFunc
	PublishStreamFunc     backend.PublishStreamHandlerFunc
	RunStreamFunc         backend.RunStreamHandlerFunc
	MutateAdmissionFunc   backend.MutateAdmissionFunc
	ValidateAdmissionFunc backend.ValidateAdmissionFunc
	ConvertObjectsFunc    backend.ConvertObjectsFunc
}

Handler a test handler implementing backend.Handler.

func (Handler) CallResource

func (Handler) CheckHealth

func (Handler) CollectMetrics

func (Handler) ConvertObjects

func (Handler) MutateAdmission

func (h Handler) MutateAdmission(ctx context.Context, req *backend.AdmissionRequest) (*backend.MutationResponse, error)

func (Handler) PublishStream

func (Handler) QueryData

func (Handler) RunStream

func (h Handler) RunStream(ctx context.Context, req *backend.RunStreamRequest, sender *backend.StreamSender) error

func (Handler) ValidateAdmission

func (h Handler) ValidateAdmission(ctx context.Context, req *backend.AdmissionRequest) (*backend.ValidationResponse, error)

type HandlerMiddlewareTest

type HandlerMiddlewareTest struct {
	T                      *testing.T
	TestHandler            *Handler
	Middlewares            []backend.HandlerMiddleware
	MiddlewareHandler      *backend.MiddlewareHandler
	QueryDataReq           *backend.QueryDataRequest
	QueryDataCtx           context.Context
	CallResourceReq        *backend.CallResourceRequest
	CallResourceCtx        context.Context
	CheckHealthReq         *backend.CheckHealthRequest
	CheckHealthCtx         context.Context
	CollectMetricsReq      *backend.CollectMetricsRequest
	CollectMetricsCtx      context.Context
	SubscribeStreamReq     *backend.SubscribeStreamRequest
	SubscribeStreamCtx     context.Context
	PublishStreamReq       *backend.PublishStreamRequest
	PublishStreamCtx       context.Context
	RunStreamReq           *backend.RunStreamRequest
	RunStreamCtx           context.Context
	MutateAdmissionReq     *backend.AdmissionRequest
	MutateAdmissionCtx     context.Context
	ValidationAdmissionReq *backend.AdmissionRequest
	ValidateAdmissionCtx   context.Context
	ConvertObjectReq       *backend.ConversionRequest
	ConvertObjectCtx       context.Context
	// contains filtered or unexported fields
}

func NewHandlerMiddlewareTest

func NewHandlerMiddlewareTest(t *testing.T, opts ...HandlerMiddlewareTestOption) *HandlerMiddlewareTest

type HandlerMiddlewareTestOption

type HandlerMiddlewareTestOption func(*HandlerMiddlewareTest)

func WithMiddlewares

func WithMiddlewares(middlewares ...backend.HandlerMiddleware) HandlerMiddlewareTestOption

WithMiddlewares HandlerMiddlewareTestOption option to append middlewares to HandlerMiddlewareTest.

func WithResourceResponses

func WithResourceResponses(responses []*backend.CallResourceResponse) HandlerMiddlewareTestOption

WithResourceResponses can be used to make the test client send simulated resource responses back over the sender stream.

func WithRunStreamBytesResponses

func WithRunStreamBytesResponses(responses [][]byte) HandlerMiddlewareTestOption

WithRunStreamBytesResponses can be used to make the test client send simulated bytes responses back over the sender stream.

func WithRunStreamJSONResponses

func WithRunStreamJSONResponses(responses [][]byte) HandlerMiddlewareTestOption

WithRunStreamJSONResponses can be used to make the test client send simulated JSON responses back over the sender stream.

Jump to

Keyboard shortcuts

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