basic

package
v0.0.0-...-82e5c22 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Must

func Must(args ...interface{})

Must panics if the last arg in its arg list is an error.

func Must2

func Must2[V any](v V, err error) V

Types

type Cluster

type Cluster struct {
	Cluster clusteriface.Cluster
	Log     *zap.SugaredLogger
	Ctx     context.Context
}

Cluster wraps a clusteriface.Cluster with convenience functionality. The clusteriface.Cluster interface is designed for minimal implementation footprint. Cluster adds convenience methods around a clusteriface.Cluster to make it easier to use. Test authors should generally use this instead of coding against a clusteriface.Cluster directly.

func New

func (*Cluster) Cleanup

func (c *Cluster) Cleanup() error

func (*Cluster) Context

func (c *Cluster) Context(ctx context.Context) *Cluster

func (*Cluster) MustCleanup

func (c *Cluster) MustCleanup()

func (*Cluster) MustNewNode

func (c *Cluster) MustNewNode() *Node

func (*Cluster) MustNewNodes

func (c *Cluster) MustNewNodes(n int) []*Node

func (*Cluster) NewNode

func (c *Cluster) NewNode() (*Node, error)

func (*Cluster) NewNodes

func (c *Cluster) NewNodes(n int) ([]*Node, error)

func (*Cluster) WithLogger

func (c *Cluster) WithLogger(l *zap.SugaredLogger) *Cluster

type Node

type Node struct {
	Node clusteriface.Node
	Ctx  context.Context
	Log  *zap.SugaredLogger
}

Node wraps a clusteriface.Node and provides a lot of convenience functionality for working with nodes.

func (*Node) Context

func (n *Node) Context(ctx context.Context) *Node

func (*Node) MustReadFile

func (n *Node) MustReadFile(filePath string) io.ReadCloser

func (*Node) MustRun

func (*Node) MustSendFile

func (n *Node) MustSendFile(filePath string, contents io.Reader)

func (*Node) MustStartProc

func (n *Node) MustStartProc(req clusteriface.StartProcRequest) *Process

func (*Node) ReadFile

func (n *Node) ReadFile(filePath string) (io.ReadCloser, error)

func (*Node) RootDir

func (n *Node) RootDir() string

RootDir returns the root directory of the node.

func (*Node) Run

Run starts the given command on the node and waits for the process to exit.

func (*Node) SendFile

func (n *Node) SendFile(filePath string, contents io.Reader) error

func (*Node) StartProc

func (n *Node) StartProc(req clusteriface.StartProcRequest) (*Process, error)

type Process

type Process struct {
	Ctx     context.Context
	Process clusteriface.Process
}

func (*Process) Context

func (p *Process) Context(ctx context.Context) *Process

func (*Process) MustSignal

func (p *Process) MustSignal(sig syscall.Signal)

func (*Process) MustWait

func (p *Process) MustWait() *clusteriface.ProcessResult

func (*Process) Signal

func (p *Process) Signal(sig syscall.Signal) error

func (*Process) Wait

func (p *Process) Wait() (*clusteriface.ProcessResult, error)

Jump to

Keyboard shortcuts

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