test

package
Version: v3.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CacheDirPriv is the directory the cachedir gets set to when running privileged
	CacheDirPriv = "/tmp/WithPrivilege"
	// CacheDirUnpriv is the directory the cachedir gets set to when running unprivileged
	CacheDirUnpriv = "/tmp/WithoutPrivilege"
)

Variables

This section is empty.

Functions

func DropPrivilege

func DropPrivilege(t *testing.T)

DropPrivilege drops privilege. Use this at the start of a test that does not require elevated privileges. A matching call to ResetPrivilege must occur before the test completes (a defer statement is recommended.)

func EnsurePrivilege

func EnsurePrivilege(t *testing.T)

EnsurePrivilege ensures elevated privileges are available during a test.

func ResetPrivilege

func ResetPrivilege(t *testing.T)

ResetPrivilege returns effective privilege to the original user.

func WithPrivilege

func WithPrivilege(f func(t *testing.T)) func(t *testing.T)

WithPrivilege wraps the supplied test function with calls to ensure the test is run with elevated privileges.

func WithoutPrivilege

func WithoutPrivilege(f func(t *testing.T)) func(t *testing.T)

WithoutPrivilege wraps the supplied test function with calls to ensure the test is run without elevated privileges.

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

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