package fakeserver
import "google.golang.org/grpc/balancer/rls/internal/testutils/fakeserver"
Package fakeserver provides a fake implementation of the RouteLookupService, to be used in unit tests.
Index ¶
Types ¶
type Response ¶
type Response struct { Resp *rlspb.RouteLookupResponse Err error }
Response wraps the response protobuf (xds/LRS) and error that the Server should send out to the client through a call to stream.Send()
type Server ¶
type Server struct { rlsgrpc.UnimplementedRouteLookupServiceServer RequestChan *testutils.Channel ResponseChan chan Response Address string }
Server is a fake implementation of RLS. It exposes channels to send/receive RLS requests and responses.
func Start ¶
Start makes a new Server which uses the provided net.Listener. If lis is nil, it creates a new net.Listener on a local port. The returned cancel function should be invoked by the caller upon completion of the test.
func (*Server) ClientConn ¶
func (s *Server) ClientConn() (*grpc.ClientConn, func(), error)
ClientConn returns a grpc.ClientConn connected to the fakeServer.
func (*Server) RouteLookup ¶
func (s *Server) RouteLookup(ctx context.Context, req *rlspb.RouteLookupRequest) (*rlspb.RouteLookupResponse, error)
RouteLookup implements the RouteLookupService.
Source Files ¶
fakeserver.go
- Version
- v1.41.0-dev
- Published
- Jul 27, 2021
- Platform
- linux/amd64
- Imports
- 8 packages
- Last checked
- 36 minutes ago –
Tools for package owners.