Skip to content

aea.test_tools.docker_image

This module contains testing utilities.

DockerImage Objects

class DockerImage(ABC)

A class to wrap interaction with a Docker image.

__init__

def __init__(client: DockerClient)

Initialize.

check_skip

def check_skip() -> None

Check whether the test should be skipped.

By default, nothing happens.

tag

@property
@abstractmethod
def tag() -> str

Return the tag of the image.

stop_if_already_running

def stop_if_already_running() -> None

Stop the running images with the same tag, if any.

create

@abstractmethod
def create() -> Container

Instantiate the image in a container.

wait

@abstractmethod
def wait(max_attempts: int = 15, sleep_rate: float = 1.0) -> bool

Wait until the image is running.

Arguments:

  • max_attempts: max number of attempts.
  • sleep_rate: the amount of time to sleep between different requests.

Returns:

True if the wait was successful, False otherwise.

launch_image

def launch_image(image: DockerImage,
                 timeout: float = 2.0,
                 max_attempts: int = 10) -> Generator

Launch image.