grpc: google.golang.org/grpc/balancer/rls/internal/testutils/fakeserver Index | Files

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

Package Files

fakeserver.go

type Response Uses

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 Uses

type Server struct {
    RequestChan  chan *rlspb.RouteLookupRequest
    ResponseChan chan Response
    Address      string
}

Server is a fake implementation of RLS. It exposes channels to send/receive RLS requests and responses.

func Start Uses

func Start() (*Server, func(), error)

Start makes a new Server and gets it to start listening on a local port for gRPC requests. The returned cancel function should be invoked by the caller upon completion of the test.

func (*Server) ClientConn Uses

func (s *Server) ClientConn() (*grpc.ClientConn, func(), error)

ClientConn returns a grpc.ClientConn connected to the fakeServer.

func (*Server) RouteLookup Uses

func (s *Server) RouteLookup(ctx context.Context, req *rlspb.RouteLookupRequest) (*rlspb.RouteLookupResponse, error)

RouteLookup implements the RouteLookupService.

Package fakeserver imports 6 packages (graph). Updated 2020-03-16. Refresh now. Tools for package owners.