vcttesting package

Subpackages

Submodules

vcttesting.docker module

class vcttesting.docker.Docker(url, tls=False)

Bases: object

auto_clean_orphans(runtests_label)

Ensure all containers with the special runtests_label are cleaned.

execute(cid, cmd, stdout=False, stderr=False, stream=False, detach=False)

Execute a command on a container.

Returns the output of the command.

This mimics the old docker.execute() API, which was removed in docker-py 1.3.0.

get_code_coverage(cid, filemap=None)

Obtain code coverage data from a container.

Containers can be programmed to collect code coverage from executed programs automatically. Our convention is to place coverage files in /coverage.

This method will fetch coverage files and parse them into data structures, which it will emit.

If a filemap dict is passed, it will be used to map filenames inside the container to local filesystem paths. When present, files not inside the map will be ignored.

get_directory_contents(cid, path, tar='/bin/tar')

Obtain the contents of all files in a directory in a container.

This is done by invoking “tar” inside the container and piping the results to us.

This returns an iterable of tarfile.TarInfo, fileobj 2-tuples.

get_file_content(cid, path)

Get the contents of a file from a container.

is_alive()

Whether the connection to Docker is alive.

network_config(network_name, alias)

Obtain a networking config object.

exception vcttesting.docker.DockerNotAvailable

Bases: Exception

Error raised when Docker is not available.

vcttesting.docker.docker_rollback_on_error(client)

Perform Docker operations as a transaction of sorts.

Returns a modified Docker client instance. Creation events performed on the client while the context manager is active will be undone if an exception occurs. This allows complex operations such as the creation of multiple containers to be rolled back automatically if an error occurs.

vcttesting.docker.params_from_env(env)

Obtain Docker connect parameters from the environment.

This returns a tuple that should be used for base_url and tls arguments of Docker.__init__.

vcttesting.docker.rsync(*args)

vcttesting.docker_mach_commands module

vcttesting.pulse_mach_commands module

vcttesting.unittest module

Module contents