integration

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 37 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRequirements = errors.Errorf("missing requirements")

Functions

func CheckFeatureCompat added in v0.11.0

func CheckFeatureCompat(t *testing.T, sb Sandbox, features map[string]struct{}, reason ...string)

func FormatLogs added in v0.13.0

func FormatLogs(m map[string]*bytes.Buffer) string

func HasFeatureCompat added in v0.13.0

func HasFeatureCompat(t *testing.T, sb Sandbox, features map[string]struct{}, reason ...string) error

func LookupBinary added in v0.13.0

func LookupBinary(name string) error

func NewRegistry added in v0.5.0

func NewRegistry(dir string) (url string, cl func() error, err error)

func OfficialImages

func OfficialImages(names ...string) map[string]string

func PrintLogs added in v0.13.0

func PrintLogs(logs map[string]*bytes.Buffer, f func(args ...interface{}))

func Register added in v0.5.0

func Register(w Worker)

func RootlessSupported added in v0.13.0

func RootlessSupported(uid int) bool

func Run

func Run(t *testing.T, testCases []Test, opt ...TestOpt)

func RunCmd added in v0.13.0

func RunCmd(cmd *exec.Cmd, logs map[string]*bytes.Buffer) error

func SkipOnPlatform added in v0.13.0

func SkipOnPlatform(t *testing.T, goos string)

Skips tests on platform

func StartCmd added in v0.13.0

func StartCmd(cmd *exec.Cmd, logs map[string]*bytes.Buffer) (func() error, error)

func UnixOrWindows added in v0.16.0

func UnixOrWindows[T any](unix, windows T) T

Selects between two types, returns second argument if on Windows or else first argument. Typically used for selecting test cases.

func WaitSocket added in v0.13.0

func WaitSocket(address string, d time.Duration, cmd *exec.Cmd) error

WaitSocket will dial a socket opened by a command passed in as cmd. On Linux this socket is typically a Unix socket, while on Windows this will be a named pipe.

func WriteConfig added in v0.13.0

func WriteConfig(updaters []ConfigUpdater) (string, error)

Types

type Backend added in v0.7.0

type Backend interface {
	Address() string
	DockerAddress() string
	ContainerdAddress() string

	Rootless() bool
	NetNSDetached() bool
	Snapshotter() string
	ExtraEnv() []string
	Supports(feature string) bool
}

Backend is the minimal interface that describes a testing backend.

type BackendConfig added in v0.7.0

type BackendConfig struct {
	Logs         map[string]*bytes.Buffer
	DaemonConfig []ConfigUpdater
}

BackendConfig is used to configure backends created by a worker.

type ConfigUpdater added in v0.5.0

type ConfigUpdater interface {
	UpdateConfigFile(string) string
}

type MultiCloser added in v0.13.0

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

func (*MultiCloser) Append added in v0.13.0

func (mc *MultiCloser) Append(f func() error)

func (*MultiCloser) F added in v0.13.0

func (mc *MultiCloser) F() func() error

type Sandbox

type Sandbox interface {
	Backend

	Context() context.Context
	Cmd(...string) *exec.Cmd
	Logs() map[string]*bytes.Buffer
	PrintLogs(*testing.T)
	ClearLogs()
	NewRegistry() (string, error)
	Value(string) interface{} // chosen matrix value
	Name() string
}

type Test

type Test interface {
	Name() string
	Run(t *testing.T, sb Sandbox)
}

func TestFuncs added in v0.10.0

func TestFuncs(funcs ...func(t *testing.T, sb Sandbox)) []Test

type TestOpt

type TestOpt func(*testConf)

TestOpt is an option that can be used to configure a set of integration tests.

func WithMatrix

func WithMatrix(key string, m map[string]interface{}) TestOpt

func WithMirroredImages

func WithMirroredImages(m map[string]string) TestOpt

type TmpDirWithName added in v0.13.0

type TmpDirWithName struct {
	fsutil.FS
	Name string
}

func Tmpdir added in v0.11.0

func Tmpdir(t *testing.T, appliers ...fstest.Applier) *TmpDirWithName

func (*TmpDirWithName) String added in v0.13.0

func (d *TmpDirWithName) String() string

This allows TmpDirWithName to continue being used with the `%s` 'verb' on Printf.

type Worker

type Worker interface {
	New(context.Context, *BackendConfig) (Backend, func() error, error)
	Close() error
	Name() string
	Rootless() bool
	NetNSDetached() bool
}

func List

func List() []Worker

Jump to

Keyboard shortcuts

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