testutil

package
Version: v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2018 License: Apache-2.0, CC-BY-4.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpDir

func DumpDir(t *testing.T, root string)

DumpDir will log out all of the contents of the provided directory to testing logger.

Use this in a defer statement within tests that may allocate and exercise a temporary directory. Immensely useful for sanity checking and debugging failing tests.

One should still test that contents are as expected. This is only a visual tool to assist when things don't go your way.

func NewLoopback

func NewLoopback(size int64) (string, func() error, error)

NewLoopback creates a loopback device, and returns its device name (/dev/loopX), and its clean-up function.

func RequiresRoot

func RequiresRoot(t testing.TB)

RequiresRoot skips tests that require root, unless the test.root flag has been set

func RequiresRootM

func RequiresRootM()

RequiresRootM is similar to RequiresRoot but intended to be called from *testing.M.

func Unmount

func Unmount(t *testing.T, mountPoint string)

Unmount unmounts a given mountPoint and sets t.Error if it fails

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL