testutil

package
v1.7.36 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 13 Imported by: 144

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpDir

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

DumpDir prints the contents of the directory to the testing logger.

Use this in a defer statement from a test 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 DumpDirOnFailure

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

DumpDirOnFailure prints the contents of the directory to the testing logger if the test has failed.

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 ServeImage added in v1.7.36

func ServeImage(t *testing.T, name, tag string, target ocispec.Descriptor, blobs map[digest.Digest][]byte) string

ServeImage serves an image from a read-only HTTP registry listening on localhost, and returns a reference to pull the image from.

blobs must be keyed by digest and contain the manifest blob referenced by target, along with the blobs it references, except for those already present in the puller's content store. The registry is shut down when the test completes.

func Unmount

func Unmount(t testing.TB, 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
y or Y : Canonical URL