Documentation ¶
Index ¶
- type ClientDecoratorTest
- type ClientDecoratorTestOption
- type MiddlewareScenarioContext
- type TestClient
- func (c *TestClient) CallResource(ctx context.Context, req *backend.CallResourceRequest, ...) error
- func (c *TestClient) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
- func (c *TestClient) CollectMetrics(ctx context.Context, req *backend.CollectMetricsRequest) (*backend.CollectMetricsResult, error)
- func (c *TestClient) PublishStream(ctx context.Context, req *backend.PublishStreamRequest) (*backend.PublishStreamResponse, error)
- func (c *TestClient) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (c *TestClient) RunStream(ctx context.Context, req *backend.RunStreamRequest, ...) error
- func (c *TestClient) SubscribeStream(ctx context.Context, req *backend.SubscribeStreamRequest) (*backend.SubscribeStreamResponse, error)
- type TestMiddleware
- func (m *TestMiddleware) CallResource(ctx context.Context, req *backend.CallResourceRequest, ...) error
- func (m *TestMiddleware) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
- func (m *TestMiddleware) CollectMetrics(ctx context.Context, req *backend.CollectMetricsRequest) (*backend.CollectMetricsResult, error)
- func (m *TestMiddleware) PublishStream(ctx context.Context, req *backend.PublishStreamRequest) (*backend.PublishStreamResponse, error)
- func (m *TestMiddleware) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (m *TestMiddleware) RunStream(ctx context.Context, req *backend.RunStreamRequest, ...) error
- func (m *TestMiddleware) SubscribeStream(ctx context.Context, req *backend.SubscribeStreamRequest) (*backend.SubscribeStreamResponse, error)
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 (c *TestClient) CallResource(ctx context.Context, req *backend.CallResourceRequest, sender backend.CallResourceResponseSender) error
func (*TestClient) CheckHealth ¶
func (c *TestClient) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
func (*TestClient) CollectMetrics ¶
func (c *TestClient) CollectMetrics(ctx context.Context, req *backend.CollectMetricsRequest) (*backend.CollectMetricsResult, error)
func (*TestClient) PublishStream ¶
func (c *TestClient) PublishStream(ctx context.Context, req *backend.PublishStreamRequest) (*backend.PublishStreamResponse, error)
func (*TestClient) QueryData ¶
func (c *TestClient) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
func (*TestClient) RunStream ¶
func (c *TestClient) RunStream(ctx context.Context, req *backend.RunStreamRequest, sender *backend.StreamSender) error
func (*TestClient) SubscribeStream ¶
func (c *TestClient) SubscribeStream(ctx context.Context, req *backend.SubscribeStreamRequest) (*backend.SubscribeStreamResponse, error)
type TestMiddleware ¶
type TestMiddleware struct { Name string // contains filtered or unexported fields }
func (*TestMiddleware) CallResource ¶
func (m *TestMiddleware) CallResource(ctx context.Context, req *backend.CallResourceRequest, sender backend.CallResourceResponseSender) error
func (*TestMiddleware) CheckHealth ¶
func (m *TestMiddleware) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
func (*TestMiddleware) CollectMetrics ¶
func (m *TestMiddleware) CollectMetrics(ctx context.Context, req *backend.CollectMetricsRequest) (*backend.CollectMetricsResult, error)
func (*TestMiddleware) PublishStream ¶
func (m *TestMiddleware) PublishStream(ctx context.Context, req *backend.PublishStreamRequest) (*backend.PublishStreamResponse, error)
func (*TestMiddleware) QueryData ¶
func (m *TestMiddleware) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
func (*TestMiddleware) RunStream ¶
func (m *TestMiddleware) RunStream(ctx context.Context, req *backend.RunStreamRequest, sender *backend.StreamSender) error
func (*TestMiddleware) SubscribeStream ¶
func (m *TestMiddleware) SubscribeStream(ctx context.Context, req *backend.SubscribeStreamRequest) (*backend.SubscribeStreamResponse, error)
Click to show internal directories.
Click to hide internal directories.