Documentation ¶
Index ¶
- func HttpGet(t *testing.T, url string) (int, string)
- func HttpGetE(t *testing.T, url string) (int, string, error)
- func HttpGetWithCustomValidation(t *testing.T, url string, validateResponse func(int, string) bool)
- func HttpGetWithCustomValidationE(t *testing.T, url string, validateResponse func(int, string) bool) error
- func HttpGetWithRetry(t *testing.T, url string, expectedStatus int, expectedBody string, retries int, ...)
- func HttpGetWithRetryE(t *testing.T, url string, expectedStatus int, expectedBody string, retries int, ...) error
- func HttpGetWithRetryWithCustomValidation(t *testing.T, url string, retries int, sleepBetweenRetries time.Duration, ...)
- func HttpGetWithRetryWithCustomValidationE(t *testing.T, url string, retries int, sleepBetweenRetries time.Duration, ...) error
- func HttpGetWithValidation(t *testing.T, url string, expectedStatusCode int, expectedBody string)
- func HttpGetWithValidationE(t *testing.T, url string, expectedStatusCode int, expectedBody string) error
- func RunDummyServer(t *testing.T, text string) (net.Listener, int)
- func RunDummyServerE(t *testing.T, text string) (net.Listener, int, error)
- type ValidationFunctionFailed
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HttpGet ¶
Perform an HTTP GET on the given URL and return the HTTP status code and body. If there's any error, fail the test.
func HttpGetE ¶
Perform an HTTP GET on the given URL and return the HTTP status code, body, and any error.
func HttpGetWithCustomValidation ¶
Perform an HTTP GET on the given URL and validate the returned status code and body using the given function.
func HttpGetWithCustomValidationE ¶
func HttpGetWithCustomValidationE(t *testing.T, url string, validateResponse func(int, string) bool) error
Perform an HTTP GET on the given URL and validate the returned status code and body using the given function.
func HttpGetWithRetry ¶
func HttpGetWithRetry(t *testing.T, url string, expectedStatus int, expectedBody string, retries int, sleepBetweenRetries time.Duration)
Repeatedly perform an HTTP GET on the given URL until the given status code and body are returned or until max retries has been exceeded.
func HttpGetWithRetryE ¶
func HttpGetWithRetryE(t *testing.T, url string, expectedStatus int, expectedBody string, retries int, sleepBetweenRetries time.Duration) error
Repeatedly perform an HTTP GET on the given URL until the given status code and body are returned or until max retries has been exceeded.
func HttpGetWithRetryWithCustomValidation ¶
func HttpGetWithRetryWithCustomValidation(t *testing.T, url string, retries int, sleepBetweenRetries time.Duration, validateResponse func(int, string) bool)
Repeatedly perform an HTTP GET on the given URL until the given validation function returns true or max retries has been exceeded.
func HttpGetWithRetryWithCustomValidationE ¶
func HttpGetWithRetryWithCustomValidationE(t *testing.T, url string, retries int, sleepBetweenRetries time.Duration, validateResponse func(int, string) bool) error
Repeatedly perform an HTTP GET on the given URL until the given validation function returns true or max retries has been exceeded.
func HttpGetWithValidation ¶
Perform an HTTP GET on the given URL and verify that you get back the expected status code and body. If either doesn't match, fail the test.
func HttpGetWithValidationE ¶
func HttpGetWithValidationE(t *testing.T, url string, expectedStatusCode int, expectedBody string) error
Perform an HTTP GET on the given URL and verify that you get back the expected status code and body. If either doesn't match, return an error.
func RunDummyServer ¶
Run a dummy HTTP server on a unique port that will return the given text. Returns the Listener for the server, the port it's listening on, or an error if something went wrong while trying to start the listener. Make sure to call the Close() method on the Listener when you're done!
func RunDummyServerE ¶
Run a dummy HTTP server on a unique port that will return the given text. Returns the Listener for the server, the port it's listening on, or an error if something went wrong while trying to start the listener. Make sure to call the Close() method on the Listener when you're done!
Types ¶
type ValidationFunctionFailed ¶
func (ValidationFunctionFailed) Error ¶
func (err ValidationFunctionFailed) Error() string