testutils

package
v0.0.0-...-ff244ab Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fatal

func Fatal(msg ...interface{})

Fatal prints a message and immediately exit the process

func NeedCouchdb

func NeedCouchdb()

NeedCouchdb kill the process if there is no couchdb running

func NeedOtherDispersServer

func NeedOtherDispersServer(dispersURL url.URL)

NeedOtherDispersServer kill the process if there is no other Server Dispers running

Types

type CookieJar

type CookieJar struct {
	Jar *cookiejar.Jar
	URL *url.URL
}

CookieJar is a http.CookieJar which always returns all cookies. NOTE golang stdlib uses cookies for the URL (ie the testserver), not for the host (ie the instance), so we do it manually

func (*CookieJar) Cookies

func (j *CookieJar) Cookies(u *url.URL) (cookies []*http.Cookie)

Cookies implements http.CookieJar interface

func (*CookieJar) SetCookies

func (j *CookieJar) SetCookies(u *url.URL, cookies []*http.Cookie)

SetCookies implements http.CookieJar interface

type TestSetup

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

TestSetup is a wrapper around a testing.M which handles setting up instance, client, VFSContext, testserver and cleaning up after itself

func NewSetup

func NewSetup(testingM *testing.M, name string) *TestSetup

NewSetup returns a new TestSetup name is used to prevent bug when tests are run in parallel

func (*TestSetup) AddCleanup

func (c *TestSetup) AddCleanup(f func() error)

AddCleanup adds a function to be run when the test is finished.

func (*TestSetup) Cleanup

func (c *TestSetup) Cleanup()

Cleanup cleanup the TestSetup

func (*TestSetup) CleanupAndDie

func (c *TestSetup) CleanupAndDie(msg ...interface{})

CleanupAndDie cleanup the TestSetup, prints a message and close the process

func (*TestSetup) GetTmpDirectory

func (c *TestSetup) GetTmpDirectory() string

GetTmpDirectory creates a temporary directory The directory will be removed on container cleanup

func (*TestSetup) Run

func (c *TestSetup) Run() int

Run runs the underlying testing.M and cleanup

Jump to

Keyboard shortcuts

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