fakes

package
v0.0.0-...-120586e Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBuilder

func NewBuilder(hooks *BuilderHooks) libhive.Builder

NewBuilder creates a new fake builder.

func NewContainerBackend

func NewContainerBackend(hooks *BackendHooks) libhive.ContainerBackend

NewBackend creates a new fake container backend.

Types

type BackendHooks

type BackendHooks struct {
	CreateContainer  func(image string, opt libhive.ContainerOptions) (string, error)
	StartContainer   func(image, containerID string, opt libhive.ContainerOptions) (*libhive.ContainerInfo, error)
	DeleteContainer  func(containerID string) error
	PauseContainer   func(containerID string) error
	UnpauseContainer func(containerID string) error
	RunProgram       func(containerID string, cmd []string) (*libhive.ExecInfo, error)

	NetworkNameToID     func(string) (string, error)
	CreateNetwork       func(string) (string, error)
	RemoveNetwork       func(networkID string) error
	ContainerIP         func(containerID, networkID string) (net.IP, error)
	ConnectContainer    func(containerID, networkID string) error
	DisconnectContainer func(containerID, networkID string) error
}

BackendHooks can be used to override the behavior of the fake backend.

type BuilderHooks

type BuilderHooks struct {
	BuildClientImage    func(context.Context, libhive.ClientDesignator) (string, error)
	BuildSimulatorImage func(context.Context, string) (string, error)
	ReadFile            func(ctx context.Context, image string, file string) ([]byte, error)
}

BuilderHooks can be used to override the behavior of the fake builder.

Jump to

Keyboard shortcuts

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