testutils

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	LowerAlphaBytes = "abcdefghijklmnopqrstuvwxyz"
)

Variables

This section is empty.

Functions

func AssertBytesEqual added in v0.8.4

func AssertBytesEqual(t *testing.T, a, b [][]byte, ignoreOrder bool)

func AssertTimeEqual added in v0.10.1

func AssertTimeEqual(t *testing.T, expected, actual time.Time, msgAndArgs ...interface{})

func BrokenRandomAlphaNumericString

func BrokenRandomAlphaNumericString(length int) string

BrokenRandomAlphaNumericString is broken so don't use it outside of tests

func BrokenRandomLowerAlphaString

func BrokenRandomLowerAlphaString(length int) string

func BuildRawCSV

func BuildRawCSV(numCol, numRow int) [][]string

func ChTempDir added in v0.7.7

func ChTempDir(t *testing.T) (name string, cleanup func())

ChTempDir creates a temporary directory and cd into it during test

func CreateSQLDB added in v0.13.0

func CreateSQLDB(t *testing.T, createTableStatements []string) (db *sql.DB, stop func())

func CreateTimeGen

func CreateTimeGen() func() time.Time

createTimeGen create a time generator that returns a timestamp that increase by 1 second each time it is called. This ensures that all commits have different timestamp.

func ModifiedCSV

func ModifiedCSV(orig [][]string, mPercent int) [][]string

func RandomEmail

func RandomEmail() string

func RandomSum

func RandomSum() [16]byte

func RawCSVBytesReader added in v0.10.1

func RawCSVBytesReader(r [][]string) io.Reader

func RawCSVReader

func RawCSVReader(r [][]string) *csv.Reader

func Retry added in v0.6.0

func Retry(t *testing.T, dur time.Duration, count int, cond func() bool, message string, args ...interface{})

func SecureRandomBytes

func SecureRandomBytes(length int) []byte

func TempDir

func TempDir(dir, pattern string) (string, error)

TempDir is a light wrapper of ioutil.Tempdir which place the dir under RUNNER_TEMP env var if it is specified. This is necessary for Github action to work correctly.

func TempFile

func TempFile(dir, pattern string) (*os.File, error)

TempFile is a light wrapper of ioutil.TempFile which place the file under RUNNER_TEMP env var if it is specified. This is necessary for Github action to work correctly.

Types

This section is empty.

Jump to

Keyboard shortcuts

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