MCPcopy Create free account
hub / github.com/cortexproject/cortex / TestTimeout

Function TestTimeout

pkg/ruler/frontend_client_test.go:27–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25}
26
27func TestTimeout(t *testing.T) {
28 mockClientFn := func(ctx context.Context, _ *httpgrpc.HTTPRequest, _ ...grpc.CallOption) (*httpgrpc.HTTPResponse, error) {
29 <-ctx.Done()
30 return nil, ctx.Err()
31 }
32 ctx := context.Background()
33 ctx = user.InjectOrgID(ctx, "userID")
34 frontendClient := NewFrontendClient(mockHTTPGRPCClient(mockClientFn), time.Second*5, "/prometheus", "json")
35 _, err := frontendClient.InstantQuery(ctx, "query", time.Now())
36 require.Equal(t, context.DeadlineExceeded, err)
37}
38
39func TestNoOrgId(t *testing.T) {
40 mockClientFn := func(ctx context.Context, _ *httpgrpc.HTTPRequest, _ ...grpc.CallOption) (*httpgrpc.HTTPResponse, error) {

Callers

nothing calls this directly

Calls 6

InstantQueryMethod · 0.95
mockHTTPGRPCClientFuncType · 0.85
DoneMethod · 0.80
NewFrontendClientFunction · 0.70
ErrMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected