clienttest

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientDecoratorTest

type ClientDecoratorTest struct {
	T                  *testing.T
	Context            context.Context
	TestClient         *TestClient
	Middlewares        []plugins.ClientMiddleware
	Decorator          *client.Decorator
	ReqContext         *contextmodel.ReqContext
	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
	// contains filtered or unexported fields
}

func NewClientDecoratorTest

func NewClientDecoratorTest(t *testing.T, opts ...ClientDecoratorTestOption) *ClientDecoratorTest

type ClientDecoratorTestOption

type ClientDecoratorTestOption func(*ClientDecoratorTest)

func WithMiddlewares

func WithMiddlewares(middlewares ...plugins.ClientMiddleware) ClientDecoratorTestOption

func WithReqContext

func WithReqContext(req *http.Request, user *user.SignedInUser) ClientDecoratorTestOption

func WithResourceResponses

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

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

type MiddlewareScenarioContext

type MiddlewareScenarioContext struct {
	QueryDataCallChain       []string
	CallResourceCallChain    []string
	CollectMetricsCallChain  []string
	CheckHealthCallChain     []string
	SubscribeStreamCallChain []string
	PublishStreamCallChain   []string
	RunStreamCallChain       []string
}

func (*MiddlewareScenarioContext) NewMiddleware

func (ctx *MiddlewareScenarioContext) NewMiddleware(name string) plugins.ClientMiddleware

type TestClient

type TestClient struct {
	plugins.Client
	QueryDataFunc       backend.QueryDataHandlerFunc
	CallResourceFunc    backend.CallResourceHandlerFunc
	CheckHealthFunc     backend.CheckHealthHandlerFunc
	CollectMetricsFunc  backend.CollectMetricsHandlerFunc
	SubscribeStreamFunc func(ctx context.Context, req *backend.SubscribeStreamRequest) (*backend.SubscribeStreamResponse, error)
	PublishStreamFunc   func(ctx context.Context, req *backend.PublishStreamRequest) (*backend.PublishStreamResponse, error)
	RunStreamFunc       func(ctx context.Context, req *backend.RunStreamRequest, sender *backend.StreamSender) error
}

func (*TestClient) CallResource

func (*TestClient) CheckHealth

func (*TestClient) CollectMetrics

func (*TestClient) PublishStream

func (*TestClient) QueryData

func (*TestClient) RunStream

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

func (*TestClient) SubscribeStream

type TestMiddleware

type TestMiddleware struct {
	Name string
	// contains filtered or unexported fields
}

func (*TestMiddleware) CallResource

func (*TestMiddleware) CheckHealth

func (*TestMiddleware) CollectMetrics

func (*TestMiddleware) PublishStream

func (*TestMiddleware) QueryData

func (*TestMiddleware) RunStream

func (*TestMiddleware) SubscribeStream

Jump to

Keyboard shortcuts

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