app

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppStatus

type AppStatus struct {
	Running bool
	State   string
	Image   string
	Port    int
}

AppStatus describes the current state of the application container.

type DockerClient

type DockerClient interface {
	EnsureImage(ctx context.Context, image string) error
	CreateContainer(ctx context.Context, config *docker.ContainerConfig) (string, error)
	StartContainer(ctx context.Context, containerID string) error
	StopContainer(ctx context.Context, containerID string, timeout *int) error
	RemoveContainer(ctx context.Context, containerID string, force bool) error
	ListContainersByLabels(ctx context.Context, labels map[string]string) ([]types.Container, error)
	GetContainerLogs(ctx context.Context, containerID string, tail int) (string, error)
}

DockerClient is the subset of *docker.Client used by the DockerManager.

type DockerManager

type DockerManager struct {
	// contains filtered or unexported fields
}

DockerManager runs the application under test as a Docker container. Like the mock services, the container is labelled so separate CLI invocations can find it again.

func NewDockerManager

func NewDockerManager(dockerClient DockerClient, logger *zap.Logger) *DockerManager

NewDockerManager creates a Docker-backed app manager.

func (*DockerManager) Logs

func (m *DockerManager) Logs(ctx context.Context, tail int) ([]string, error)

Logs returns the last tail lines of the application container logs.

func (*DockerManager) Restart

func (m *DockerManager) Restart(ctx context.Context, cfg *plugin.AppConfig) error

Restart stops the running application (if any) and starts it again.

func (*DockerManager) Start

func (m *DockerManager) Start(ctx context.Context, cfg *plugin.AppConfig) error

Start launches the application container. It fails if an application is already running.

func (*DockerManager) Status

func (m *DockerManager) Status(ctx context.Context) (*AppStatus, error)

Status reports the state of the application container.

func (*DockerManager) Stop

func (m *DockerManager) Stop(ctx context.Context) error

Stop stops and removes the application container.

Directories

Path Synopsis
Package nativeapp runs the app under test as native processes: it starts the project binaries built into $GOPATH/bin as detached processes, each on an incrementing port with the emulator host env vars, and stops them again.
Package nativeapp runs the app under test as native processes: it starts the project binaries built into $GOPATH/bin as detached processes, each on an incrementing port with the emulator host env vars, and stops them again.

Jump to

Keyboard shortcuts

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