Skip to content

plugins.aea-cli-benchmark.aea_cli_benchmark.case_tx_generate.docker_image

This module contains testing utilities.

DockerImage Objects

class DockerImage(ABC)

A class to wrap interatction with a Docker image.

__init__

def __init__(client: docker.DockerClient)

Initialize.

check_skip

def check_skip()

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()

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.

GanacheDockerImage Objects

class GanacheDockerImage(DockerImage)

Wrapper to Ganache Docker image.

__init__

def __init__(client: DockerClient,
             addr: str,
             port: int,
             config: Optional[Dict] = None,
             gas_limit: int = 10000000000000)

Initialize the Ganache Docker image.

Arguments:

  • client: the Docker client.
  • addr: the address.
  • port: the port.
  • config: optional configuration to command line.
  • gas_limit: gas limit.

tag

@property
def tag() -> str

Get the image tag.

create

def create() -> Container

Create the container.

wait

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

Wait until the image is up.

FetchLedgerDockerImage Objects

class FetchLedgerDockerImage(DockerImage)

Wrapper to Fetch ledger Docker image.

__init__

def __init__(client: DockerClient,
             addr: str,
             port: int,
             tag: str,
             config: Optional[Dict] = None)

Initialize the Fetch ledger Docker image.

Arguments:

  • client: the Docker client.
  • addr: the address.
  • port: the port.
  • tag: image tag
  • config: optional configuration to command line.

tag

@property
def tag() -> str

Get the image tag.

create

def create() -> Container

Create the container.

wait

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

Wait until the image is up.