Documentation ¶
Overview ¶
Package testutil contains helpers for tests.
Index ¶
- func AssertErrorContains(t *testing.T, err error, expected error)
- func AssertWrappedErrorEqual(t *testing.T, err error, expected error)
- func ContainsString(a []string, s string) bool
- func CreateTempFile(t *testing.T, data string) string
- func KillContainer(containerName string) error
- func PaginatedSegmentsEqual(t *testing.T, s1, s2 *types.PaginatedSegments)
- func PullImage(imageName string) error
- func RandomKey() []byte
- func RandomValue() []byte
- func RequestJSON(h http.HandlerFunc, method, target string, payload, dst interface{}) (*httptest.ResponseRecorder, error)
- func RunContainer(containerName string, imageName string, exposedPorts nat.PortSet, ...) error
- func RunContainerWithEnv(containerName string, imageName string, envVariables []string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertErrorContains ¶ added in v0.3.1
AssertErrorContains checks that the error contains a given sub-error.
func AssertWrappedErrorEqual ¶ added in v0.3.1
AssertWrappedErrorEqual checks that the innermost error equals the given expected error.
func ContainsString ¶
ContainsString checks if an array contains a string.
func CreateTempFile ¶ added in v0.3.1
CreateTempFile creates a temporary file for tests with data as content.
func KillContainer ¶ added in v0.3.1
KillContainer stops and removes specified container.
func PaginatedSegmentsEqual ¶ added in v0.3.1
func PaginatedSegmentsEqual(t *testing.T, s1, s2 *types.PaginatedSegments)
PaginatedSegmentsEqual verifies that two paginated segment lists are equal.
func PullImage ¶ added in v0.3.1
PullImage pulls an image from docker hub if image is not available or not up to date.
func RandomValue ¶
func RandomValue() []byte
RandomValue returns a random byte array (with max 1024 bytes)
func RequestJSON ¶
func RequestJSON(h http.HandlerFunc, method, target string, payload, dst interface{}) (*httptest.ResponseRecorder, error)
RequestJSON does a request expecting a JSON response.
Types ¶
This section is empty.