Documentation ¶
Index ¶
- func GetLoopbackAddr(port int) string
- func GetLoopbackIp() string
- func SetupEnvoy(t *testing.T, adsAddress string, portmaps ...string)
- func SetupServer(t *testing.T, handler http.Handler, addresses ...string)
- type EnvoyController
- func (e *EnvoyController) Configure(node, version string, snapshot cache.Snapshot) *status.Status
- func (e *EnvoyController) Debugf(format string, args ...interface{})
- func (e *EnvoyController) Errorf(format string, args ...interface{})
- func (e EnvoyController) ID(node *core.Node) string
- func (e *EnvoyController) Infof(format string, args ...interface{})
- func (e *EnvoyController) OnFetchRequest(_ context.Context, r *v2.DiscoveryRequest) error
- func (e *EnvoyController) OnFetchResponse(req *v2.DiscoveryRequest, res *v2.DiscoveryResponse)
- func (e *EnvoyController) OnStreamClosed(sid int64)
- func (e *EnvoyController) OnStreamOpen(_ context.Context, sid int64, stype string) error
- func (e *EnvoyController) OnStreamRequest(sid int64, req *v2.DiscoveryRequest) error
- func (e *EnvoyController) OnStreamResponse(sid int64, req *v2.DiscoveryRequest, res *v2.DiscoveryResponse)
- func (e *EnvoyController) Run(ctx context.Context) error
- func (e *EnvoyController) Warnf(format string, args ...interface{})
- type Prefixer
- type RequestLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLoopbackAddr ¶
func GetLoopbackIp ¶
func GetLoopbackIp() string
func SetupEnvoy ¶
SetupEnvoy launches an envoy docker container that is configured to connect to the supplied ads address and expose the supplied portmaps. A Cleanup function is registered to shutdown the container at the end of the test suite.
Types ¶
type EnvoyController ¶
type EnvoyController struct {
// contains filtered or unexported fields
}
EnvoyController runs a go control plane for envoy that tracks ACKS/NACKS for configuration updates. This allows code to know when envoy has successfully reconfigured as well as have access to the error details when envoy is fed invalid configuration.
func NewEnvoyController ¶
func NewEnvoyController(address string) *EnvoyController
NewEnvoyControler creates a new envoy controller that binds to the supplied address when Run.
func SetupEnvoyController ¶
func SetupEnvoyController(t *testing.T, address string) *EnvoyController
SetupEnvoyController will create and run an EnvoyController with the supplied address as well as registering a Cleanup function to shutdown the EnvoyController.
func (*EnvoyController) Configure ¶
func (e *EnvoyController) Configure(node, version string, snapshot cache.Snapshot) *status.Status
Configure will update the envoy configuration and block until the reconfiguration either succeeds or signals an error.
func (*EnvoyController) Debugf ¶
func (e *EnvoyController) Debugf(format string, args ...interface{})
The go control plane requires a logger to be injected. These methods implement the logger interface.
func (*EnvoyController) Errorf ¶
func (e *EnvoyController) Errorf(format string, args ...interface{})
func (EnvoyController) ID ¶
func (e EnvoyController) ID(node *core.Node) string
ID is a callback function that the go control plane uses. I don't know what it does.
func (*EnvoyController) Infof ¶
func (e *EnvoyController) Infof(format string, args ...interface{})
func (*EnvoyController) OnFetchRequest ¶
func (e *EnvoyController) OnFetchRequest(_ context.Context, r *v2.DiscoveryRequest) error
OnFetchRequest is called for each Fetch request
func (*EnvoyController) OnFetchResponse ¶
func (e *EnvoyController) OnFetchResponse(req *v2.DiscoveryRequest, res *v2.DiscoveryResponse)
OnFetchResponse is called immediately prior to sending a response.
func (*EnvoyController) OnStreamClosed ¶
func (e *EnvoyController) OnStreamClosed(sid int64)
OnStreamClosed is called immediately prior to closing an xDS stream with a stream ID.
func (*EnvoyController) OnStreamOpen ¶
OnStreamOpen is called once an xDS stream is open with a stream ID and the type URL (or "" for ADS).
func (*EnvoyController) OnStreamRequest ¶
func (e *EnvoyController) OnStreamRequest(sid int64, req *v2.DiscoveryRequest) error
OnStreamRequest is called once a request is received on a stream.
func (*EnvoyController) OnStreamResponse ¶
func (e *EnvoyController) OnStreamResponse(sid int64, req *v2.DiscoveryRequest, res *v2.DiscoveryResponse)
OnStreamResponse is called immediately prior to sending a response on a stream.
func (*EnvoyController) Run ¶
func (e *EnvoyController) Run(ctx context.Context) error
Run the ADS server.
func (*EnvoyController) Warnf ¶
func (e *EnvoyController) Warnf(format string, args ...interface{})
type RequestLogger ¶
func NewRequestLogger ¶
func NewRequestLogger() *RequestLogger
func SetupRequestLogger ¶
func SetupRequestLogger(t *testing.T, addresses ...string) *RequestLogger
SetupRequestLogger will launch an http server that binds to the supplied addresses, responds with the supplied body, and records every request it receives for later examination.
func (*RequestLogger) Log ¶
func (rl *RequestLogger) Log(r *http.Request)
func (*RequestLogger) ServeHTTP ¶
func (rl *RequestLogger) ServeHTTP(w http.ResponseWriter, r *http.Request)