integrationtest

package
v0.0.0-...-0f74808 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DockerdImage is a large image (~1GB) and should only be used to test
	// dockerd.
	DockerdImage = "gcr.io/coder-dev-1/sreya/enterprise-base:ubuntu"
	// HelloWorldImage is useful for testing a CVM's dockerd is functioning
	// correctly
	HelloWorldImage = "gcr.io/coder-dev-1/sreya/hello-world"
	// UbuntuImage is just vanilla ubuntu (80MB) but the user is set to a non-root
	// user .
	UbuntuImage = "gcr.io/coder-dev-1/sreya/ubuntu-coder"
)

Variables

This section is empty.

Functions

func DefaultBinds

func DefaultBinds(t *testing.T, rootDir string) []string

DefaultBinds returns the minimum amount of mounts necessary to spawn envbox successfully. Since envbox will chown some of these directories to root, they cannot be cleaned up post-test, meaning that it may be necesssary to manually clear /tmp from time to time.

func ExecEnvbox

func ExecEnvbox(t *testing.T, pool *dockertest.Pool, conf ExecConfig) ([]byte, error)

ExecEnvbox runs a command in the outer container.

func ExecInnerContainer

func ExecInnerContainer(t *testing.T, pool *dockertest.Pool, conf ExecConfig) ([]byte, error)

ExecInnerContainer runs a command in the inner container.

func RunEnvbox

func RunEnvbox(t *testing.T, pool *dockertest.Pool, conf *CreateDockerCVMConfig) *dockertest.Resource

RunEnvbox runs envbox, it returns once the inner container has finished spinning up.

func TmpDir

func TmpDir(t *testing.T) string

TmpDir returns a subdirectory in /tmp that can be used for test files.

func WaitForCVMDocker

func WaitForCVMDocker(t *testing.T, pool *dockertest.Pool, resource *dockertest.Resource, timeout time.Duration)

WaitForCVMDocker waits for the inner container docker daemon to spin up.

Types

type CreateDockerCVMConfig

type CreateDockerCVMConfig struct {
	Image           string
	Username        string
	BootstrapScript string
	InnerEnvFilter  []string
	Envs            []string
	Binds           []string
	Mounts          []string
	AddFUSE         bool
	AddTUN          bool
	CPUs            int
}

type ExecConfig

type ExecConfig struct {
	ContainerID string
	Cmd         []string
	User        string
}

Jump to

Keyboard shortcuts

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