step

package
v0.0.0-...-a52e8f6 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CleanupMode

type CleanupMode string

CleanupMode says how runner should execute cleanup

const (
	// CleanupModeNo - Don't execute cleanup
	CleanupModeNo CleanupMode = "no"
	// CleanupModeOnly - Don't run steps, only cleanup
	CleanupModeOnly CleanupMode = "only"
	// Execute both steps and cleanup
	CleanupModeYes CleanupMode = "yes"
)

func (*CleanupMode) Set

func (m *CleanupMode) Set(v string) error

Set implements pflag.Value.Set

func (CleanupMode) String

func (m CleanupMode) String() string

String implements pflag.Value.String

func (CleanupMode) Type

func (m CleanupMode) Type() string

Type implements pflag.Value.Type

type Parallelized

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

func Parallel

func Parallel(steps ...Step) *Parallelized

func (*Parallelized) Cleanup

func (p *Parallelized) Cleanup() error

func (*Parallelized) Name

func (p *Parallelized) Name() string

func (*Parallelized) Run

func (p *Parallelized) Run() error

type Retried

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

func Retry

func Retry(steps ...Step) *Retried

func (*Retried) Cleanup

func (r *Retried) Cleanup() error

func (*Retried) Name

func (r *Retried) Name() string

func (*Retried) Run

func (r *Retried) Run() error

type Runner

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

Runner executes steps in safe manner

func NewRunner

func NewRunner() *Runner

NewRunner returns new runner

func (*Runner) AddFlags

func (r *Runner) AddFlags(set *pflag.FlagSet)

AddFlags add CLI flags so user may control runner behaviour easily

func (*Runner) Cleanup

func (r *Runner) Cleanup(steps []Step)

Cleanup cleans up given steps in reverse order

func (*Runner) Execute

func (r *Runner) Execute(steps []Step) error

Execute behavior is based on chose cleanup method. It is intended to be used with AddFlags

func (*Runner) Run

func (r *Runner) Run(steps []Step, skipCleanup bool) error

Run executes steps in specified order. If skipCleanup is false it also executes Step.Cleanup in reverse order starting from last executed step

type Step

type Step interface {
	// Name returns name name of the step
	Name() string
	// Run executes the step
	Run() error
	// Cleanup removes all resources that may possibly created by the step
	Cleanup() error
}

Step represents a single action in test scenario

Jump to

Keyboard shortcuts

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