session

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package sess provides options for creating (test) sessions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opt

type Opt func(*Options) error

Opt is a configuration option for creating sessions using github.com/thediveo/morbyd.NewSession.

func WithAutoCleaning

func WithAutoCleaning(label string) Opt

WithAutoCleaning enables autocleaning containers and networks before and after test sessions, in either “KEY=VALUE” or “KEY=” format. This label is automatically attached to any container and network created in a test session.

func WithDockerOpts

func WithDockerOpts(opts ...client.Opt) Opt

WithDockerOpts specifies additional options to apply when creating the Docker client as part of a new session.

func WithLabel

func WithLabel(label string) Opt

WithLabel specifies a single key-value label to be automatically attached to container images, containers, and networks created in this session. These labels can be used, for instance, to automatically clean up any left-over images, containers, and networks.

func WithLabels

func WithLabels(labels ...string) Opt

WithLabels specifies multiple key-value labels to be automatically attached to container images, containers, and networks created in this session. These labels can be used, for instance, to automatically clean up any left-over images, containers, and networks.

type Options

type Options struct {
	Labels           map[string]string
	DockerClientOpts []client.Opt

	// If not "", then AutoCleaningLabel specifies a label that when stuck on
	// containers and networks identifies them for automatic cleaning before and
	// after test sessions. Please note that the auto-cleaning label is also
	// added to the session labels in order to automatically attach it to newly
	// created containers and networks.
	AutoCleaningLabel string

	// A function supplied by a test option to wrap the Docker client with
	// something else, such as a mock, double, or whatever you wanna call it.
	Wrapper func(moby.Client) moby.Client
}

Options stores the configuration options when creating a new testing session, including a Docker client.

Jump to

Keyboard shortcuts

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