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 ¶
- func Build(o *option.Option)
- func BuilderPrune(o *option.Option)
- func CleanupLocalRegistry(o *option.Option)
- func ComposeBuild(o *option.Option)
- func ComposeDown(o *option.Option)
- func ComposeKill(o *option.Option)
- func ComposeLogs(o *option.Option)
- func ComposePs(o *option.Option)
- func ComposePull(o *option.Option)
- func Cp(o *option.Option)
- func Create(o *option.Option)
- func Events(o *option.Option)
- func Exec(o *option.Option)
- func ImageHistory(o *option.Option)
- func ImageInspect(o *option.Option)
- func ImagePrune(o *option.Option)
- func Images(o *option.Option)
- func Info(o *option.Option)
- func Inspect(o *option.Option)
- func Kill(o *option.Option)
- func Load(o *option.Option)
- func Login(o *option.Option)
- func Logout(o *option.Option)
- func Logs(o *option.Option)
- func NetworkCreate(o *option.Option)
- func NetworkInspect(o *option.Option)
- func NetworkLs(o *option.Option)
- func NetworkRm(o *option.Option)
- func Port(o *option.Option)
- func Ps(o *option.Option)
- func Pull(o *option.Option)
- func Push(o *option.Option)
- func Restart(o *option.Option)
- func Rm(o *option.Option)
- func Rmi(o *option.Option)
- func Run(o *RunOption)
- func Save(o *option.Option)
- func SetupLocalRegistry(o *option.Option)
- func Start(o *option.Option)
- func Stats(o *option.Option)
- func Stop(o *option.Option)
- func Tag(o *option.Option)
- func VolumeCreate(o *option.Option)
- func VolumeInspect(o *option.Option)
- func VolumeLs(o *option.Option)
- func VolumePrune(o *option.Option)
- func VolumeRm(o *option.Option)
- type CGMode
- type MountJSON
- type RunOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
Build command building an image.
TODO: --no-cache, syntax check for docker files --no-cache flag is added to tests asserting the output from `RUN` command. [Discussion]: https://github.com/runfinch/common-tests/pull/4#discussion_r971338825
func BuilderPrune ¶
BuilderPrune tests the "builder prune" command that prunes the builder cache.
func CleanupLocalRegistry ¶
CleanupLocalRegistry removes the local registry container and image. It's used together with SetupLocalRegistry, and should be invoked after running all the tests.
func ComposeBuild ¶
ComposeBuild tests functionality of `compose build` command.
func ComposeDown ¶
ComposeDown tests functionality of `compose down` command.
func ComposeKill ¶
ComposeKill tests functionality of `compose` command.
func ComposeLogs ¶
ComposeLogs tests functionality of `compose logs` command.
func ComposePull ¶
ComposePull tests functionality of `compose pull` command.
func Cp ¶ added in v0.2.0
Cp tests `finch cp` command to copy files between container and host filesystems.
func Events ¶
Events tests "events" command that gets real time events from server, synonyms to "system events" command.
func ImageHistory ¶
ImageHistory tests "image history" command that shows the history of an image.
func ImageInspect ¶
ImageInspect tests "image inspect" command that displays detailed information on one or more images.
func ImagePrune ¶
ImagePrune tests "image prune" command that removes unused images.
func Info ¶
Info tests "info" command that displays system-wide information, synonyms to "system info" command.
func NetworkCreate ¶
NetworkCreate tests the "network create" command that creates a network.
func NetworkInspect ¶
NetworkInspect tests the "network inspect" command that displays detailed information on one or more networks.
func Run ¶
func Run(o *RunOption)
Run tests running a container image. TODO: test cases for bind propagation options.
func SetupLocalRegistry ¶
SetupLocalRegistry can be invoked before running the tests to save time when pulling images during tests.
It spins up a local registry, tags all remoteImages, pushes the new tagged images to the local registry, and changes adds corresponding entries to localImages for all of the new tags pushed to local registry.
After all the tests are done, invoke CleanupLocalRegistry to clean up the local registry.
func VolumeCreate ¶
VolumeCreate tests "volume create" command that creates a volume.
func VolumeInspect ¶
VolumeInspect tests "volume inspect" command that displays detailed information on one or more volumes.
func VolumePrune ¶
VolumePrune tests "volume prune" command that removes all unused volumes.
Types ¶
type CGMode ¶ added in v0.2.0
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
type MountJSON ¶
type MountJSON struct { MountType string `json:"Type"` Source string `json:"Source"` Destination string `json:"Destination"` Mode string `json:"Mode"` Rw bool `json:"RW"` }
MountJSON is used to parse the json from the command images inspect --format "{{json .Mounts}}".
type RunOption ¶ added in v0.2.0
type RunOption struct { // BaseOpt instructs how to run the test subject. BaseOpt *option.Option // CGMode is the cgroup mode that the host uses. CGMode CGMode // DefaultHostGatewayIP is the IP that the test subject will resolve special IP `host-gateway` to. DefaultHostGatewayIP string }
RunOption is the custom option to run tests in run.go.
Source Files
¶
- build.go
- builder_prune.go
- compose_build.go
- compose_down.go
- compose_kill.go
- compose_logs.go
- compose_ps.go
- compose_pull.go
- cp.go
- create.go
- events.go
- exec.go
- image_history.go
- image_inspect.go
- image_prune.go
- images.go
- info.go
- inspect.go
- kill.go
- load.go
- login.go
- logout.go
- logs.go
- network_create.go
- network_inspect.go
- network_ls.go
- network_rm.go
- port.go
- ps.go
- pull.go
- push.go
- restart.go
- rm.go
- rmi.go
- run.go
- save.go
- start.go
- stats.go
- stop.go
- tag.go
- tests.go
- volume_create.go
- volume_inspect.go
- volume_ls.go
- volume_prune.go
- volume_rm.go