testhelpers

package
v1.64.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CacheConfig = config.Cache{
	CacheExpiry:          time.Second,
	CacheCleanupInterval: time.Second / 2,
	EntryRefreshTimeout:  time.Second / 2,
	RetrievalTimeout:     time.Second,
	MaxRetrievalInterval: time.Second / 3,
	MaxRetrievalRetries:  3,
}

Functions

func AssertLogContains added in v1.16.0

func AssertLogContains(t *testing.T, wantLogEntry string, entries []*logrus.Entry)

AssertLogContains checks that wantLogEntry is contained in at least one of the log entries

func AssertRedirectTo

func AssertRedirectTo(t *testing.T, handler http.HandlerFunc, method string,
	url string, values url.Values, expectedURL string)

AssertRedirectTo asserts that handler redirects to particular URL

func ChdirInPath added in v1.22.0

func ChdirInPath(t testing.TB, path string, chdirSet *bool) func()

func Close added in v1.55.0

func Close(t *testing.T, c io.Closer)

Close will call the close function on a closer as part of the t.Cleanup function.

func Getwd added in v1.36.0

func Getwd(t *testing.T) string

Getwd must return current working directory

func PerformRequest added in v1.51.0

func PerformRequest(t *testing.T, handler http.Handler, r *http.Request) (int, string)

func TmpDir added in v1.25.0

func TmpDir(tb testing.TB) (vfs.Root, string)

func ToFileProtocol added in v1.36.0

func ToFileProtocol(t *testing.T, path string) string

ToFileProtocol appends the file:// protocol to the current os.Getwd and formats path to be a full filepath

Types

This section is empty.

Jump to

Keyboard shortcuts

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