integrationtest

package
v0.0.0-...-569d5de Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: AGPL-3.0 Imports: 34 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 BindMount

func BindMount(src, dst string, ro bool) docker.HostMount

func DefaultBinds

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

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 DockerBridgeIP

func DockerBridgeIP(t testing.TB) string

func EnvVar

func EnvVar(k, v string) string

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 GenerateTLSCertificate

func GenerateTLSCertificate(t testing.TB, commonName string, ipAddr string) tls.Certificate

func MkdirAll

func MkdirAll(t testing.TB, elem ...string) string

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.

func WriteCertificate

func WriteCertificate(t testing.TB, c tls.Certificate, certPath, keyPath string)

func WriteFile

func WriteFile(t *testing.T, path, contents string)

Types

type BuildLogRecorder

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

func FakeBuildLogRecorder

func FakeBuildLogRecorder(t testing.TB, l net.Listener, cert tls.Certificate) *BuildLogRecorder

FakeBuildLogRecorder starts a server that fakes a Coder deployment for the purpose of pushing build logs. It returns a type for asserting that expected log make it through the expected endpoint.

func (*BuildLogRecorder) ContainsLog

func (b *BuildLogRecorder) ContainsLog(l string) bool

func (*BuildLogRecorder) Len

func (b *BuildLogRecorder) Len() int

type CreateDockerCVMConfig

type CreateDockerCVMConfig struct {
	Image           string
	Username        string
	BootstrapScript string
	InnerEnvFilter  []string
	Envs            []string

	OuterMounts   []docker.HostMount
	AddFUSE       bool
	AddTUN        bool
	CPUs          int
	ExpectFailure bool
}

type ExecConfig

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

type RegistryConfig

type RegistryConfig struct {
	HostCertPath string
	HostKeyPath  string
	TLSPort      string
	Image        string
}

type RegistryImage

type RegistryImage string

func RunLocalDockerRegistry

func RunLocalDockerRegistry(t testing.TB, pool *dockertest.Pool, conf RegistryConfig) RegistryImage

func (RegistryImage) Registry

func (r RegistryImage) Registry() string

func (RegistryImage) String

func (r RegistryImage) String() string

Jump to

Keyboard shortcuts

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