Documentation ¶
Index ¶
- Variables
- type Instance
- type ParsedResponse
- type ParsedResponses
- func (r ParsedResponses) Check(check func(int, *ParsedResponse) error) error
- func (r ParsedResponses) CheckCluster(expected string) error
- func (r ParsedResponses) CheckClusterOrFail(t test.Failer, expected string) ParsedResponses
- func (r ParsedResponses) CheckCode(expected string) error
- func (r ParsedResponses) CheckCodeOrFail(t test.Failer, expected string) ParsedResponses
- func (r ParsedResponses) CheckHost(expected string) error
- func (r ParsedResponses) CheckHostOrFail(t test.Failer, expected string) ParsedResponses
- func (r ParsedResponses) CheckIP(expected string) error
- func (r ParsedResponses) CheckIPOrFail(t test.Failer, expected string) ParsedResponses
- func (r ParsedResponses) CheckKey(key, expected string) error
- func (r ParsedResponses) CheckMTLSForHTTP() error
- func (r ParsedResponses) CheckOK() error
- func (r ParsedResponses) CheckOKOrFail(t test.Failer) ParsedResponses
- func (r ParsedResponses) CheckOrFail(t test.Failer, check func(int, *ParsedResponse) error) ParsedResponses
- func (r ParsedResponses) CheckPort(expected int) error
- func (r ParsedResponses) CheckPortOrFail(t test.Failer, expected int) ParsedResponses
- func (r ParsedResponses) Count(text string) int
- func (r ParsedResponses) Len() int
- func (r ParsedResponses) Match(f func(r *ParsedResponse) bool) ParsedResponses
- func (r ParsedResponses) String() string
Constants ¶
This section is empty.
Variables ¶
var ( URLFieldRegex = regexp.MustCompile(string(response.URLField) + "=(.*)") ClusterFieldRegex = regexp.MustCompile(string(response.ClusterField) + "=(.*)") IstioVersionFieldRegex = regexp.MustCompile(string(response.IstioVersionField) + "=(.*)") IPFieldRegex = regexp.MustCompile(string(response.IPField) + "=(.*)") )
Functions ¶
This section is empty.
Types ¶
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance is a client of an Echo server that simplifies request/response processing for Forward commands.
func New ¶
func New(address string, tlsSettings *common.TLSSettings, extraDialOpts ...grpc.DialOption) (*Instance, error)
New creates a new echo client.Instance that is connected to the given server address.
func (*Instance) Echo ¶
func (c *Instance) Echo(ctx context.Context, request *proto.EchoRequest) (*ParsedResponse, error)
func (*Instance) ForwardEcho ¶
func (c *Instance) ForwardEcho(ctx context.Context, request *proto.ForwardEchoRequest) (ParsedResponses, error)
ForwardEcho sends the given forward request and parses the response for easier processing. Only fails if the request fails.
type ParsedResponse ¶
type ParsedResponse struct { // RequestURL is the requested URL. This differs from URL, which is the just the path. // For example, RequestURL=http://foo/bar, URL=/bar RequestURL string // Body is the body of the response Body string // ID is a unique identifier of the resource in the response ID string // URL is the url the request is sent to URL string // Version is the version of the resource in the response Version string // Port is the port of the resource in the response Port string // Code is the response code Code string // Host is the host called by the request Host string // Hostname is the host that responded to the request Hostname string // The cluster where the server is deployed. Cluster string // IstioVersion for the Istio sidecar. IstioVersion string // IP is the requester's ip address IP string // RawResponse gives a map of all values returned in the response (headers, etc) RawResponse map[string]string }
ParsedResponse represents a response to a single echo request.
func (*ParsedResponse) Count ¶
func (r *ParsedResponse) Count(text string) int
Count occurrences of the given text within the body of this response.
func (*ParsedResponse) IsOK ¶
func (r *ParsedResponse) IsOK() bool
IsOK indicates whether or not the code indicates a successful request.
func (*ParsedResponse) ResponseBody ¶
func (r *ParsedResponse) ResponseBody() []string
ResponseBody returns the body of the response, in order
func (*ParsedResponse) String ¶
func (r *ParsedResponse) String() string
type ParsedResponses ¶
type ParsedResponses []*ParsedResponse
ParsedResponses is an ordered list of parsed response objects.
func ParseForwardedResponse ¶
func ParseForwardedResponse(req *proto.ForwardEchoRequest, resp *proto.ForwardEchoResponse) ParsedResponses
func (ParsedResponses) Check ¶
func (r ParsedResponses) Check(check func(int, *ParsedResponse) error) error
func (ParsedResponses) CheckCluster ¶
func (r ParsedResponses) CheckCluster(expected string) error
func (ParsedResponses) CheckClusterOrFail ¶
func (r ParsedResponses) CheckClusterOrFail(t test.Failer, expected string) ParsedResponses
func (ParsedResponses) CheckCode ¶
func (r ParsedResponses) CheckCode(expected string) error
func (ParsedResponses) CheckCodeOrFail ¶
func (r ParsedResponses) CheckCodeOrFail(t test.Failer, expected string) ParsedResponses
func (ParsedResponses) CheckHost ¶
func (r ParsedResponses) CheckHost(expected string) error
func (ParsedResponses) CheckHostOrFail ¶
func (r ParsedResponses) CheckHostOrFail(t test.Failer, expected string) ParsedResponses
func (ParsedResponses) CheckIP ¶
func (r ParsedResponses) CheckIP(expected string) error
func (ParsedResponses) CheckIPOrFail ¶
func (r ParsedResponses) CheckIPOrFail(t test.Failer, expected string) ParsedResponses
func (ParsedResponses) CheckKey ¶
func (r ParsedResponses) CheckKey(key, expected string) error
func (ParsedResponses) CheckMTLSForHTTP ¶
func (r ParsedResponses) CheckMTLSForHTTP() error
CheckMTLSForHTTP asserts that mutual TLS was used. Note: this only is detectable for *successful* HTTP based traffic. Other types will always pass
func (ParsedResponses) CheckOK ¶
func (r ParsedResponses) CheckOK() error
func (ParsedResponses) CheckOKOrFail ¶
func (r ParsedResponses) CheckOKOrFail(t test.Failer) ParsedResponses
func (ParsedResponses) CheckOrFail ¶
func (r ParsedResponses) CheckOrFail(t test.Failer, check func(int, *ParsedResponse) error) ParsedResponses
func (ParsedResponses) CheckPort ¶
func (r ParsedResponses) CheckPort(expected int) error
func (ParsedResponses) CheckPortOrFail ¶
func (r ParsedResponses) CheckPortOrFail(t test.Failer, expected int) ParsedResponses
func (ParsedResponses) Count ¶
func (r ParsedResponses) Count(text string) int
Count occurrences of the given text within the bodies of all responses.
func (ParsedResponses) Len ¶
func (r ParsedResponses) Len() int
Len returns the length of the parsed responses.
func (ParsedResponses) Match ¶
func (r ParsedResponses) Match(f func(r *ParsedResponse) bool) ParsedResponses
Match returns a subset of ParsedResponses that match the given predicate.
func (ParsedResponses) String ¶
func (r ParsedResponses) String() string