testutils

package
v0.0.0-...-6e4a9c2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2016 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Caller

func Caller(depth ...int) string

Caller returns filename and line number info for the specified stack depths. The info is formated as <file>:<line> and each entry is separated for a space.

func IsError

func IsError(err error, re string) bool

IsError returns true if err is non-nil and the error string matches the supplied regexp.

func IsPError

func IsPError(pErr *roachpb.Error, re string) bool

IsPError returns true if pErr is non-nil and the error message matches the supplied regexp.

func IsSQLRetryableError

func IsSQLRetryableError(err error) bool

IsSQLRetryableError returns true if err is retryable. This is true for errors that show a connection issue or an issue with the node itself. This can occur when a node is restarting or is unstable in some other way. Note that retryable errors may occur event in cases where the SQL execution ran to completion.

func MakeCaller

func MakeCaller(depth ...int) func() string

MakeCaller returns a function which will invoke Caller with the specified arguments.

func MakeKey

func MakeKey(keys ...[]byte) []byte

MakeKey makes a new key which is the concatenation of the given inputs, in order.

func NewNodeTestBaseContext

func NewNodeTestBaseContext() *base.Config

NewNodeTestBaseContext creates a base context for testing. This uses embedded certs and the default node user. The default node user has both server and client certificates.

func NewTestBaseContext

func NewTestBaseContext(user string) *base.Config

NewTestBaseContext creates a secure base context for user.

func SortStructs

func SortStructs(s interface{}, fieldName string)

SortStructs sorts the given slice of structs using the given field as the sort key.

func TempDir

func TempDir(t testing.TB, depth int) (string, func())

TempDir creates a directory and a function to clean it up at the end of the test. If called directly from a test function, pass 0 for depth (which puts the test name in the directory). Otherwise, offset depth appropriately.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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