integration

package
v0.0.0-...-2745715 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func CheckFeatureCompat

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

func FormatLogs

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

func HasFeatureCompat

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

func LookupBinary

func LookupBinary(name string) error

func NewRegistry

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

func OfficialImages

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

func PrintLogs

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

func Register

func Register(w Worker)

func RootlessSupported

func RootlessSupported(uid int) bool

func Run

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

func RunCmd

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

func StartCmd

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

func Tmpdir

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

func WaitUnix

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

func WriteConfig

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

Types

type Backend

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

	Rootless() bool
	Snapshotter() string
	Supports(feature string) bool
}

Backend is the minimal interface that describes a testing backend.

type BackendConfig

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

BackendConfig is used to configure backends created by a worker.

type ConfigUpdater

type ConfigUpdater interface {
	UpdateConfigFile(string) string
}

type MultiCloser

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

func (*MultiCloser) Append

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

func (*MultiCloser) F

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

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 Worker

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

func List

func List() []Worker

Jump to

Keyboard shortcuts

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