Documentation
¶
Index ¶
- Variables
- func AcquireQuota(t *testing.T, resource string, units int) func()
- func AssertLengthGreaterThan(t *testing.T, list interface{}, threshold int)
- func Elide(value string) string
- func ExtractNetworkAddress(cidr string) string
- func MakeNewPassword(oldPass string) string
- func PrintResource(t *testing.T, resource interface{})
- func RandomInt(min, max int) int
- func RandomString(prefix string, n int) string
- func RegisterQuotaCapacity(resource string, capacity int)
- func SetLastOctet(ip string, newLastOctet int) string
- func WaitFor(predicate func() (bool, error)) error
Constants ¶
This section is empty.
Variables ¶
var ErrTimeout = errors.New("Timed out")
ErrTimeout is returned if WaitFor takes longer than 300 second to happen.
Functions ¶
func AcquireQuota ¶ added in v0.9.9
AcquireQuota reserves `units` slots of the named resource quota (e.g. "eip"), blocking until enough slots are free across every acceptance test process running concurrently. Every test that consumes one or more units of a limited resource should call AcquireQuota before creating that resource; the reserved units are released automatically when the test (and its subtests) finish via t.Cleanup, allowing other tests waiting on the same quota to proceed.
The returned release function may be called earlier than test cleanup if a test wants to free its quota units as soon as it no longer needs them; it is safe to call multiple times (only the first call has an effect).
func AssertLengthGreaterThan ¶ added in v0.9.4
AssertLengthGreaterThan checks if the length of the provided list is greater than the specified number. If the condition fails, it logs a fatal error and fails the test.
func Elide ¶
Elide returns the first bit of its input string with a suffix of "..." if it's longer than a comfortable 40 characters.
func ExtractNetworkAddress ¶ added in v0.9.4
ExtractNetworkAddress removes the mask from the CIDR block
func MakeNewPassword ¶
MakeNewPassword generates a new string that's guaranteed to be different than the given one.
func PrintResource ¶
PrintResource returns a resource as a readable structure
func RandomString ¶
RandomString generates a string of given length, but random content. All content will be within the ASCII graphic character set. (Implementation from Even Shaw's contribution on http://stackoverflow.com/questions/12771930/what-is-the-fastest-way-to-generate-a-long-random-string-in-go).
func RegisterQuotaCapacity ¶ added in v0.9.9
RegisterQuotaCapacity sets the capacity for a resource quota before its first use. This lets tests/suites configure a limit for a resource that isn't one of the built-in defaults (e.g. a new service with its own availability limit). It has no effect if the quota for the resource has already been created by a prior AcquireQuota/RegisterQuotaCapacity call.
func SetLastOctet ¶ added in v0.9.4
SetLastOctet changes the last octet of the IP address to the specified value
Types ¶
This section is empty.