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

Function TestHealthCheck

pkg/ring/client/pool_test.go:39–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestHealthCheck(t *testing.T) {
40 tcs := []struct {
41 client mockClient
42 hasError bool
43 }{
44 {mockClient{happy: true, status: grpc_health_v1.HealthCheckResponse_UNKNOWN}, true},
45 {mockClient{happy: true, status: grpc_health_v1.HealthCheckResponse_SERVING}, false},
46 {mockClient{happy: true, status: grpc_health_v1.HealthCheckResponse_NOT_SERVING}, true},
47 {mockClient{happy: false, status: grpc_health_v1.HealthCheckResponse_UNKNOWN}, true},
48 {mockClient{happy: false, status: grpc_health_v1.HealthCheckResponse_SERVING}, true},
49 {mockClient{happy: false, status: grpc_health_v1.HealthCheckResponse_NOT_SERVING}, true},
50 }
51 for _, tc := range tcs {
52 err := healthCheck(tc.client, 50*time.Millisecond)
53 hasError := err != nil
54 if hasError != tc.hasError {
55 t.Errorf("Expected error: %t, error: %v", tc.hasError, err)
56 }
57 }
58}
59
60func TestPoolCache(t *testing.T) {
61 buildCount := 0

Callers

nothing calls this directly

Calls 1

healthCheckFunction · 0.70

Tested by

no test coverage detected