gmonit

package module
v0.0.0-...-f1e28de Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 10 Imported by: 0

README

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Interrupt

func Interrupt(process *Process)

Interrupt interrupts a process

func Kill

func Kill(process *Process)

Kill kills a process

Types

type Config

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

Config defines a ginkgomon Runner.

type Process

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

Process represents a process

func Background

func Background(runner *Runner) *Process

Background start the runner in background

func Invoke

func Invoke(runner *Runner) *Process

Invoke invokes a runner

func (*Process) Ready

func (p *Process) Ready() <-chan struct{}

Ready makes the process ready

func (*Process) Run

func (p *Process) Run()

Run starts the process

func (*Process) Signal

func (p *Process) Signal(signal os.Signal)

Signal sends a signal

func (*Process) Wait

func (p *Process) Wait() <-chan error

Wait waits for the process

type Runner

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

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 Buffer associated with the stderr stream. For use with the 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(ch <-chan os.Signal, ready chan<- struct{}) (err error)

Jump to

Keyboard shortcuts

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