testplan.testing.multitest.driver package
Subpackages
- testplan.testing.multitest.driver.tcp package
- Submodules
- testplan.testing.multitest.driver.tcp.client module
TCPClient
TCPClient.CONFIG
TCPClient.EXTRACTORS
TCPClient.STATUS
TCPClient.abort()
TCPClient.abort_dependencies()
TCPClient.aborted
TCPClient.aborting()
TCPClient.active
TCPClient.async_start
TCPClient.auto_start
TCPClient.cfg
TCPClient.close()
TCPClient.connect()
TCPClient.connection_identifier
TCPClient.context
TCPClient.context_input()
TCPClient.define_runpath()
TCPClient.errpath
TCPClient.extract_values()
TCPClient.failover()
TCPClient.fetch_error_log()
TCPClient.filter_locals()
TCPClient.force_started()
TCPClient.force_stop()
TCPClient.get_connections()
TCPClient.host
TCPClient.install_files()
TCPClient.is_alive
TCPClient.local_host
TCPClient.local_port
TCPClient.logger
TCPClient.logpath
TCPClient.make_runpath_dirs()
TCPClient.name
TCPClient.outpath
TCPClient.parent
TCPClient.pause()
TCPClient.pausing()
TCPClient.pending_work()
TCPClient.port
TCPClient.post_start()
TCPClient.post_stop()
TCPClient.pre_start()
TCPClient.pre_stop()
TCPClient.receive()
TCPClient.receive_text()
TCPClient.reconnect()
TCPClient.register_failover()
TCPClient.report
TCPClient.restart()
TCPClient.resume()
TCPClient.resuming()
TCPClient.runpath
TCPClient.scratch
TCPClient.send()
TCPClient.send_text()
TCPClient.send_tsp()
TCPClient.server_port
TCPClient.start()
TCPClient.start_timeout
TCPClient.started_check()
TCPClient.started_check_interval
TCPClient.starting()
TCPClient.status
TCPClient.stop()
TCPClient.stop_timeout
TCPClient.stopped_check()
TCPClient.stopped_check_interval
TCPClient.stopped_check_with_watch()
TCPClient.stopping()
TCPClient.timer
TCPClient.uid()
TCPClient.wait()
TCPClientConfig
- testplan.testing.multitest.driver.tcp.server module
TCPServer
TCPServer.CONFIG
TCPServer.EXTRACTORS
TCPServer.STATUS
TCPServer.abort()
TCPServer.abort_dependencies()
TCPServer.aborted
TCPServer.aborting()
TCPServer.accept_connection()
TCPServer.active
TCPServer.async_start
TCPServer.auto_start
TCPServer.cfg
TCPServer.close_connection()
TCPServer.connection_identifier
TCPServer.context
TCPServer.context_input()
TCPServer.define_runpath()
TCPServer.errpath
TCPServer.extract_values()
TCPServer.failover()
TCPServer.fetch_error_log()
TCPServer.filter_locals()
TCPServer.force_started()
TCPServer.force_stop()
TCPServer.get_connections()
TCPServer.host
TCPServer.install_files()
TCPServer.is_alive
TCPServer.local_host
TCPServer.local_port
TCPServer.logger
TCPServer.logpath
TCPServer.make_runpath_dirs()
TCPServer.name
TCPServer.outpath
TCPServer.parent
TCPServer.pause()
TCPServer.pausing()
TCPServer.pending_work()
TCPServer.port
TCPServer.post_start()
TCPServer.post_stop()
TCPServer.pre_start()
TCPServer.pre_stop()
TCPServer.receive()
TCPServer.receive_text()
TCPServer.register_failover()
TCPServer.report
TCPServer.restart()
TCPServer.resume()
TCPServer.resuming()
TCPServer.runpath
TCPServer.scratch
TCPServer.send()
TCPServer.send_text()
TCPServer.socket
TCPServer.start()
TCPServer.start_timeout
TCPServer.started_check()
TCPServer.started_check_interval
TCPServer.starting()
TCPServer.status
TCPServer.stop()
TCPServer.stop_timeout
TCPServer.stopped_check()
TCPServer.stopped_check_interval
TCPServer.stopped_check_with_watch()
TCPServer.stopping()
TCPServer.timer
TCPServer.uid()
TCPServer.wait()
TCPServerConfig
- testplan.testing.multitest.driver.tcp.client module
- Module contents
- Submodules
- testplan.testing.multitest.driver.zmq package
- Submodules
- testplan.testing.multitest.driver.zmq.client module
ZMQClient
ZMQClient.CONFIG
ZMQClient.EXTRACTORS
ZMQClient.STATUS
ZMQClient.abort()
ZMQClient.abort_dependencies()
ZMQClient.aborted
ZMQClient.aborting()
ZMQClient.active
ZMQClient.async_start
ZMQClient.auto_start
ZMQClient.cfg
ZMQClient.connect()
ZMQClient.context
ZMQClient.context_input()
ZMQClient.define_runpath()
ZMQClient.disconnect()
ZMQClient.errpath
ZMQClient.extract_values()
ZMQClient.failover()
ZMQClient.fetch_error_log()
ZMQClient.filter_locals()
ZMQClient.flush()
ZMQClient.force_started()
ZMQClient.force_stop()
ZMQClient.get_connections()
ZMQClient.hosts
ZMQClient.install_files()
ZMQClient.is_alive
ZMQClient.logger
ZMQClient.logpath
ZMQClient.make_runpath_dirs()
ZMQClient.name
ZMQClient.outpath
ZMQClient.parent
ZMQClient.pause()
ZMQClient.pausing()
ZMQClient.pending_work()
ZMQClient.ports
ZMQClient.post_start()
ZMQClient.post_stop()
ZMQClient.pre_start()
ZMQClient.pre_stop()
ZMQClient.receive()
ZMQClient.reconnect()
ZMQClient.register_failover()
ZMQClient.report
ZMQClient.restart()
ZMQClient.resume()
ZMQClient.resuming()
ZMQClient.runpath
ZMQClient.scratch
ZMQClient.send()
ZMQClient.start()
ZMQClient.start_timeout
ZMQClient.started_check()
ZMQClient.started_check_interval
ZMQClient.starting()
ZMQClient.status
ZMQClient.stop()
ZMQClient.stop_timeout
ZMQClient.stopped_check()
ZMQClient.stopped_check_interval
ZMQClient.stopped_check_with_watch()
ZMQClient.stopping()
ZMQClient.subscribe()
ZMQClient.timer
ZMQClient.uid()
ZMQClient.unsubscribe()
ZMQClient.wait()
ZMQClientConfig
- testplan.testing.multitest.driver.zmq.server module
ZMQServer
ZMQServer.CONFIG
ZMQServer.EXTRACTORS
ZMQServer.STATUS
ZMQServer.abort()
ZMQServer.abort_dependencies()
ZMQServer.aborted
ZMQServer.aborting()
ZMQServer.active
ZMQServer.async_start
ZMQServer.auto_start
ZMQServer.cfg
ZMQServer.connection_identifier
ZMQServer.context
ZMQServer.context_input()
ZMQServer.define_runpath()
ZMQServer.errpath
ZMQServer.extract_values()
ZMQServer.failover()
ZMQServer.fetch_error_log()
ZMQServer.filter_locals()
ZMQServer.force_started()
ZMQServer.force_stop()
ZMQServer.get_connections()
ZMQServer.host
ZMQServer.install_files()
ZMQServer.is_alive
ZMQServer.local_host
ZMQServer.local_port
ZMQServer.logger
ZMQServer.logpath
ZMQServer.make_runpath_dirs()
ZMQServer.name
ZMQServer.outpath
ZMQServer.parent
ZMQServer.pause()
ZMQServer.pausing()
ZMQServer.pending_work()
ZMQServer.port
ZMQServer.post_start()
ZMQServer.post_stop()
ZMQServer.pre_start()
ZMQServer.pre_stop()
ZMQServer.receive()
ZMQServer.register_failover()
ZMQServer.report
ZMQServer.restart()
ZMQServer.resume()
ZMQServer.resuming()
ZMQServer.runpath
ZMQServer.scratch
ZMQServer.send()
ZMQServer.socket
ZMQServer.start()
ZMQServer.start_timeout
ZMQServer.started_check()
ZMQServer.started_check_interval
ZMQServer.starting()
ZMQServer.status
ZMQServer.stop()
ZMQServer.stop_timeout
ZMQServer.stopped_check()
ZMQServer.stopped_check_interval
ZMQServer.stopped_check_with_watch()
ZMQServer.stopping()
ZMQServer.timer
ZMQServer.uid()
ZMQServer.wait()
ZMQServerConfig
- testplan.testing.multitest.driver.zmq.client module
- Module contents
- Submodules
- testplan.testing.multitest.driver.fix package
- Submodules
- testplan.testing.multitest.driver.fix.client module
FixClient
FixClient.CONFIG
FixClient.EXTRACTORS
FixClient.STATUS
FixClient.abort()
FixClient.abort_dependencies()
FixClient.aborted
FixClient.aborting()
FixClient.active
FixClient.async_start
FixClient.auto_start
FixClient.cfg
FixClient.connect()
FixClient.connection_identifier
FixClient.context
FixClient.context_input()
FixClient.define_runpath()
FixClient.errpath
FixClient.extract_values()
FixClient.failover()
FixClient.fetch_error_log()
FixClient.filter_locals()
FixClient.flush()
FixClient.force_started()
FixClient.force_stop()
FixClient.get_connections()
FixClient.host
FixClient.install_files()
FixClient.is_alive
FixClient.local_host
FixClient.local_port
FixClient.logger
FixClient.logoff()
FixClient.logon()
FixClient.logpath
FixClient.make_runpath_dirs()
FixClient.name
FixClient.outpath
FixClient.parent
FixClient.pause()
FixClient.pausing()
FixClient.pending_work()
FixClient.port
FixClient.post_start()
FixClient.post_stop()
FixClient.pre_start()
FixClient.pre_stop()
FixClient.receive()
FixClient.reconnect()
FixClient.register_failover()
FixClient.report
FixClient.restart()
FixClient.resume()
FixClient.resuming()
FixClient.runpath
FixClient.scratch
FixClient.send()
FixClient.send_tsp()
FixClient.sender
FixClient.sendersub
FixClient.start()
FixClient.start_timeout
FixClient.started_check()
FixClient.started_check_interval
FixClient.starting()
FixClient.status
FixClient.stop()
FixClient.stop_timeout
FixClient.stopped_check()
FixClient.stopped_check_interval
FixClient.stopped_check_with_watch()
FixClient.stopping()
FixClient.target
FixClient.timer
FixClient.uid()
FixClient.wait()
FixClientConfig
- testplan.testing.multitest.driver.fix.server module
FixServer
FixServer.CONFIG
FixServer.EXTRACTORS
FixServer.STATUS
FixServer.abort()
FixServer.abort_dependencies()
FixServer.aborted
FixServer.aborting()
FixServer.active
FixServer.active_connections()
FixServer.async_start
FixServer.auto_start
FixServer.cfg
FixServer.connection_identifier
FixServer.context
FixServer.context_input()
FixServer.define_runpath()
FixServer.errpath
FixServer.extract_values()
FixServer.failover()
FixServer.fetch_error_log()
FixServer.filter_locals()
FixServer.flush()
FixServer.force_started()
FixServer.force_stop()
FixServer.get_connections()
FixServer.host
FixServer.install_files()
FixServer.is_alive
FixServer.is_connection_active()
FixServer.local_host
FixServer.local_port
FixServer.logger
FixServer.logpath
FixServer.make_runpath_dirs()
FixServer.name
FixServer.outpath
FixServer.parent
FixServer.pause()
FixServer.pausing()
FixServer.pending_work()
FixServer.port
FixServer.post_start()
FixServer.post_stop()
FixServer.pre_start()
FixServer.pre_stop()
FixServer.receive()
FixServer.register_failover()
FixServer.report
FixServer.restart()
FixServer.resume()
FixServer.resuming()
FixServer.runpath
FixServer.scratch
FixServer.send()
FixServer.start()
FixServer.start_timeout
FixServer.started_check()
FixServer.started_check_interval
FixServer.starting()
FixServer.status
FixServer.stop()
FixServer.stop_timeout
FixServer.stopped_check()
FixServer.stopped_check_interval
FixServer.stopped_check_with_watch()
FixServer.stopping()
FixServer.timer
FixServer.uid()
FixServer.wait()
FixServerConfig
- testplan.testing.multitest.driver.fix.client module
- Module contents
- Submodules
- testplan.testing.multitest.driver.http package
- Submodules
- testplan.testing.multitest.driver.http.client module
HTTPClient
HTTPClient.CONFIG
HTTPClient.EXTRACTORS
HTTPClient.STATUS
HTTPClient.abort()
HTTPClient.abort_dependencies()
HTTPClient.aborted
HTTPClient.aborting()
HTTPClient.active
HTTPClient.async_start
HTTPClient.auto_start
HTTPClient.cfg
HTTPClient.connection_identifier
HTTPClient.context
HTTPClient.context_input()
HTTPClient.define_runpath()
HTTPClient.delete()
HTTPClient.errpath
HTTPClient.extract_values()
HTTPClient.failover()
HTTPClient.fetch_error_log()
HTTPClient.filter_locals()
HTTPClient.flush()
HTTPClient.force_started()
HTTPClient.force_stop()
HTTPClient.get()
HTTPClient.get_connections()
HTTPClient.head()
HTTPClient.host
HTTPClient.install_files()
HTTPClient.is_alive
HTTPClient.logger
HTTPClient.logpath
HTTPClient.make_runpath_dirs()
HTTPClient.name
HTTPClient.options()
HTTPClient.outpath
HTTPClient.parent
HTTPClient.patch()
HTTPClient.pause()
HTTPClient.pausing()
HTTPClient.pending_work()
HTTPClient.port
HTTPClient.post()
HTTPClient.post_start()
HTTPClient.post_stop()
HTTPClient.pre_start()
HTTPClient.pre_stop()
HTTPClient.put()
HTTPClient.receive()
HTTPClient.register_failover()
HTTPClient.report
HTTPClient.restart()
HTTPClient.resume()
HTTPClient.resuming()
HTTPClient.runpath
HTTPClient.scratch
HTTPClient.send()
HTTPClient.start()
HTTPClient.start_timeout
HTTPClient.started_check()
HTTPClient.started_check_interval
HTTPClient.starting()
HTTPClient.status
HTTPClient.stop()
HTTPClient.stop_timeout
HTTPClient.stopped_check()
HTTPClient.stopped_check_interval
HTTPClient.stopped_check_with_watch()
HTTPClient.stopping()
HTTPClient.timer
HTTPClient.uid()
HTTPClient.wait()
HTTPClientConfig
- testplan.testing.multitest.driver.http.server module
HTTPRequestHandler
HTTPRequestHandler.MessageClass
HTTPRequestHandler.address_string()
HTTPRequestHandler.date_time_string()
HTTPRequestHandler.default_request_version
HTTPRequestHandler.disable_nagle_algorithm
HTTPRequestHandler.do_DELETE()
HTTPRequestHandler.do_GET()
HTTPRequestHandler.do_HEAD()
HTTPRequestHandler.do_OPTIONS()
HTTPRequestHandler.do_PATCH()
HTTPRequestHandler.do_POST()
HTTPRequestHandler.do_PUT()
HTTPRequestHandler.end_headers()
HTTPRequestHandler.error_content_type
HTTPRequestHandler.error_message_format
HTTPRequestHandler.finish()
HTTPRequestHandler.flush_headers()
HTTPRequestHandler.get_response()
HTTPRequestHandler.handle()
HTTPRequestHandler.handle_expect_100()
HTTPRequestHandler.handle_one_request()
HTTPRequestHandler.log_date_time_string()
HTTPRequestHandler.log_error()
HTTPRequestHandler.log_message()
HTTPRequestHandler.log_request()
HTTPRequestHandler.monthname
HTTPRequestHandler.parse_request()
HTTPRequestHandler.protocol_version
HTTPRequestHandler.rbufsize
HTTPRequestHandler.responses
HTTPRequestHandler.send_error()
HTTPRequestHandler.send_header()
HTTPRequestHandler.send_response()
HTTPRequestHandler.send_response_only()
HTTPRequestHandler.server_version
HTTPRequestHandler.setup()
HTTPRequestHandler.sys_version
HTTPRequestHandler.timeout
HTTPRequestHandler.version_string()
HTTPRequestHandler.wbufsize
HTTPRequestHandler.weekdayname
HTTPResponse
HTTPServer
HTTPServer.CONFIG
HTTPServer.EXTRACTORS
HTTPServer.STATUS
HTTPServer.abort()
HTTPServer.abort_dependencies()
HTTPServer.aborted
HTTPServer.aborting()
HTTPServer.active
HTTPServer.async_start
HTTPServer.auto_start
HTTPServer.cfg
HTTPServer.connection_identifier
HTTPServer.context
HTTPServer.context_input()
HTTPServer.define_runpath()
HTTPServer.errpath
HTTPServer.extract_values()
HTTPServer.failover()
HTTPServer.fetch_error_log()
HTTPServer.filter_locals()
HTTPServer.flush_request_queue()
HTTPServer.force_started()
HTTPServer.force_stop()
HTTPServer.get_connections()
HTTPServer.get_full_request()
HTTPServer.get_request()
HTTPServer.host
HTTPServer.install_files()
HTTPServer.is_alive
HTTPServer.local_host
HTTPServer.local_port
HTTPServer.logger
HTTPServer.logpath
HTTPServer.make_runpath_dirs()
HTTPServer.name
HTTPServer.outpath
HTTPServer.parent
HTTPServer.pause()
HTTPServer.pausing()
HTTPServer.pending_work()
HTTPServer.port
HTTPServer.post_start()
HTTPServer.post_stop()
HTTPServer.pre_start()
HTTPServer.pre_stop()
HTTPServer.queue_response()
HTTPServer.receive()
HTTPServer.register_failover()
HTTPServer.report
HTTPServer.respond()
HTTPServer.restart()
HTTPServer.resume()
HTTPServer.resuming()
HTTPServer.runpath
HTTPServer.scratch
HTTPServer.start()
HTTPServer.start_timeout
HTTPServer.started_check()
HTTPServer.started_check_interval
HTTPServer.starting()
HTTPServer.status
HTTPServer.stop()
HTTPServer.stop_timeout
HTTPServer.stopped_check()
HTTPServer.stopped_check_interval
HTTPServer.stopped_check_with_watch()
HTTPServer.stopping()
HTTPServer.timer
HTTPServer.uid()
HTTPServer.wait()
HTTPServerConfig
ReceivedRequest
- testplan.testing.multitest.driver.http.client module
- Module contents
- Submodules
- testplan.testing.multitest.driver.connection package
- Submodules
- testplan.testing.multitest.driver.connection.base module
- testplan.testing.multitest.driver.connection.connection_info module
- testplan.testing.multitest.driver.connection.connection_extractor module
- Module contents
- Submodules
Submodules
testplan.testing.multitest.driver.app module
Generic application driver.
- class testplan.testing.multitest.driver.app.App(name: str, binary: str, pre_args: List[str | ContextValue] | str | ContextValue = None, args: List[str | ContextValue] | str | ContextValue = None, shell: bool = False, env: Dict[str, str] = None, binary_strategy: Literal['copy', 'link', 'noop'] = 'link', logname: str = None, app_dir_name: str = None, working_dir: str = None, expected_retcode: int = None, stop_signal: Signals | None = None, stop_timeout: float = 5, binary_log: bool = False, **options)[source]
Bases:
Driver
Binary application driver.
{emphasized_members_docs}
- Parameters:
name – Driver name. Also uid.
binary – Path to the application binary.
pre_args – Arguments to be prepended to binary command. An argument can be a
ContextValue
and will be expanded on runtime.args – Arguments to be appended to binary command. An argument can be a
ContextValue
and will be expanded on runtime.shell – Invoke shell for command execution.
env – Environmental variables to be made available to child process; context value (when referring to other driver) and jinja2 template (when referring to self) will be resolved.
binary_strategy – Whether to copy / link binary to runpath.
logname – Base name of driver logfile under app_path, in which Testplan will look for log_regexps as driver start-up condition. Default to “stdout” (to match the output stream of binary).
app_dir_name – Application directory name.
working_dir – Application working directory. Default: runpath
expected_retcode – the expected return code of the subprocess. Default value is None meaning it won’t be checked. Set it to 0 to ennsure the driver is always gracefully shut down.
stop_signal – Shutdown signal to be sent to subprocess.
stop_timeout – Timeout for graceful shutdown (in seconds).
binary_log – if True the log_matcher will handle the logfile as binary, and need to use binary regexps. Default value is False.
Also inherits all
Driver
options.- EXTRACTORS: List[BaseConnectionExtractor] = [<testplan.testing.multitest.driver.connection.connection_extractor.SubprocessFileConnectionExtractor object>, <testplan.testing.multitest.driver.connection.connection_extractor.SubprocessPortConnectionExtractor object>]
- STATUS
alias of
ResourceStatus
- abort()
Default abort policy. First abort all dependencies and then itself.
- abort_dependencies()
Returns an empty generator.
- property aborted
Returns if entity was aborted.
- property active
Entity not aborting/aborted.
- property alive_child_procs: List[Process]
- property app_path: str
Application directory path.
- property async_start: bool
Overrides the default async_start value in config.
- property auto_start
If False, the resource will not be automatically started by its parent (generally, a Environment object) while the parent is starting.
- property binary: str
The actual binary to execute, might be copied/linked to runpath
- property binpath: str
‘bin’ directory under runpath.
- property cfg
Configuration object.
- property cmd: str
Command that starts the application.
- property context
Key/value pair information of a Resource.
- context_input(exclude: list = None) Dict[str, Any]
All attr of self in a dict for context resolution
- define_runpath()
Define runpath directory based on parent object and configuration.
- property env: Dict[str, str] | None
Environment variables.
- property errpath: str
Path for stderr file regex matching.
- property etcpath: str
‘etc’ directory under runpath.
- extract_values() bool | FailedAction
Extract matching values from input regex configuration options.
- failover() None
API to create the failover resource, to be implemented in derived class
- fetch_error_log() List[str]
Fetch error message from the log files of driver, at first we can try self.errpath, if it does not exist, try self.logpath. Typically, several lines from the tail of file will be selected.
- Returns:
text from log file
- classmethod filter_locals(local_vars)
Filter out init params of None value, they will take default value defined in its ConfigOption object; also filter out special vars that are not init params from local_vars.
- Parameters:
local_vars
- force_started()
Change the status to STARTED (e.g. exception raised).
- force_stop()
Change the status to STOPPED (e.g. exception raised).
- get_connections() List[BaseConnectionInfo]
- property hostname: str
- Returns:
hostname where the ETSApp is running
- install_files() None
Installs the files specified in the install_files parameter at the install target.
- property is_alive
Called to periodically poll the resource health. Default implementation assumes the resource is always healthy.
- property log_matcher: LogMatcher
Create if not exist and return the LogMatcher object that reads the log / stdout of the driver.
- Returns:
LogMatcher instance
- property logger: TestplanLogger
logger object
- property logname: str
Configured logname.
- property logpath: str
Path for log regex matching.
- make_runpath_dirs() None [source]
Create mandatory directories and install files from given templates using the drivers context before starting the application binary.
- property name: str
Driver name.
- property outpath: str
Path for stdout file regex matching.
- pause()
Pauses entity execution.
- pausing()
Pause the resource.
- pending_work()
Resource has pending work.
- property pid: int | None
Return pid of the child process if available,
None
otherwise.
- post_start()
Steps to be executed right after resource is started.
- pre_start() None
Steps to be executed right before resource starts.
- pre_stop()
Steps to be executed right before resource stops.
- register_failover(klass: Entity, params: dict) None
Register a failover class to instantiate if resource start fails.
- Parameters:
klass – failover class
params – parameters for failover class __init__ method
- property report
A handle to access the report via recursive parent
- property resolved_bin: str
Resolved binary path from self.cfg.binary
- restart(clean: bool = True) None [source]
Stop the driver, archive the app_dir or rename std/log, and then restart the driver.
- Parameters:
clean – if set to
True
, perform a ‘clean’ restart where all persistence is deleted, else a normal restart.
- resume()
Resumes entity execution.
- resuming()
Resume the resource.
- property retcode: int | None
Return return code of the app process or
None
.
- property runpath
Path to be used for temp/output files by entity.
- property scratch
Path to be used for temp files by entity.
- start()
Triggers the start logic of a Resource by executing :py:meth: Resource.starting <testplan.common.entity.base.Resource.starting> method.
- property start_timeout: float
- started_check() bool | FailedAction [source]
Predicate indicating whether a binary in a subprocess has started. Tests whether the return code is zero if the underlying binary has finished execution, otherwise tests if user-specified pattern exists in driver logs.
- property started_check_interval: float | Tuple[float, float]
Driver started check interval. In practice this value is lower-bounded by 0.1 seconds.
- property status
Status object.
- stop()
Triggers the stop logic of a Resource by executing :py:meth: Resource.stopping <testplan.common.entity.base.Resource.stopping> method.
- property stop_timeout: float
- stopped_check() bool | FailedAction [source]
Predicate indicating whether driver has fully stopped.
Default implementation immediately returns True.
- property stopped_check_interval: float | Tuple[float, float]
Driver stopped check interval.
- stopped_check_with_watch(watch) bool | FailedAction [source]
- property timer
- uid() str
Driver uid.
- wait(target_status, timeout=None)
Wait until objects status becomes target status.
- Parameters:
target_status (
str
) – expected statustimeout (
int
orNoneType
) – timeout in seconds
- class testplan.testing.multitest.driver.app.AppConfig(**options)[source]
Bases:
DriverConfig
Configuration object for
App
resource.- classmethod build_schema()
Build a validation schema using the config options defined in this class and its parent classes.
- denormalize()
Create new config object that inherits all explicit attributes from its parents as well.
- get_local(name, default=None)
Returns a local config setting (not from container)
- ignore_extra_keys = False
- property parent
Returns the parent configuration.
- set_local(name, value)
set without any check
- exception testplan.testing.multitest.driver.app.OrphanedProcessException(driver, procs)[source]
Bases:
Exception
Exception raised when there are orphaned processes after stopping the driver.
- add_note(object, /)
Exception.add_note(note) – add a note to the exception
- args
- with_traceback(object, /)
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
testplan.testing.multitest.driver.base module
Driver base class module.
- class testplan.testing.multitest.driver.base.Driver(name: str, install_files: ~typing.List[str | ~typing.Tuple] = None, timeout: int = 300, log_regexps: ~typing.List[~typing.Pattern] = None, stdout_regexps: ~typing.List[~typing.Pattern] = None, stderr_regexps: ~typing.List[~typing.Pattern] = None, file_logger: str = None, async_start: ~testplan.common.config.base.UNSET_T | bool = <testplan.common.config.base.UNSET_T object>, report_errors_from_logs: bool = False, error_logs_max_lines: int = 10, pre_start: ~typing.Callable = None, post_start: ~typing.Callable = None, pre_stop: ~typing.Callable = None, post_stop: ~typing.Callable = None, **options)[source]
Bases:
Resource
Driver base class providing common functionality.
{emphasized_members_docs}
- Parameters:
name – driver name also used as UID
install_files – list of files to be installed
timeout – status check timeout in seconds
log_regexps – regexps to be matched in logfile
stdout_regexps – regexps to be matched in stdout file
stderr_regexps – regexps to be matched in stderr file
file_logger – filepath for driver log, defaults to top level TP log
async_start – whether to allow async start in environment
report_errors_from_logs – whether to log the tail of stdout/stderr/logfile logs upon start/stop exception
error_logs_max_lines – number of lines to be logged from the tail of stdout/stderr/logfile logs if report_errors_from_logs is True
path_cleanup – whether to remove existing runpath elements
pre_start – callable to execute before starting the driver
post_start – callable to execute after the driver is started
pre_stop – callable to execute before stopping the driver
pre_stop – callable to execute after the driver is stopped
Also inherits all
Resource
options.- CONFIG
alias of
DriverConfig
- EXTRACTORS: List[BaseConnectionExtractor] = []
- property async_start: bool
Overrides the default async_start value in config.
- property errpath
Path for stderr file regexp matching.
- extract_values() bool | FailedAction [source]
Extract matching values from input regex configuration options.
- fetch_error_log() List[str] [source]
Fetch error message from the log files of driver, at first we can try self.errpath, if it does not exist, try self.logpath. Typically, several lines from the tail of file will be selected.
- Returns:
text from log file
- get_connections() List[BaseConnectionInfo] [source]
- install_files() None [source]
Installs the files specified in the install_files parameter at the install target.
- property logpath
Path for log regexp matching.
- property name: str
Driver name.
- property outpath
Path for stdout file regexp matching.
- property start_timeout: float
- started_check() bool | FailedAction [source]
Predicate indicating whether driver has fully started.
Default implementation tests whether certain pattern exists in driver loggings, always returns True if no pattern is required.
- property started_check_interval: float | Tuple[float, float]
Driver started check interval. In practice this value is lower-bounded by 0.1 seconds.
- property stop_timeout: float
- stopped_check() bool | FailedAction [source]
Predicate indicating whether driver has fully stopped.
Default implementation immediately returns True.
- property stopped_check_interval: float | Tuple[float, float]
Driver stopped check interval.
- stopped_check_with_watch(watch) bool | FailedAction [source]
testplan.testing.multitest.driver.sqlite module
Small wrapper driver around sqlite3 library.
- class testplan.testing.multitest.driver.sqlite.Sqlite3(name: str, db_path: str, connect_at_start: bool = True, **options)[source]
Bases:
Driver
Basic sqlite3 driver to add to a MultiTest environment, connect to a database and perform sql queries etc.
{emphasized_members_docs}
- Parameters:
db_path (
str
) – Path to the database file to connect to. In case a relative path is provided it will be appended to the runpath.connect_at_start (
bool
) – Connect to the database when driver starts. Default: True
- CONFIG
alias of
Sqlite3Config
- EXTRACTORS: List[BaseConnectionExtractor] = []
- STATUS
alias of
ResourceStatus
- abort()
Default abort policy. First abort all dependencies and then itself.
- abort_dependencies()
Returns an empty generator.
- property aborted
Returns if entity was aborted.
- property active
Entity not aborting/aborted.
- property async_start: bool
Overrides the default async_start value in config.
- property auto_start
If False, the resource will not be automatically started by its parent (generally, a Environment object) while the parent is starting.
- property cfg
Configuration object.
- property context
Key/value pair information of a Resource.
- context_input(exclude: list = None) Dict[str, Any]
All attr of self in a dict for context resolution
- property db_path
Database file path.
- define_runpath()
Define runpath directory based on parent object and configuration.
- property errpath
Path for stderr file regexp matching.
- extract_values() bool | FailedAction
Extract matching values from input regex configuration options.
- failover() None
API to create the failover resource, to be implemented in derived class
- fetch_error_log() List[str]
Fetch error message from the log files of driver, at first we can try self.errpath, if it does not exist, try self.logpath. Typically, several lines from the tail of file will be selected.
- Returns:
text from log file
- fetch_table(table, columns=None)[source]
Fetch a table from the db. The first row will be the column names and the following rows will be the table rows. Returns a table like:
[ ['symbol', 'amount'], ['AAPL', 12], ['GOOG', 21], ['FB', 32], ['AMZN', 5], ['MSFT', 42] ]
- Parameters:
table (
str
) – Table name in the db.columns (
list
ofstr
) – Names of columns to be fetched.
- Returns:
The table contents.
- Return type:
list
oflist
of values.
- classmethod filter_locals(local_vars)
Filter out init params of None value, they will take default value defined in its ConfigOption object; also filter out special vars that are not init params from local_vars.
- Parameters:
local_vars
- force_started()
Change the status to STARTED (e.g. exception raised).
- force_stop()
Change the status to STOPPED (e.g. exception raised).
- get_connections() List[BaseConnectionInfo]
- install_files() None
Installs the files specified in the install_files parameter at the install target.
- property is_alive
Called to periodically poll the resource health. Default implementation assumes the resource is always healthy.
- property logger: TestplanLogger
logger object
- property logpath
Path for log regexp matching.
- make_runpath_dirs()
Creates runpath related directories.
- property name: str
Driver name.
- property outpath
Path for stdout file regexp matching.
- pause()
Pauses entity execution.
- pausing()
Pause the resource.
- pending_work()
Resource has pending work.
- post_start()
Steps to be executed right after resource is started.
- post_stop()
Steps to be executed right after resource is stopped.
- pre_start() None
Steps to be executed right before resource starts.
- pre_stop()
Steps to be executed right before resource stops.
- register_failover(klass: Entity, params: dict) None
Register a failover class to instantiate if resource start fails.
- Parameters:
klass – failover class
params – parameters for failover class __init__ method
- property report
A handle to access the report via recursive parent
- restart()
Stop and start the resource.
- resume()
Resumes entity execution.
- resuming()
Resume the resource.
- property runpath
Path to be used for temp/output files by entity.
- property scratch
Path to be used for temp files by entity.
- start()
Triggers the start logic of a Resource by executing :py:meth: Resource.starting <testplan.common.entity.base.Resource.starting> method.
- property start_timeout: float
- started_check() bool | FailedAction
Predicate indicating whether driver has fully started.
Default implementation tests whether certain pattern exists in driver loggings, always returns True if no pattern is required.
- property started_check_interval: float | Tuple[float, float]
Driver started check interval. In practice this value is lower-bounded by 0.1 seconds.
- property status
Status object.
- stop()
Triggers the stop logic of a Resource by executing :py:meth: Resource.stopping <testplan.common.entity.base.Resource.stopping> method.
- property stop_timeout: float
- stopped_check() bool | FailedAction
Predicate indicating whether driver has fully stopped.
Default implementation immediately returns True.
- property stopped_check_interval: float | Tuple[float, float]
Driver stopped check interval.
- stopped_check_with_watch(watch) bool | FailedAction
- property timer
- uid() str
Driver uid.
- wait(target_status, timeout=None)
Wait until objects status becomes target status.
- Parameters:
target_status (
str
) – expected statustimeout (
int
orNoneType
) – timeout in seconds
- class testplan.testing.multitest.driver.sqlite.Sqlite3Config(**options)[source]
Bases:
DriverConfig
Configuration object for
Sqlite3
resource.- classmethod build_schema()
Build a validation schema using the config options defined in this class and its parent classes.
- denormalize()
Create new config object that inherits all explicit attributes from its parents as well.
- get_local(name, default=None)
Returns a local config setting (not from container)
- ignore_extra_keys = False
- property parent
Returns the parent configuration.
- set_local(name, value)
set without any check
testplan.testing.multitest.driver.kafka module
Driver for Kafka server
- class testplan.testing.multitest.driver.kafka.KafkaStandalone(name: str, cfg_template: str, binary: str = '/opt/kafka/bin/kafka-server-start.sh', host: str | None = None, port: int = 0, **options)[source]
Bases:
App
Driver for starting a Kafka instance in standalone mode.
{emphasized_members_docs}
- Parameters:
cfg_template (
str
) – Kafka config file template.binary (
str
) – kafka-server-start.sh file path.port (
int
) – Kafka listen port.env (
dict
) – Environmental variables to be made available to Zookeeper process.
- CONFIG
alias of
KafkaStandaloneConfig
- property cmd: List[str]
Command that starts the application.
- property host: str
Host to bind to.
- property port: int
Port to listen on.
testplan.testing.multitest.driver.zookeeper module
Driver for Zookeeper server
- class testplan.testing.multitest.driver.zookeeper.ZookeeperStandalone(name: str, cfg_template: str, binary: str = '/usr/share/zookeeper/bin/zkServer.sh', host: str | None = None, port: int = 2181, env: dict | None = None, **options)[source]
Bases:
Driver
Driver for starting a Zookeeper instance in standalone mode.
{emphasized_members_docs}
- Parameters:
template (
str
) – Zookeeper config file template.binary (
str
) – zkServer.sh file path.port (
int
) – Zookeeper listen port. Zookeeper doesn’t support random portenv (
dict
) – Environmental variables to be made available to Zookeeper process.
- CONFIG
alias of
ZookeeperStandaloneConfig
- EXTRACTORS: List[BaseConnectionExtractor] = [<testplan.testing.multitest.driver.connection.connection_extractor.ConnectionExtractor object>]
- property connection_identifier
- property connection_str: str
Connection string.
- property env: Dict[str, str]
Environment variables.
- property host: str
Host to bind to.
- property local_host
- property local_port
- property port: int
Port to listen on.
- class testplan.testing.multitest.driver.zookeeper.ZookeeperStandaloneConfig(**options)[source]
Bases:
DriverConfig
Configuration object for
ZookeeperStandalone
resource.
Module contents
Drivers modules.
This is actually a Testplan level feature, and this subpackage could be moved to testplan.common.driver in the future.
- class testplan.testing.multitest.driver.Driver(name: str, install_files: ~typing.List[str | ~typing.Tuple] = None, timeout: int = 300, log_regexps: ~typing.List[~typing.Pattern] = None, stdout_regexps: ~typing.List[~typing.Pattern] = None, stderr_regexps: ~typing.List[~typing.Pattern] = None, file_logger: str = None, async_start: ~testplan.common.config.base.UNSET_T | bool = <testplan.common.config.base.UNSET_T object>, report_errors_from_logs: bool = False, error_logs_max_lines: int = 10, pre_start: ~typing.Callable = None, post_start: ~typing.Callable = None, pre_stop: ~typing.Callable = None, post_stop: ~typing.Callable = None, **options)[source]
Bases:
Resource
Driver base class providing common functionality.
{emphasized_members_docs}
- Parameters:
name – driver name also used as UID
install_files – list of files to be installed
timeout – status check timeout in seconds
log_regexps – regexps to be matched in logfile
stdout_regexps – regexps to be matched in stdout file
stderr_regexps – regexps to be matched in stderr file
file_logger – filepath for driver log, defaults to top level TP log
async_start – whether to allow async start in environment
report_errors_from_logs – whether to log the tail of stdout/stderr/logfile logs upon start/stop exception
error_logs_max_lines – number of lines to be logged from the tail of stdout/stderr/logfile logs if report_errors_from_logs is True
path_cleanup – whether to remove existing runpath elements
pre_start – callable to execute before starting the driver
post_start – callable to execute after the driver is started
pre_stop – callable to execute before stopping the driver
pre_stop – callable to execute after the driver is stopped
Also inherits all
Resource
options.- CONFIG
alias of
DriverConfig
- EXTRACTORS: List[BaseConnectionExtractor] = []
- property async_start: bool
Overrides the default async_start value in config.
- property errpath
Path for stderr file regexp matching.
- extract_values() bool | FailedAction [source]
Extract matching values from input regex configuration options.
- fetch_error_log() List[str] [source]
Fetch error message from the log files of driver, at first we can try self.errpath, if it does not exist, try self.logpath. Typically, several lines from the tail of file will be selected.
- Returns:
text from log file
- get_connections() List[BaseConnectionInfo] [source]
- install_files() None [source]
Installs the files specified in the install_files parameter at the install target.
- property logpath
Path for log regexp matching.
- property name: str
Driver name.
- property outpath
Path for stdout file regexp matching.
- property start_timeout: float
- started_check() bool | FailedAction [source]
Predicate indicating whether driver has fully started.
Default implementation tests whether certain pattern exists in driver loggings, always returns True if no pattern is required.
- property started_check_interval: float | Tuple[float, float]
Driver started check interval. In practice this value is lower-bounded by 0.1 seconds.
- property stop_timeout: float
- stopped_check() bool | FailedAction [source]
Predicate indicating whether driver has fully stopped.
Default implementation immediately returns True.
- property stopped_check_interval: float | Tuple[float, float]
Driver stopped check interval.
- stopped_check_with_watch(watch) bool | FailedAction [source]