MCPcopy
hub / github.com/grpc/grpc-go / testHealthCheckDisableWithServiceConfig

Function testHealthCheckDisableWithServiceConfig

test/healthcheck_test.go:732–755  ·  view source on GitHub ↗
(t *testing.T, addr string)

Source from the content-addressed store, hash-verified

730}
731
732func testHealthCheckDisableWithServiceConfig(t *testing.T, addr string) {
733 hcEnterChan, _ := setupHealthCheckWrapper(t)
734 cc, r := setupClient(t, &clientConfig{})
735 tc := testgrpc.NewTestServiceClient(cc)
736 r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: addr}}})
737
738 ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
739 defer cancel()
740 // send some rpcs to make sure transport has been created and is ready for use.
741 if err := verifyResultWithDelay(func() (bool, error) {
742 if _, err := tc.EmptyCall(ctx, &testpb.Empty{}); err != nil {
743 return false, fmt.Errorf("TestService/EmptyCall(_, _) = _, %v, want _, <nil>", err)
744 }
745 return true, nil
746 }); err != nil {
747 t.Fatal(err)
748 }
749
750 select {
751 case <-hcEnterChan:
752 t.Fatal("Health check function has started, which is not expected.")
753 default:
754 }
755}
756
757func (s) TestHealthCheckDisable(t *testing.T) {
758 _, lis, ts := setupServer(t, nil)

Callers 1

Calls 7

EmptyCallMethod · 0.95
setupHealthCheckWrapperFunction · 0.85
setupClientFunction · 0.85
verifyResultWithDelayFunction · 0.70
UpdateStateMethod · 0.65
ErrorfMethod · 0.65
FatalMethod · 0.65

Tested by

no test coverage detected