Documentation ¶
Index ¶
- Constants
- func Caller(depth ...int) string
- func IsError(err error, re string) bool
- func IsPError(pErr *roachpb.Error, re string) bool
- func IsSQLRetryableError(err error) bool
- func MakeCaller(depth ...int) func() string
- func MakeKey(keys ...[]byte) []byte
- func NewNodeTestBaseContext() *base.Config
- func NewTestBaseContext(user string) *base.Config
- func SortStructs(s interface{}, fieldName string)
- func Stress() bool
- func SucceedsSoon(t testing.TB, fn func() error)
- func SucceedsSoonDepth(depth int, t testing.TB, fn func() error)
- func TempDir(t testing.TB, depth int) (string, func())
Constants ¶
const DefaultSucceedsSoonDuration = 45 * time.Second
DefaultSucceedsSoonDuration is the maximum amount of time unittests will wait for a condition to become true. See SucceedsSoon().
const StressEnv = "COCKROACH_NIGHTLY_STRESS"
StressEnv is the environment variable used to signal that the process is running as part of CockroachDB's nightly stress tests.
Variables ¶
This section is empty.
Functions ¶
func Caller ¶
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 ¶
IsError returns true if the error string matches the supplied regex. An empty regex is interpreted to mean that a nil error is expected.
func IsPError ¶
IsPError returns true if pErr's message matches the supplied regex. An empty regex is interpreted to mean that a nil error is expected.
func IsSQLRetryableError ¶
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 ¶
MakeCaller returns a function which will invoke Caller with the specified arguments.
func NewNodeTestBaseContext ¶
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 ¶
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 Stress ¶
func Stress() bool
Stress returns true iff the process is running as part of CockroachDB's nightly stress tests.
func SucceedsSoon ¶
SucceedsSoon fails the test (with t.Fatal) unless the supplied function runs without error within a preset maximum duration. The function is invoked immediately at first and then successively with an exponential backoff starting at 1ns and ending at the maximum duration (currently 15s).
func SucceedsSoonDepth ¶
SucceedsSoonDepth is like SucceedsSoon() but with an additional stack depth offset.
Types ¶
This section is empty.