tests

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package tests contains the exported functions that are meant to be imported as test cases.

It should not export any other thing except for a SubcommandOption struct (e.g., LoginOption) that may be added in the future.

Each file contains one subcommand to test and is named after that subcommand. Note that the file names are not suffixed with _test so that they can appear in Go Doc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupLocalRegistry

func CleanupLocalRegistry(opt *option.Option)

CleanupLocalRegistry removes the local registry container and image. It's used together with SetupLocalRegistry, and should be invoked after running all the tests.

func ContainerAttach

func ContainerAttach(opt *option.Option)

ContainerAttach tests the `POST containers/attach` API.

func ContainerCreate

func ContainerCreate(opt *option.Option)

ContainerCreate tests the `POST containers/create` API.

func ContainerList

func ContainerList(opt *option.Option)

ContainerList tests the `GET containers/json` API.

func ContainerLogs

func ContainerLogs(opt *option.Option)

ContainerLogs tests the `POST containers/logs` API.

func ContainerRemove

func ContainerRemove(opt *option.Option)

ContainerRemove tests the `POST containers/{id}/remove` API.

func ContainerRename

func ContainerRename(opt *option.Option)

ContainerRename tests the `POST containers/{id}/rename` API.

func ContainerRestart

func ContainerRestart(opt *option.Option)

ContainerRestart tests the `POST containers/{id}/restart` API.

func ContainerStart

func ContainerStart(opt *option.Option)

ContainerStart tests the `POST containers/{id}/start` API.

func ContainerStats

func ContainerStats(opt *option.Option)

ContainerStats tests the `GET containers/{id}/stats` API.

func ContainerStop

func ContainerStop(opt *option.Option)

ContainerStop tests the `POST containers/{id}/stop` API.

func GetDockerApiVersion

func GetDockerApiVersion() string

func GetDockerHostUrl

func GetDockerHostUrl() string

func GetFinchExe

func GetFinchExe() string

GetFinchExe gets the finch executable path from FINCH_ROOT environment variable, if set.

func ImagePull

func ImagePull(opt *option.Option)

ImagePull tests the `POST images/create` API.

func ImagePush

func ImagePush(opt *option.Option)

func ImageRemove

func ImageRemove(opt *option.Option)

ImageRemove tests the delete image API - `DELETE /images/{id}`.

func NetworkCreate

func NetworkCreate(opt *option.Option)

func NetworkInspect

func NetworkInspect(opt *option.Option)

NetworkInspect tests `GET networks/{id}` API.

func NetworkList

func NetworkList(opt *option.Option)

NetworkList tests calling the get networks api.

func NetworkRemove

func NetworkRemove(opt *option.Option)

func SetupLocalRegistry

func SetupLocalRegistry(opt *option.Option)

SetupLocalRegistry can be invoked before running the tests to save time when pulling defaultImage.

It spins up a local registry, tags the alpine image, pushes the tagged image to local registry, and changes defaultImage to be the one pushed to local registry.

After all the tests are done, invoke CleanupLocalRegistry to clean up the local registry.

func SystemEvents

func SystemEvents(opt *option.Option)

SystemEvents tests streaming container events.

func SystemVersion

func SystemVersion(opt *option.Option)

SystemVersion tests the `Get /version` API.

func VolumeInspect

func VolumeInspect(opt *option.Option)

VolumeInspect tests volume inspect API - GET /volumes/{volume_name}.

func VolumeList

func VolumeList(opt *option.Option)

VolumeList tests listing volumes.

func VolumeRemove

func VolumeRemove(opt *option.Option)

VolumeRemove tests the volume remove API.

Types

type CGMode

type CGMode int

CGMode is the cgroups mode of the host system. We copy the struct from containerd/cgroups [1] instead of using it as a library because it only builds on linux, while we don't really need the functions that make it only build on linux (e.g., determine the cgroup version of the current host).

[1] https://github.com/containerd/cgroups/blob/cc78c6c1e32dc5bde018d92999910fdace3cfa27/utils.go#L38-L50

const (
	// Unavailable cgroup mountpoint.
	Unavailable CGMode = iota
	// Legacy cgroups v1.
	Legacy
	// Hybrid with cgroups v1 and v2 controllers mounted.
	Hybrid
	// Unified with only cgroups v2 mounted.
	Unified
)

Jump to

Keyboard shortcuts

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