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

Method TestPickFirst_OneBackend

balancer/pickfirst/pickfirst_ext_test.go:164–175  ·  view source on GitHub ↗

TestPickFirst_OneBackend tests the most basic scenario for pick_first. It brings up a single backend and verifies that all RPCs get routed to it.

(t *testing.T)

Source from the content-addressed store, hash-verified

162// TestPickFirst_OneBackend tests the most basic scenario for pick_first. It
163// brings up a single backend and verifies that all RPCs get routed to it.
164func (s) TestPickFirst_OneBackend(t *testing.T) {
165 cc, r, backends := setupPickFirst(t, 1)
166
167 addrs := stubBackendsToResolverAddrs(backends)
168 r.UpdateState(resolver.State{Addresses: addrs})
169
170 ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
171 defer cancel()
172 if err := pickfirst.CheckRPCsToBackend(ctx, cc, addrs[0]); err != nil {
173 t.Fatal(err)
174 }
175}
176
177// TestPickFirst_MultipleBackends tests the scenario with multiple backends and
178// verifies that all RPCs get routed to the first one.

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