buildtest.executors.base

BuildExecutor: manager for test executors

Module Contents

Classes

BaseExecutor(name, settings, config_opts)

The BaseExecutor is an abstract base class for all executors. All

SSHExecutor(name, settings, config_opts)

The BaseExecutor is an abstract base class for all executors. All

class buildtest.executors.base.BaseExecutor(name, settings, config_opts)

The BaseExecutor is an abstract base class for all executors. All executors must have a listing of steps and dryrun_steps

steps = ['setup', 'run']
type = base
__repr__(self)

Return repr(self).

__str__(self)

Return str(self).

check_regex(self, regex)

This method conducts a regular expression check using ‘re.search’ with regular expression defined in Buildspec. User must specify an output stream (stdout, stderr) to select when performing regex. In buildtest, this would read the .out or .err file based on stream and run the regular expression to see if there is a match.

Parameters:

Parameters

regex (str, required) – Regular expression object defined in Buildspec file

Returns

A boolean return True/False based on if re.search is successful or not

Return type

bool

check_test_state(self)

This method is responsible for detecting state of test (PASS/FAIL) based on returncode or regular expression.

get_formatted_time(self, key, fmt='%Y/%m/%d %X')

Given some timestamp key in self.metadata, return a pretty printed version of it. This is intended to log in the console for the user.

Parameters:

key: The key to look up in the metadata fmt: the format string to use

load(self)

Load a particular configuration based on the name. This method should set defaults for the executor, and will vary based on the class.

run(self)

The run step basically runs the build. This is run after setup so we are sure that the builder is defined. This is also where we set the result to return.

write_testresults(self, out, err)

This method writes test results into output and error file.

Parameters :param out: content of output stream :type out: list :param err: content of error stream :type err: list

class buildtest.executors.base.SSHExecutor(name, settings, config_opts)

Bases: buildtest.executors.base.BaseExecutor

The BaseExecutor is an abstract base class for all executors. All executors must have a listing of steps and dryrun_steps

type = ssh