testhelper

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Overview

Package testhelper has common helpers for tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogfilePath

func LogfilePath(filename string) string

LogfilePath returns the path for the given filename in the testing tmp directory

func NewConfigWithTimeout

func NewConfigWithTimeout(timeout time.Duration) *config.Config

NewConfigWithTimeout returns a default config, with a context timeout

func NewTestLogger

func NewTestLogger() (obs *observer.ObservedLogs, log *zap.SugaredLogger)

NewTestLogger returns a ZAP logger for assertions, which also logs to <tmpdir>/quarks-tests.log

func NewTestLoggerWithPath

func NewTestLoggerWithPath(path string) (obs *observer.ObservedLogs, log *zap.SugaredLogger)

NewTestLoggerWithPath returns a logger which logs to path

func RandString

func RandString(n int) string

RandString generates a random string of length n

func WaitForPort

func WaitForPort(host, port string, timeOut time.Duration) error

WaitForPort tests and waits on the availability of a TCP host and port

Types

type CallQueue

type CallQueue struct {
	// contains filtered or unexported fields
}

CallQueue represents a list of expected function calls

func NewCallQueue

func NewCallQueue(funcs ...expectFunc) CallQueue

NewCallQueue returns a new list of expected functions

func (*CallQueue) Calls

func (q *CallQueue) Calls(context context.Context, object crc.Object, _ ...crc.UpdateOption) error

Calls can be used with counterfeiters *Calls functions to set the stub functions

Jump to

Keyboard shortcuts

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