lab

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DockerGateway

func DockerGateway() string

DockerGateway returns the default Docker bridge gateway IP.

func IsRunning

func IsRunning(ctx context.Context, name string) bool

IsRunning checks if a lab has running containers.

func Start

func Start(ctx context.Context, name string, services []sdk.Service) error

Start creates and starts containers for the given lab services.

Each service gets a network alias matching its Name so services can reference each other by short name (like docker compose). Services with a healthcheck are waited on before starting the next service, giving dependencies time to become ready.

func Stop

func Stop(ctx context.Context, name string) error

Stop tears down all containers and the network for a lab.

func Target

func Target(ctx context.Context, name string) string

Target queries Docker for the actual mapped port of a running lab. Since labs use random host ports, we can't read from static config.

func WaitProbe

func WaitProbe(ctx context.Context, timeout time.Duration, fn func() error) error

WaitProbe retries fn until it returns nil or timeout expires. Use with the module's Check() as fn to wait for the application layer to be fully ready (not just TCP).

func WaitReady

func WaitReady(ctx context.Context, addr string, timeout time.Duration) error

WaitReady polls a TCP address until it accepts connections.

Types

type LabInfo

type LabInfo struct {
	Name     string
	Services []ServiceInfo
}

LabInfo holds status for a lab.

func Status

func Status(ctx context.Context) ([]LabInfo, error)

Status returns info for all labs tracked by pik.

type ServiceInfo

type ServiceInfo struct {
	Name  string
	Image string
	State string
	Ports string
}

ServiceInfo holds status for one service container.

Jump to

Keyboard shortcuts

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