tests

package module
v0.0.0-...-21e5471 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

README

Build Status Build Status Build Status

Clear Containers Tests Repository

This repository contains the test suite for the Clear Containers 3.0 project, including functional and integration tests with Docker*, Kubernetes* and OpenShift*.

A properly set up environment with Clear Containers is needed to execute these tests. For instructions on how to setup Clear Containers, please refer to the: Installation Guides

Functional tests

Execute:

	$ sudo -E PATH=$PATH make functional

Docker integration tests

Execute:

	$ sudo -E PATH=$PATH make integration

Functional and Docker integration tests

Execute:

	$ sudo -E PATH=$PATH make check

Environment variables

By default, these tests use the version of cc-runtime set in the environment variable RUNTIME, but you can easily change it. For example:

	$ RUNTIME="/usr/local/bin/cc-runtime" make functional

In the above example, the version of runtime installed in /usr/local/bin is being used.

These are the environment variables that you can change:

  • RUNTIME - Path of Clear Containers runtime, the default path is cc-runtime.
  • TIMEOUT - Time limit in seconds for each test, the default timeout is 15.

QA gating process

The Clear Containers project has a gating process to prevent introducing regressions. When a patch is submitted via a pull request (PR), a continuous integration system launches tests in different machines to ensure the change does not break current functionality.

The tests executed are:

  • Functional Tests
  • Integration Tests
  • Docker popular images tests

If a failure is detected in any of these tests, the pull request will be blocked to prevent it from being merged. To reproduce the failure locally, you can execute the tests on your environment using these instructions.

If new functionality is being added on a PR, it is recommended to at least add a basic functional test to verify it works correctly and/or open an issue in this repository to develop more tests for this new functionality.

Documentation

Index

Constants

View Source
const (
	// Docker command
	Docker = "docker"

	// Image used to run containers
	Image = "busybox"

	// AlpineImage is the alpine image
	AlpineImage = "alpine"

	// PostgresImage is the postgres image
	PostgresImage = "postgres"

	// DebianImage is the debian image
	DebianImage = "debian"

	// FedoraImage is the fedora image
	FedoraImage = "fedora"
)

Variables

View Source
var Runtime string

Runtime is the path of Clear Containers Runtime

View Source
var Timeout int

Timeout specifies the time limit in seconds for each test

Functions

func DockerAttach

func DockerAttach(args ...string) (string, string, int)

DockerAttach attach to a running container

func DockerBuild

func DockerBuild(args ...string) (string, string, int)

DockerBuild builds an image from a Dockerfile

func DockerCommit

func DockerCommit(args ...string) (string, string, int)

DockerCommit creates a new image from a container's changes

func DockerCp

func DockerCp(args ...string) (string, string, int)

DockerCp copies files/folders between a container and the local filesystem

func DockerCreate

func DockerCreate(args ...string) (string, string, int)

DockerCreate creates a new container

func DockerDiff

func DockerDiff(args ...string) (string, string, int)

DockerDiff inspect changes to files or directories on a container’s filesystem

func DockerExec

func DockerExec(args ...string) (string, string, int)

DockerExec runs a command in a running container

func DockerExport

func DockerExport(args ...string) (string, string, int)

DockerExport will export a container’s filesystem as a tar archive

func DockerImages

func DockerImages(args ...string) (string, string, int)

DockerImages list images

func DockerImport

func DockerImport(args ...string) (string, string, int)

DockerImport imports the contents from a tarball to create a filesystem image

func DockerInfo

func DockerInfo() (string, string, int)

DockerInfo displays system-wide information

func DockerKill

func DockerKill(args ...string) (string, string, int)

DockerKill kills a container

func DockerNetwork

func DockerNetwork(args ...string) (string, string, int)

DockerNetwork manages networks

func DockerPause

func DockerPause(args ...string) (string, string, int)

DockerPause pauses all processes within one or more containers

func DockerPs

func DockerPs(args ...string) (string, string, int)

DockerPs list containers

func DockerPull

func DockerPull(args ...string) (string, string, int)

DockerPull downloads the specific image

func DockerRm

func DockerRm(args ...string) (string, string, int)

DockerRm removes a container

func DockerRmi

func DockerRmi(args ...string) (string, string, int)

DockerRmi removes one or more images

func DockerRun

func DockerRun(args ...string) (string, string, int)

DockerRun runs a container

func DockerRunWithPipe

func DockerRunWithPipe(stdin *bytes.Buffer, args ...string) (string, string, int)

DockerRunWithPipe runs a container with stdin

func DockerSearch

func DockerSearch(args ...string) (string, string, int)

DockerSearch searchs docker hub images

func DockerService

func DockerService(args ...string) (string, string, int)

DockerService manages services

func DockerStart

func DockerStart(args ...string) (string, string, int)

DockerStart starts one or more stopped containers

func DockerStop

func DockerStop(args ...string) (string, string, int)

DockerStop stops a container returns true on success else false

func DockerSwarm

func DockerSwarm(args ...string) (string, string, int)

DockerSwarm manages swarm

func DockerTop

func DockerTop(args ...string) (string, string, int)

DockerTop displays the running processes of a container

func DockerUnpause

func DockerUnpause(args ...string) (string, string, int)

DockerUnpause unpauses all processes within one or more containers

func DockerVolume

func DockerVolume(args ...string) (string, string, int)

