...

Package pickfirst

import "google.golang.org/grpc/internal/testutils/pickfirst"
Overview
Index

Overview ▾

Package pickfirst contains helper functions to check for pickfirst load balancing of RPCs in tests.

func CheckRPCsToBackend

func CheckRPCsToBackend(ctx context.Context, cc *grpc.ClientConn, wantAddr resolver.Address) error

CheckRPCsToBackend makes a bunch of RPCs on the given ClientConn and verifies if the RPCs are routed to a peer matching wantAddr.

Returns a non-nil error if context deadline expires before all RPCs begin to be routed to the peer matching wantAddr, or if the backend returns RPC errors.