If Watch returns Unimplemented, then the ClientConn should go into READY state.
(t *testing.T)
| 254 | |
| 255 | // If Watch returns Unimplemented, then the ClientConn should go into READY state. |
| 256 | func (s) TestHealthCheckHealthServerNotRegistered(t *testing.T) { |
| 257 | grpctest.ExpectError("Subchannel health check is unimplemented at server side, thus health check is disabled") |
| 258 | s := grpc.NewServer() |
| 259 | lis, err := net.Listen("tcp", "localhost:0") |
| 260 | if err != nil { |
| 261 | t.Fatalf("failed to listen due to err: %v", err) |
| 262 | } |
| 263 | go s.Serve(lis) |
| 264 | defer s.Stop() |
| 265 | |
| 266 | cc, r := setupClient(t, nil) |
| 267 | r.UpdateState(resolver.State{ |
| 268 | Addresses: []resolver.Address{{Addr: lis.Addr().String()}}, |
| 269 | ServiceConfig: parseServiceConfig(t, r, fmt.Sprintf(`{ |
| 270 | "healthCheckConfig": { |
| 271 | "serviceName": "foo" |
| 272 | }, |
| 273 | "loadBalancingConfig": [{"%s":{}}] |
| 274 | }`, roundrobin.Name))}) |
| 275 | |
| 276 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 277 | defer cancel() |
| 278 | testutils.AwaitNotState(ctx, t, cc, connectivity.Idle) |
| 279 | testutils.AwaitNotState(ctx, t, cc, connectivity.Connecting) |
| 280 | if s := cc.GetState(); s != connectivity.Ready { |
| 281 | t.Fatalf("ClientConn is in %v state, want READY", s) |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | // In the case of a goaway received, the health check stream should be terminated and health check |
| 286 | // function should exit. |
nothing calls this directly
no test coverage detected