checkRPCSendOK sends num RPCs to the client. It returns a map of backend addresses as keys and number of RPCs sent to this address as value. Abort the test if any RPC fails.
(ctx context.Context, t *testing.T, client testgrpc.TestServiceClient, num int)
| 241 | // addresses as keys and number of RPCs sent to this address as value. Abort the |
| 242 | // test if any RPC fails. |
| 243 | func checkRPCSendOK(ctx context.Context, t *testing.T, client testgrpc.TestServiceClient, num int) map[string]int { |
| 244 | t.Helper() |
| 245 | |
| 246 | backendCount := make(map[string]int) |
| 247 | for i := 0; i < num; i++ { |
| 248 | var remote peer.Peer |
| 249 | if _, err := client.EmptyCall(ctx, &testpb.Empty{}, grpc.Peer(&remote)); err != nil { |
| 250 | t.Fatalf("rpc EmptyCall() failed: %v", err) |
| 251 | } |
| 252 | backendCount[remote.Addr.String()]++ |
| 253 | } |
| 254 | return backendCount |
| 255 | } |
| 256 | |
| 257 | // makeUnreachableBackends returns a slice of addresses of backends that close |
| 258 | // connections as soon as they are established. Useful to simulate servers that |
no test coverage detected