(t *testing.T)
| 37 | } |
| 38 | |
| 39 | func 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 | |
| 60 | func TestPoolCache(t *testing.T) { |
| 61 | buildCount := 0 |
nothing calls this directly
no test coverage detected