helpers

package
v0.0.0-...-25f6002 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2024 License: Apache-2.0 Imports: 10 Imported by: 86

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendRandomString

func AppendRandomString(prefix string) string

AppendRandomString will generate a random string that begins with prefix. This is useful if you want to make sure that your tests can run at the same time against the same environment without conflicting. This method will use "-" as the separator between the prefix and the random suffix.

func ChdirToRoot

func ChdirToRoot() error

ChdirToRoot change directory to git root dir

func CombineErrors

func CombineErrors(errs []error) error

CombineErrors combines slice of errors and return a single error

func CreateDir

func CreateDir(dirPath string) error

CreateDir creates dir if does not exist. The created dir will have the permission bits as 0777, which means everyone can read/write/execute it.

func CreateDirWithFileMode

func CreateDirWithFileMode(dirPath string, perm os.FileMode) error

CreateDirWithFileMode creates dir if does not exist. The created dir will have the permission bits as perm, which is the standard Unix rwxrwxrwx permissions.

func GetBaseFuncName

func GetBaseFuncName(fullFuncName string) string

GetBaseFuncName returns the baseFuncName parsed from the fullFuncName. eg. test/e2e.TestMain will return TestMain.

func GetRootDir

func GetRootDir() (string, error)

GetRootDir gets directory of git root

func MakeK8sNamePrefix

func MakeK8sNamePrefix(s string) string

MakeK8sNamePrefix converts each chunk of non-alphanumeric character into a single dash and also convert camelcase tokens into dash-delimited lowercase tokens. The function will try to catch some well known abbreviations, so that we don't separate them.

func ObjectNameForTest

func ObjectNameForTest(t named) string

ObjectNameForTest generates a random object name based on the test name.

func ObjectPrefixForTest

func ObjectPrefixForTest(t named) string

ObjectPrefixForTest returns the name prefix for this test's random names.

func RandomString

func RandomString() string

RandomString will generate a random string.

func Run

func Run(message string, call func() error, dryrun bool) error

Run can run functions that needs dryrun support.

Types

This section is empty.

Jump to

Keyboard shortcuts

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