tools

package
v0.9.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2025 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = errors.New("Timed out")

ErrTimeout is returned if WaitFor takes longer than 300 second to happen.

Functions

func AssertLengthGreaterThan added in v0.9.4

func AssertLengthGreaterThan(t *testing.T, list interface{}, threshold int)

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

func Elide(value string) string

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

func ExtractNetworkAddress(cidr string) string

ExtractNetworkAddress removes the mask from the CIDR block

func MakeNewPassword

func MakeNewPassword(oldPass string) string

MakeNewPassword generates a new string that's guaranteed to be different than the given one.

func PrintResource

func PrintResource(t *testing.T, resource interface{})

PrintResource returns a resource as a readable structure

func RandomInt

func RandomInt(min, max int) int

RandomInt will return a random integer between a specified range.

func RandomString

func RandomString(prefix string, n int) string

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 SetLastOctet added in v0.9.4

func SetLastOctet(ip string, newLastOctet int) string

SetLastOctet changes the last octet of the IP address to the specified value

func WaitFor

func WaitFor(predicate func() (bool, error)) error

WaitFor polls a predicate function once per second to wait for a certain state to arrive.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL