avocado_runner_remote package¶
Module contents¶
-
exception
avocado_runner_remote.
ConnectError
¶
-
class
avocado_runner_remote.
DummyLoader
(args, extra_params)¶ Bases:
avocado.core.loader.TestLoader
Dummy-runner loader class
-
discover
(reference, which_tests=<DiscoverMode.DEFAULT: <object object>>)¶ Discover (possible) tests from an reference.
Parameters: - reference (str) – the reference to be inspected.
- which_tests (
DiscoverMode
) – Limit tests to be displayed
Returns: a list of test matching the reference as params.
-
static
get_decorator_mapping
()¶ Get label mapping for display in test listing.
Returns: Dict {TestClass: decorator function}
-
static
get_type_label_mapping
()¶ Get label mapping for display in test listing.
Returns: Dict {TestClass: ‘TEST_LABEL_STRING’}
-
name
= 'dummy'¶
-
-
class
avocado_runner_remote.
Remote
(hostname, username=None, password=None, key_filename=None, port=22, timeout=60, attempts=10, env_keep=None)¶ Bases:
object
Performs remote operations.
Creates an instance of
Remote
.Parameters: - hostname – the hostname.
- username – the username. Default: autodetect.
- password – the password. Default: try to use public key.
- key_filename – path to an identity file (Example: .pem files from Amazon EC2).
- timeout – remote command timeout, in seconds. Default: 60.
- attempts – number of attempts to connect. Default: 10.
-
makedir
(remote_path)¶ Create a directory.
Parameters: remote_path – the remote path to create.
-
receive_files
(**kwargs)¶
-
run
(**kwargs)¶
-
send_files
(**kwargs)¶
-
uptime
()¶ Performs uptime (good to check connection).
Returns: the uptime string or empty string if fails.
-
class
avocado_runner_remote.
RemoteCLI
¶ Bases:
avocado.core.plugin_interfaces.CLI
Run tests on a remote machine
-
configure
(parser)¶ Configures the command line parser with options specific to this plugin
-
description
= "Remote machine options for 'run' subcommand"¶
-
name
= 'remote'¶
-
run
(config)¶ Execute any action the plugin intends.
Example of action may include activating a special features upon finding that the requested command line options were set by the user.
Note: this plugin class is not intended for adding new commands, for that please use CLICmd.
-
-
class
avocado_runner_remote.
RemoteTestRunner
¶ Bases:
avocado.core.plugin_interfaces.Runner
Tooled Runner to run on a remote machine using SSH
-
check_remote_avocado
()¶ Checks if the remote system appears to have avocado installed
The “appears to have” description is justified by the fact that the check is rather simplistic, it attempts to run an avocado -v command and checks if the output looks like what avocado would print out.
Return type: tuple with (bool, tuple) Returns: (True, (x, y, z)) if avocado appears to be installed and (False, None) otherwise.
-
description
= 'Runs on a remote machine using SSH'¶
-
name
= 'remote'¶
-
remote
= None¶ remoter connection to the remote machine
-
remote_version_re
= re.compile('^Avocado (\\d+)\\.(\\d+)\\r?$', re.MULTILINE)¶
-
run_suite
(job, result, test_suite, variants, timeout=0, replay_map=None, execution_order='variants-per-test')¶ Run one or more tests and report with test result.
Parameters: - params_list – a list of param dicts.
- variants – A varianter iterator (unused here)
Returns: a set with types of test failures.
-
run_test
(job, references, timeout)¶ Run tests.
Parameters: references – a string with test references. Returns: a dictionary with test results.
-
setup
(job)¶ Setup remote environment
-
tear_down
(job)¶ This method is only called when run_suite gets to the point of to be executing setup method and is called at the end of the execution.
Warning: It might be called on setup exceptions, so things initialized during setup might not yet be initialized.
-
-
avocado_runner_remote.
receive_files
(local_path, remote_path)¶ Receive files from the defined fabric host.
This assumes the fabric environment was previously (and properly) initialized.
Parameters: - local_path – the local path.
- remote_path – the remote path.
-
avocado_runner_remote.
run
(command, ignore_status=False, quiet=True, timeout=60)¶ Executes a command on the defined fabric hosts.
This is basically a wrapper to fabric.operations.run, encapsulating the result on an avocado process.CmdResult object. This also assumes the fabric environment was previously (and properly) initialized.
Parameters: - command – the command string to execute.
- ignore_status – Whether to not raise exceptions in case the command’s return code is different than zero.
- timeout – Maximum time allowed for the command to return.
- quiet – Whether to not log command stdout/err. Default: True.
Returns: the result of the remote program’s execution.
Return type: Raises: fabric.exceptions.CommandTimeout – When timeout exhausted.
-
avocado_runner_remote.
send_files
(local_path, remote_path)¶ Send files to the defined fabric host.
This assumes the fabric environment was previously (and properly) initialized.
Parameters: - local_path – the local path.
- remote_path – the remote path.