types

package
v0.0.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MPL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assertion

type Assertion interface {
	Name() string
	Command(context.Context) string
	Level() Level
}

type EnvConfig

type EnvConfig interface{}

type EnvFunc

type EnvFunc func(context.Context, EnvConfig) (context.Context, error)

type Environment

type Environment interface {
	// Test executes a feature(set) against the environment.
	Test(context.Context, ...Feature) error

	// Stepper returns an environment specific Step for the given assertion
	Stepper(Assertion) Step

	// Setup registers environment funcs to be executed before the
	// feature(set). The EnvFuncs are capable of being modified during the
	// setup.
	Setup(...EnvFunc) Environment

	// Finish signals that the environment is no longer needed and can be destroyed.
	Finish(...EnvFunc) Environment

	// Run starts the environment. Executing the setup funcs and deferring the
	// finish funcs. Tests can only be ran once the environment is running.
	Run(context.Context) (func() error, error)
}

Environment defines an ephemeral testing environment capable of executing tests.

type Feature

type Feature interface {
	Name() string
	Steps() []Step
}

type Harness

type Harness interface {
	// Setup returns the EnvFunc that creates the harness, and modifies the
	// environment config as necessary. When not idempotent, the Setup function
	// will ensure it is only called once per Harness.
	Setup() EnvFunc

	// Finish returns the EnvFunc ran by the Environment to signal that it is
	// done with the harness. It is _not_ the same as Destroy.
	Finish() EnvFunc

	// Destroy destroys the harness. It blocks on the harness being finished by
	// all environments.
	Destroy(context.Context) error

	Finished(context.Context) error
}

Harness defines the methods used by environments to create and destroy the environment specific test harness.

type Level

type Level uint8
const (
	Setup Level = iota
	Assessment
	Teardown
)

type Step

type Step interface {
	Name() string
	Fn() StepFn
	Level() Level
}

type StepFn

type StepFn func(ctx context.Context) (context.Context, error)

Jump to

Keyboard shortcuts

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