ginkgomon_v2

package
v0.0.0-...-dd274de Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Ginkgomon_v2 provides ginkgo test helpers that are compatible with Ginkgo v2+

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Interrupt

func Interrupt(process ifrit.Process, intervals ...interface{})

func Invoke

func Invoke(runner ifrit.Runner) ifrit.Process

func Kill

func Kill(process ifrit.Process, intervals ...interface{})

Types

type Config

type Config struct {
	Command           *exec.Cmd     // process to be executed
	Name              string        // prefixes all output lines
	AnsiColorCode     string        // colors the output
	StartCheck        string        // text to match to indicate sucessful start.
	StartCheckTimeout time.Duration // how long to wait to see StartCheck
	Cleanup           func()        // invoked once the process exits
}

Config defines a ginkgomon Runner.

type Runner

type Runner struct {
	Command           *exec.Cmd
	Name              string
	AnsiColorCode     string
	StartCheck        string
	StartCheckTimeout time.Duration
	Cleanup           func()
	// contains filtered or unexported fields
}

The ginkgomon Runner invokes a new process using gomega's gexec package.

If a start check is defined, the runner will wait until it sees the start check before declaring ready.

Runner implements gexec.Exiter and gbytes.BufferProvider, so you can test exit codes and process output using the appropriate gomega matchers: http://onsi.github.io/gomega/#gexec-testing-external-processes

func New

func New(config Config) *Runner

New creates a ginkgomon Runner from a config object. Runners must be created with New to properly initialize their internal state.

func (*Runner) Buffer

func (r *Runner) Buffer() *gbytes.Buffer

Buffer returns a gbytes.Buffer, for use with the gbytes.Say matcher.

func (*Runner) Err

func (r *Runner) Err() *gbytes.Buffer

Err returns the gbytes.Buffer associated with the stderr stream. For use with the gbytes.Say matcher.

func (*Runner) ExitCode

func (r *Runner) ExitCode() int

ExitCode returns the exit code of the process, or -1 if the process has not exited. It can be used with the gexec.Exit matcher.

func (*Runner) Run

func (r *Runner) Run(sigChan <-chan os.Signal, ready chan<- struct{}) error

Jump to

Keyboard shortcuts

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