Documentation ¶
Overview ¶
Package xtesting provides functions and utilities for testing the Cloudcraft SDK.
Index ¶
- Constants
- func GetEnv(t *testing.T, name string) string
- func ParseTime(t *testing.T, str string) time.Time
- func RandomString(t *testing.T, r io.Reader, n int) (string, error)
- func ReadFile(t *testing.T, name string) []byte
- func SetupLiveClient(t *testing.T) *cloudcraft.Client
- func SetupMockClient(t *testing.T, endpoint *url.URL) *cloudcraft.Client
- func UniqueName(t *testing.T) string
Constants ¶
const ErrGreaterThanZero xerrors.Error = "value must be greater than zero"
ErrGreaterThanZero is returned when a given value is not greater than zero.
Variables ¶
This section is empty.
Functions ¶
func GetEnv ¶
GetEnv returns the value of the environment variable with the given name or fails the test if the variable is not set.
func ParseTime ¶
ParseTime returns the time parsed from the given string or fails the test if the string is not a valid time.
func RandomString ¶
RandomString returns a random string of length n that is safe for use in a URL.
func SetupLiveClient ¶
SetupLiveClient sets up a test API client for unit tests against the live Cloudcraft API.
The following environment variables are required: - CLOUDCRAFT_TEST_API_KEY
If any of these variables are not set, SetupLiveClient will fail the test.
func SetupMockClient ¶
SetupMockClient sets up a test API client for unit tests against a mock version of the Cloudcraft API.
func UniqueName ¶
UniqueName returns an unique name that can be used as a resource name in Cloudcraft.
Types ¶
This section is empty.