Documentation ¶
Overview ¶
Package fakexds provides a very basic fake implementation of the xDS server for unit testing purposes.
Index ¶
- type LRSServer
- type Request
- type Response
- type Server
- func (fs *Server) DeltaAggregatedResources(adsgrpc.AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error
- func (fs *Server) GetClientConn(t *testing.T) (*grpc.ClientConn, func())
- func (fs *Server) StreamAggregatedResources(s adsgrpc.AggregatedDiscoveryService_StreamAggregatedResourcesServer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LRSServer ¶
type LRSServer struct { // ReportingInterval will be sent in the first response to control reporting // interval. ReportingInterval *durationpb.Duration // ExpectedEDSClusterName is checked against the first LRS request. The RPC // is failed if they don't match. ExpectedEDSClusterName string // contains filtered or unexported fields }
LRSServer implements the LRS service, and is to be installed on the fakexds server. It collects load reports, and returned them later for comparison.
func (*LRSServer) StreamLoadStats ¶
func (lrss *LRSServer) StreamLoadStats(stream lrsgrpc.LoadReportingService_StreamLoadStatsServer) error
StreamLoadStats implements LRS service.
type Request ¶
type Request struct { Req *discoverypb.DiscoveryRequest Err error }
Request wraps an xDS request and error.
type Response ¶
type Response struct { Resp *discoverypb.DiscoveryResponse Err error }
Response wraps an xDS response and error.
type Server ¶
type Server struct { // RequestChan is a buffered channel on which the fake server writes the // received requests onto. RequestChan chan *Request // ResponseChan is a buffered channel from which the fake server reads the // responses that it must send out to the client. ResponseChan chan *Response // Address is the host:port on which the fake xdsServer is listening on. Address string // LRS is the LRS server installed. LRS *LRSServer }
Server is a very basic implementation of a fake xDS server. It provides a request and response channel for the user to control the requests that are expected and the responses that needs to be sent out.
func StartServer ¶
StartServer starts a fakexds.Server. The returned function should be invoked by the caller once the test is done.
func (*Server) DeltaAggregatedResources ¶
func (fs *Server) DeltaAggregatedResources(adsgrpc.AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error
DeltaAggregatedResources helps implement the ADS service.
func (*Server) GetClientConn ¶
func (fs *Server) GetClientConn(t *testing.T) (*grpc.ClientConn, func())
GetClientConn returns a grpc.ClientConn talking to the fake server. The returned function should be invoked by the caller once the test is done.
func (*Server) StreamAggregatedResources ¶
func (fs *Server) StreamAggregatedResources(s adsgrpc.AggregatedDiscoveryService_StreamAggregatedResourcesServer) error
StreamAggregatedResources is the fake implementation to handle an ADS stream.