(t *testing.T)
| 25 | } |
| 26 | |
| 27 | func 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 | |
| 39 | func TestNoOrgId(t *testing.T) { |
| 40 | mockClientFn := func(ctx context.Context, _ *httpgrpc.HTTPRequest, _ ...grpc.CallOption) (*httpgrpc.HTTPResponse, error) { |
nothing calls this directly
no test coverage detected