Documentation ¶
Index ¶
- func CompareRequest(cReq *roundtripper.CapturedRequest, cRes *roundtripper.CapturedResponse, ...) error
- func MakeRequestAndExpectEventuallyConsistentResponse(t *testing.T, r roundtripper.RoundTripper, gwAddr string, ...)
- func WaitForConsistentResponse(t *testing.T, r roundtripper.RoundTripper, req roundtripper.Request, ...)
- type ExpectedRequest
- type ExpectedResponse
- type Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareRequest ¶
func CompareRequest(cReq *roundtripper.CapturedRequest, cRes *roundtripper.CapturedResponse, expected ExpectedResponse) error
func MakeRequestAndExpectEventuallyConsistentResponse ¶
func MakeRequestAndExpectEventuallyConsistentResponse(t *testing.T, r roundtripper.RoundTripper, gwAddr string, expected ExpectedResponse)
MakeRequestAndExpectEventuallyConsistentResponse makes a request with the given parameters, understanding that the request may fail for some amount of time.
Once the request succeeds consistently with the response having the expected status code, make additional assertions on the response body using the provided ExpectedResponse.
func WaitForConsistentResponse ¶
func WaitForConsistentResponse(t *testing.T, r roundtripper.RoundTripper, req roundtripper.Request, expected ExpectedResponse, threshold int)
WaitForConsistentResponse repeats the provided request until it completes with a response having the expected response consistently. The provided threshold determines how many times in a row this must occur to be considered "consistent".
Types ¶
type ExpectedRequest ¶
type ExpectedRequest struct { Request // AbsentHeaders are names of headers that are expected // *not* to be present on the request. AbsentHeaders []string }
ExpectedRequest defines expected properties of a request.
type ExpectedResponse ¶
type ExpectedResponse struct { // Request defines the request to make. Request Request // ExpectedRequest defines the request that // is expected to arrive at the backend. If // not specified, the backend request will be // expected to match Request. ExpectedRequest *ExpectedRequest StatusCode int Backend string Namespace string }
ExpectedResponse defines the response expected for a given request.