testutils

package
v0.0.0-...-d841f61 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvCpsTestSkipLong = "CPS_TEST_SKIP_LONG"
)

Testutils constants

Variables

This section is empty.

Functions

func GetTestConf

func GetTestConf() config.CanopsisConf

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()

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