TestEndpoints_SharedAddress tests the case where two endpoints have the same address. The expected behavior is undefined, however the program should not crash.
(t *testing.T)
| 464 | // address. The expected behavior is undefined, however the program should not |
| 465 | // crash. |
| 466 | func (s) TestEndpoints_SharedAddress(t *testing.T) { |
| 467 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 468 | defer cancel() |
| 469 | |
| 470 | srv := startServer(t, reportCall) |
| 471 | sc := svcConfig(t, perCallConfig) |
| 472 | if err := srv.StartClient(grpc.WithDefaultServiceConfig(sc)); err != nil { |
| 473 | t.Fatalf("Error starting client: %v", err) |
| 474 | } |
| 475 | |
| 476 | endpointsSharedAddress := []resolver.Endpoint{{Addresses: []resolver.Address{{Addr: srv.Address}}}, {Addresses: []resolver.Address{{Addr: srv.Address}}}} |
| 477 | srv.R.UpdateState(resolver.State{Endpoints: endpointsSharedAddress}) |
| 478 | |
| 479 | // Make some RPC's and make sure doesn't crash. It should go to one of the |
| 480 | // endpoints addresses, it's undefined which one it will choose and the load |
| 481 | // reporting might not work, but it should be able to make an RPC. |
| 482 | for i := 0; i < 10; i++ { |
| 483 | if _, err := srv.Client.EmptyCall(ctx, &testpb.Empty{}); err != nil { |
| 484 | t.Fatalf("EmptyCall failed with err: %v", err) |
| 485 | } |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | // TestEndpoints_MultipleAddresses tests WRR on endpoints with numerous |
| 490 | // addresses. It configures WRR with two endpoints with one bad address followed |
nothing calls this directly
no test coverage detected