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

Method TestPickFirst_MultipleBackends

balancer/pickfirst/pickfirst_ext_test.go:179–190  ·  view source on GitHub ↗

TestPickFirst_MultipleBackends tests the scenario with multiple backends and verifies that all RPCs get routed to the first one.

(t *testing.T)

Source from the content-addressed store, hash-verified

177// TestPickFirst_MultipleBackends tests the scenario with multiple backends and
178// verifies that all RPCs get routed to the first one.
179func (s) TestPickFirst_MultipleBackends(t *testing.T) {
180 cc, r, backends := setupPickFirst(t, 2)
181
182 addrs := stubBackendsToResolverAddrs(backends)
183 r.UpdateState(resolver.State{Addresses: addrs})
184
185 ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
186 defer cancel()
187 if err := pickfirst.CheckRPCsToBackend(ctx, cc, addrs[0]); err != nil {
188 t.Fatal(err)
189 }
190}
191
192// TestPickFirst_OneServerDown tests the scenario where we have multiple
193// backends and pick_first is working as expected. Verifies that RPCs get routed

Callers

nothing calls this directly

Calls 5

CheckRPCsToBackendFunction · 0.92
setupPickFirstFunction · 0.85
UpdateStateMethod · 0.65
FatalMethod · 0.65

Tested by

no test coverage detected