DockerVolume manages volumes

func ExistDockerContainer

func ExistDockerContainer(name string) bool

ExistDockerContainer returns true if any of next cases is true: - 'docker ps -a' command shows the container - the VM is running (qemu) else false is returned

func ExitCodeDockerContainer

func ExitCodeDockerContainer(name string, waitForExit bool) (int, error)

ExitCodeDockerContainer returns the container exit code

func IsRunningDockerContainer

func IsRunningDockerContainer(name string) bool

IsRunningDockerContainer inspects a container returns true if is running

func IsVMRunning

func IsVMRunning(containerID string) bool

IsVMRunning looks in /proc for a hypervisor process that contains the containerID in its command line

func KillDockerContainer

func KillDockerContainer(name string) bool

KillDockerContainer kills a container

func LogIfFail

func LogIfFail(format string, args ...interface{})

LogIfFail will output the message online if the test fails. This can be used for information that would be useful to debug a failure.

func LogsDockerContainer

func LogsDockerContainer(name string) (string, error)

LogsDockerContainer returns the container logs

func RandID

func RandID(n int) string

RandID returns a random string

func RemoveDockerContainer

func RemoveDockerContainer(name string) bool

RemoveDockerContainer removes a container using docker rm -f

func StatusDockerContainer

func StatusDockerContainer(name string) string

StatusDockerContainer returns the container status

func StopDockerContainer

func StopDockerContainer(name string) bool

StopDockerContainer stops a container

func WaitForRunningDockerContainer

func WaitForRunningDockerContainer(name string, running bool) error

Types

type Bundle

type Bundle struct {
	// Config represents the config.json
	Config *spec.Spec

	// Path to the bundle
	Path string
}

Bundle represents the root directory where config.json and rootfs are

func NewBundle

func NewBundle(workload []string) (*Bundle, error)

NewBundle creates a new bundle

func (*Bundle) Remove

func (b *Bundle) Remove() error

Remove the bundle files and directories

func (*Bundle) Save

func (b *Bundle) Save() error

Save to disk the Config

type Command

type Command struct {

	// Timeout is the time limit of seconds of the command
	Timeout time.Duration
	// contains filtered or unexported fields
}

Command contains the information of the command to run

func NewCommand

func NewCommand(path string, args ...string) *Command

NewCommand returns a new instance of Command

func (*Command) Run

func (c *Command) Run() (string, string, int)

Run runs a command returning its stdout, stderr and exit code

func (*Command) RunWithPipe

func (c *Command) RunWithPipe(stdin *bytes.Buffer) (string, string, int)

Run runs a command with stdin as an input and returning its stdout, stderr and exit code

type Container

type Container struct {
	// Bundle contains the container information
	// if nil then try to run the container without --bundle option
	Bundle *Bundle

	// Console pty slave path
	// if nil then try to run the container without --console option
	Console *string

	// PidFile where process id is written
	// if nil then try to run the container without --pid-file option
	PidFile *string

	// LogFile where debug information is written
	// if nil then try to run the container without --log option
	LogFile *string

	// Detach allows to run the process detached from the shell
	Detach bool

	// ID of the container
	// if nil then try to run the container without container ID
	ID *string
}

Container represents a clear container

func NewContainer

func NewContainer(workload []string, detach bool) (*Container, error)

NewContainer returns a new Container

func (*Container) Delete

func (c *Container) Delete(force bool) (string, string, int)

Delete the container calls to delete command returning its stdout, stderr and exit code

func (*Container) Exec

func (c *Container) Exec(process Process) (string, string, int)

Exec the container calls into exec command returning its stdout, stderr and exit code

func (*Container) Exist

func (c *Container) Exist() bool

Exist returns true if any of next cases is true: - list command shows the container - the process id specified in the pid file is running (cc-shim) - the VM is running (qemu) else false is returned

func (*Container) Kill

func (c *Container) Kill(all bool, signal interface{}) (string, string, int)

Kill the container calls to kill command returning its stdout, stderr and exit code

func (*Container) List

func (c *Container) List(format string, quiet bool, all bool) (string, string, int)

List the containers calls to list command returning its stdout, stderr and exit code

func (*Container) RemoveOption

func (c *Container) RemoveOption(option string) error

RemoveOption removes a specific option container will run without the specific option

func (*Container) Run

func (c *Container) Run() (string, string, int)

Run the container calls to run command returning its stdout, stderr and exit code

func (*Container) SetWorkload

func (c *Container) SetWorkload(workload []string) error

SetWorkload sets a workload for the container

func (*Container) Teardown

func (c *Container) Teardown() error

Teardown deletes the container if it is running, ensures the container is not running and removes any file created by the container

type Process

type Process struct {
	ContainerID *string
	Console     *string
	Tty         *string
	Detach      bool
	Workload    []string
}

Process describes a process to be executed on a running container.

Directories

Path Synopsis
cmd
checkcommits command
checkmetrics command
Program checkmetrics compares the results from a set of Clear Containers metrics results, stored in CSV files, against a set of baseline metrics 'expectations', defined in a TOML file.
Program checkmetrics compares the results from a set of Clear Containers metrics results, stored in CSV files, against a set of baseline metrics 'expectations', defined in a TOML file.
emailreport command
fetchbranches command
localCI command
set_dma_latency command
integration

Jump to

Keyboard shortcuts

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