Example #1
0
func testHealthCheckOnFailure(t *testing.T, e env) {
	s, cc := setUp(true, math.MaxUint32, e)
	defer tearDown(s, cc)
	if err := health.HealthCheck(0*time.Second, cc); err != grpc.Errorf(codes.DeadlineExceeded, "context deadline exceeded") {
		t.Fatalf("HealthCheck(_)=_, %v, want error code %d", err, codes.DeadlineExceeded)
	}
}
Example #2
0
func testHealthCheckOnSuccess(t *testing.T, e env) {
	s, cc := setUp(true, math.MaxUint32, e)
	defer tearDown(s, cc)
	if err := health.HealthCheck(1*time.Second, cc); err != nil {
		t.Fatalf("HealthCheck(_)=_, %v, want <nil>", err)
	}
}
Example #3
0
func testHealthCheckOff(t *testing.T, e env) {
	s, cc := setUp(false, math.MaxUint32, e)
	defer tearDown(s, cc)
	err := health.HealthCheck(1*time.Second, cc)
	if err != grpc.Errorf(codes.Unimplemented, "unknown service grpc.health.HealthCheck") {
		t.Fatalf("HealthCheck(_)=_, %v, want error code %d", err, codes.DeadlineExceeded)
	}
}