testutils

package
v0.0.0-...-4ecf446 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvCpsTestSkipLong = "CPS_TEST_SKIP_LONG"
)

Testutils constants

Variables

This section is empty.

Functions

func MongoDrop

func MongoDrop(collection *mgo.Collection) error

MongoDrop handles collection drop even if the collection doesn't exists.

func SkipLongIfSet

func SkipLongIfSet(t *testing.T)

SkipLongIfSet set the current test as being a "long" running one. If CPS_TEST_SKIP_LONG exactly equals to "1" this test is testing.T.SkipNow()

func StructPrintf

func StructPrintf(s interface{})

StructPrintf prints a struct with "%+v\n" as format.

Types

type EnvBackup

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

EnvBackup handles backup and restore of environment variables.

{
	e := NewEnvBackup("MY_VAR", "newval")
	doYourStuff()
	e.Restore()
}

func NewEnvBackup

func NewEnvBackup(name string, newval string) (EnvBackup, error)

NewEnvBackup create EnvBackup, then run SaveSet(newval) before returning.

func (EnvBackup) Restore

func (e EnvBackup) Restore() error

Restore set the env var to it's backuped value.

func (*EnvBackup) SaveSet

func (e *EnvBackup) SaveSet(newval string) error

SaveSet backup the current value of EnvBackup.name then set the env var to newval.

Jump to

Keyboard shortcuts

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