testutil

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package testutil provides testing utilities shared across packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListFiles

func ListFiles(t *testing.T, dir string) []string

ListFiles returns a list of all files (not directories) in a directory, relative to the directory.

Types

type LocalRegistry

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

LocalRegistry is a local OCI registry for testing.

func NewAuthenticatedLocalRegistry added in v1.4.0

func NewAuthenticatedLocalRegistry(t *testing.T, username, password string) *LocalRegistry

NewAuthenticatedLocalRegistry creates a local OCI registry protected by Basic Auth.

func NewLocalRegistry

func NewLocalRegistry(t *testing.T) *LocalRegistry

NewLocalRegistry creates a new local OCI registry for testing.

func (*LocalRegistry) AddImage

func (r *LocalRegistry) AddImage(t *testing.T, tarPath, name, version string) string

AddImage loads an image from a tar file and pushes it to the test registry. Returns the full image reference (e.g., "127.0.0.1:12345/name:version").

func (*LocalRegistry) GetRoundTripper

func (r *LocalRegistry) GetRoundTripper(t *testing.T) http.RoundTripper

GetRoundTripper returns the HTTP transport for the test registry. Use this to configure a Downloader to use the test registry.

func (*LocalRegistry) Registry

func (r *LocalRegistry) Registry(t *testing.T) string

Registry returns the registry address.

func (*LocalRegistry) Stop

func (r *LocalRegistry) Stop()

Stop stops the test registry server.

type TempScratchDirectory

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

TempScratchDirectory is a temporary directory for tests.

func NewTempScratchDirectory

func NewTempScratchDirectory(t *testing.T) *TempScratchDirectory

NewTempScratchDirectory creates a new temporary directory for testing.

func (*TempScratchDirectory) Cleanup

func (tsd *TempScratchDirectory) Cleanup(t *testing.T)

Cleanup removes the temporary directory.

func (*TempScratchDirectory) Path

func (tsd *TempScratchDirectory) Path(t *testing.T) string

Path returns the path to the temporary directory.

Jump to

Keyboard shortcuts

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