harnesses

package
v0.0.1-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package harness provides various harnesses that features can use to test against. The harnesses act on the StepFn of the test to both build the testing environment (such as kubernetes clusters), and to execute the test itself. For example, the kubernetes harness will use the StepFn to create a kubernetes cluster, and then execute the test against that cluster.

TODO: This package is a mess right now with all sorts of os/exec nastiness. Factor this out into proper use of the docker sdk when the api stabilizes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBase

func NewBase() *base

func NewContainer

func NewContainer(ctx context.Context, name string, cfg ContainerConfig) (types.Harness, error)

func NewHost

func NewHost() types.Harness

func NewK3s

func NewK3s(id string, cfg K3sConfig) (types.Harness, error)

Types

type ContainerConfig

type ContainerConfig struct {
	Env        map[string]string
	Image      string
	Mounts     []ContainerConfigMount
	Privileged bool
}

type ContainerConfigMount

type ContainerConfigMount struct {
	Source      string
	Destination string
}

ContainerConfigMount is a simplified wrapper around mount.Mount, intended to only support BindMounts

type Executor

type Executor interface {
	Exec(ctx context.Context, command []string) (io.Reader, error)
}

Executor is an interface for executing commands.

func NewHostExecutor

func NewHostExecutor() Executor

type HostExecutor

type HostExecutor struct {
	// Env is a map of environment variables to set when running commands.
	Env map[string]string
}

HostExecutor is an implementation of Executor that runs commands on the host

func (*HostExecutor) Exec

func (e *HostExecutor) Exec(ctx context.Context, command []string) (io.Reader, error)

Exec runs the given command using os/exec.

type K3sConfig

type K3sConfig struct {
	Image         string
	Traefik       bool
	Cni           bool
	MetricsServer bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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