(t *testing.T)
| 461 | } |
| 462 | |
| 463 | func (s) TestResolverServiceConfigBeforeAddressNotPanic(t *testing.T) { |
| 464 | r := manual.NewBuilderWithScheme("whatever") |
| 465 | |
| 466 | cc, err := NewClient(r.Scheme()+":///test.server", WithTransportCredentials(insecure.NewCredentials()), WithResolvers(r)) |
| 467 | if err != nil { |
| 468 | t.Fatalf("grpc.NewClient() failed: %v", err) |
| 469 | } |
| 470 | defer cc.Close() |
| 471 | cc.Connect() |
| 472 | // SwitchBalancer before NewAddress. There was no balancer created, this |
| 473 | // makes sure we don't call close on nil balancerWrapper. |
| 474 | r.UpdateState(resolver.State{ServiceConfig: r.CC().ParseServiceConfig(grpclbServiceConfig)}) // This should not panic. |
| 475 | |
| 476 | time.Sleep(time.Second) // Sleep to make sure the service config is handled by ClientConn. |
| 477 | } |
| 478 | |
| 479 | func (s) TestResolverServiceConfigWhileClosingNotPanic(t *testing.T) { |
| 480 | for i := 0; i < 10; i++ { // Run this multiple times to make sure it doesn't panic. |
nothing calls this directly
no test coverage detected