composetest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package composetest provides a compose.Runner that simulates `docker compose` on top of the in-memory engine from enginetest.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fake

type Fake struct {
	Eng        *enginetest.Fake
	Ver        compose.Version
	VersionErr error
	BuildxErr  error
	// ConfigFn returns the model for a spec.
	ConfigFn func(compose.Spec) (*compose.Model, error)
	// Exit returns the exit code of a Run; nil means 0.
	Exit func(args []string) int
	// Stderr returns what a failing Run prints to stderr.
	Stderr func(args []string) string
	// Stdout returns what a Run prints to stdout, such as a hook's output.
	Stdout func(args []string) string
	RunErr error
	Runs   [][]string
	Specs  []compose.Spec
	// contains filtered or unexported fields
}

Fake simulates Compose: up creates one running container per service, a network and a named volume; stop exits the containers; down removes them (and the volumes with --volumes).

func New

func New(eng *enginetest.Fake, model *compose.Model) *Fake

New returns a Fake that serves model for every spec.

func (*Fake) BuildxVersion

func (f *Fake) BuildxVersion(context.Context) (string, error)

func (*Fake) Config

func (f *Fake) Config(_ context.Context, s compose.Spec) (*compose.Model, error)

func (*Fake) Run

func (f *Fake) Run(ctx context.Context, s compose.Spec, io compose.IO, args ...string) (int, error)

func (*Fake) RunsWith

func (f *Fake) RunsWith(cmd string) [][]string

RunsWith returns the recorded runs whose first argument is cmd.

func (*Fake) Version

func (f *Fake) Version(context.Context) (compose.Version, error)

Jump to

Keyboard shortcuts

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