testplan.testing.multitest.driver package
Subpackages
- testplan.testing.multitest.driver.tcp package
- Submodules
- testplan.testing.multitest.driver.tcp.client module
TCPClientTCPClient.CONFIGTCPClient.EXTRACTORSTCPClient.STATUSTCPClient.abort()TCPClient.abort_dependencies()TCPClient.abortedTCPClient.aborting()TCPClient.activeTCPClient.async_startTCPClient.auto_startTCPClient.cfgTCPClient.close()TCPClient.connect()TCPClient.connection_identifierTCPClient.contextTCPClient.context_input()TCPClient.define_runpath()TCPClient.errpathTCPClient.extract_values()TCPClient.failover()TCPClient.fetch_error_log()TCPClient.filter_locals()TCPClient.force_started()TCPClient.force_stop()TCPClient.get_connections()TCPClient.hostTCPClient.install_files()TCPClient.is_aliveTCPClient.local_hostTCPClient.local_portTCPClient.loggerTCPClient.logpathTCPClient.make_runpath_dirs()TCPClient.nameTCPClient.outpathTCPClient.parentTCPClient.pause()TCPClient.pausing()TCPClient.pending_work()TCPClient.portTCPClient.post_start()TCPClient.post_stop()TCPClient.pre_start()TCPClient.pre_stop()TCPClient.receive()TCPClient.receive_text()TCPClient.reconnect()TCPClient.register_failover()TCPClient.reportTCPClient.restart()TCPClient.resume()TCPClient.resuming()TCPClient.runpathTCPClient.scratchTCPClient.send()TCPClient.send_text()TCPClient.send_tsp()TCPClient.server_portTCPClient.start()TCPClient.start_timeoutTCPClient.started_check()TCPClient.started_check_intervalTCPClient.starting()TCPClient.statusTCPClient.stop()TCPClient.stop_timeoutTCPClient.stopped_check()TCPClient.stopped_check_intervalTCPClient.stopped_check_with_watch()TCPClient.stopping()TCPClient.timerTCPClient.uid()TCPClient.wait()
TCPClientConfig
- testplan.testing.multitest.driver.tcp.server module
TCPServerTCPServer.CONFIGTCPServer.EXTRACTORSTCPServer.STATUSTCPServer.abort()TCPServer.abort_dependencies()TCPServer.abortedTCPServer.aborting()TCPServer.accept_connection()TCPServer.activeTCPServer.async_startTCPServer.auto_startTCPServer.cfgTCPServer.close_connection()TCPServer.connection_identifierTCPServer.contextTCPServer.context_input()TCPServer.define_runpath()TCPServer.errpathTCPServer.extract_values()TCPServer.failover()TCPServer.fetch_error_log()TCPServer.filter_locals()TCPServer.force_started()TCPServer.force_stop()TCPServer.get_connections()TCPServer.hostTCPServer.install_files()TCPServer.is_aliveTCPServer.local_hostTCPServer.local_portTCPServer.loggerTCPServer.logpathTCPServer.make_runpath_dirs()TCPServer.nameTCPServer.outpathTCPServer.parentTCPServer.pause()TCPServer.pausing()TCPServer.pending_work()TCPServer.portTCPServer.post_start()TCPServer.post_stop()TCPServer.pre_start()TCPServer.pre_stop()TCPServer.receive()TCPServer.receive_text()TCPServer.register_failover()TCPServer.reportTCPServer.restart()TCPServer.resume()TCPServer.resuming()TCPServer.runpathTCPServer.scratchTCPServer.send()TCPServer.send_text()TCPServer.socketTCPServer.start()TCPServer.start_timeoutTCPServer.started_check()TCPServer.started_check_intervalTCPServer.starting()TCPServer.statusTCPServer.stop()TCPServer.stop_timeoutTCPServer.stopped_check()TCPServer.stopped_check_intervalTCPServer.stopped_check_with_watch()TCPServer.stopping()TCPServer.timerTCPServer.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
ZMQClientZMQClient.CONFIGZMQClient.EXTRACTORSZMQClient.STATUSZMQClient.abort()ZMQClient.abort_dependencies()ZMQClient.abortedZMQClient.aborting()ZMQClient.activeZMQClient.async_startZMQClient.auto_startZMQClient.cfgZMQClient.connect()ZMQClient.contextZMQClient.context_input()ZMQClient.define_runpath()ZMQClient.disconnect()ZMQClient.errpathZMQClient.extract_values()ZMQClient.failover()ZMQClient.fetch_error_log()ZMQClient.filter_locals()ZMQClient.flush()ZMQClient.force_started()ZMQClient.force_stop()ZMQClient.get_connections()ZMQClient.hostsZMQClient.install_files()ZMQClient.is_aliveZMQClient.loggerZMQClient.logpathZMQClient.make_runpath_dirs()ZMQClient.nameZMQClient.outpathZMQClient.parentZMQClient.pause()ZMQClient.pausing()ZMQClient.pending_work()ZMQClient.portsZMQClient.post_start()ZMQClient.post_stop()ZMQClient.pre_start()ZMQClient.pre_stop()ZMQClient.receive()ZMQClient.reconnect()ZMQClient.register_failover()ZMQClient.reportZMQClient.restart()ZMQClient.resume()ZMQClient.resuming()ZMQClient.runpathZMQClient.scratchZMQClient.send()ZMQClient.start()ZMQClient.start_timeoutZMQClient.started_check()ZMQClient.started_check_intervalZMQClient.starting()ZMQClient.statusZMQClient.stop()ZMQClient.stop_timeoutZMQClient.stopped_check()ZMQClient.stopped_check_intervalZMQClient.stopped_check_with_watch()ZMQClient.stopping()ZMQClient.subscribe()ZMQClient.timerZMQClient.uid()ZMQClient.unsubscribe()ZMQClient.wait()
ZMQClientConfig
- testplan.testing.multitest.driver.zmq.server module
ZMQServerZMQServer.CONFIGZMQServer.EXTRACTORSZMQServer.STATUSZMQServer.abort()ZMQServer.abort_dependencies()ZMQServer.abortedZMQServer.aborting()ZMQServer.activeZMQServer.async_startZMQServer.auto_startZMQServer.cfgZMQServer.connection_identifierZMQServer.contextZMQServer.context_input()ZMQServer.define_runpath()ZMQServer.errpathZMQServer.extract_values()ZMQServer.failover()ZMQServer.fetch_error_log()ZMQServer.filter_locals()ZMQServer.force_started()ZMQServer.force_stop()ZMQServer.get_connections()ZMQServer.hostZMQServer.install_files()ZMQServer.is_aliveZMQServer.local_hostZMQServer.local_portZMQServer.loggerZMQServer.logpathZMQServer.make_runpath_dirs()ZMQServer.nameZMQServer.outpathZMQServer.parentZMQServer.pause()ZMQServer.pausing()ZMQServer.pending_work()ZMQServer.portZMQServer.post_start()ZMQServer.post_stop()ZMQServer.pre_start()ZMQServer.pre_stop()ZMQServer.receive()ZMQServer.register_failover()ZMQServer.reportZMQServer.restart()ZMQServer.resume()ZMQServer.resuming()ZMQServer.runpathZMQServer.scratchZMQServer.send()ZMQServer.socketZMQServer.start()ZMQServer.start_timeoutZMQServer.started_check()ZMQServer.started_check_intervalZMQServer.starting()ZMQServer.statusZMQServer.stop()ZMQServer.stop_timeoutZMQServer.stopped_check()ZMQServer.stopped_check_intervalZMQServer.stopped_check_with_watch()ZMQServer.stopping()ZMQServer.timerZMQServer.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
FixClientFixClient.CONFIGFixClient.EXTRACTORSFixClient.STATUSFixClient.abort()FixClient.abort_dependencies()FixClient.abortedFixClient.aborting()FixClient.activeFixClient.async_startFixClient.auto_startFixClient.cfgFixClient.connect()FixClient.connection_identifierFixClient.contextFixClient.context_input()FixClient.define_runpath()FixClient.errpathFixClient.extract_values()FixClient.failover()FixClient.fetch_error_log()FixClient.filter_locals()FixClient.flush()FixClient.force_started()FixClient.force_stop()FixClient.get_connections()FixClient.hostFixClient.install_files()FixClient.is_aliveFixClient.local_hostFixClient.local_portFixClient.loggerFixClient.logoff()FixClient.logon()FixClient.logpathFixClient.make_runpath_dirs()FixClient.nameFixClient.outpathFixClient.parentFixClient.pause()FixClient.pausing()FixClient.pending_work()FixClient.portFixClient.post_start()FixClient.post_stop()FixClient.pre_start()FixClient.pre_stop()FixClient.receive()FixClient.reconnect()FixClient.register_failover()FixClient.reportFixClient.restart()FixClient.resume()FixClient.resuming()FixClient.runpathFixClient.scratchFixClient.send()FixClient.send_tsp()FixClient.senderFixClient.sendersubFixClient.start()FixClient.start_timeoutFixClient.started_check()FixClient.started_check_intervalFixClient.starting()FixClient.statusFixClient.stop()FixClient.stop_timeoutFixClient.stopped_check()FixClient.stopped_check_intervalFixClient.stopped_check_with_watch()FixClient.stopping()FixClient.targetFixClient.timerFixClient.uid()FixClient.wait()
FixClientConfig
- testplan.testing.multitest.driver.fix.server module
FixServerFixServer.CONFIGFixServer.EXTRACTORSFixServer.STATUSFixServer.abort()FixServer.abort_dependencies()FixServer.abortedFixServer.aborting()FixServer.activeFixServer.active_connections()FixServer.async_startFixServer.auto_startFixServer.cfgFixServer.connection_identifierFixServer.contextFixServer.context_input()FixServer.define_runpath()FixServer.errpathFixServer.extract_values()FixServer.failover()FixServer.fetch_error_log()FixServer.filter_locals()FixServer.flush()FixServer.force_started()FixServer.force_stop()FixServer.get_connections()FixServer.hostFixServer.install_files()FixServer.is_aliveFixServer.is_connection_active()FixServer.local_hostFixServer.local_portFixServer.loggerFixServer.logpathFixServer.make_runpath_dirs()FixServer.nameFixServer.outpathFixServer.parentFixServer.pause()FixServer.pausing()FixServer.pending_work()FixServer.portFixServer.post_start()FixServer.post_stop()FixServer.pre_start()FixServer.pre_stop()FixServer.receive()FixServer.register_failover()FixServer.reportFixServer.restart()FixServer.resume()FixServer.resuming()FixServer.runpathFixServer.scratchFixServer.send()FixServer.start()FixServer.start_timeoutFixServer.started_check()FixServer.started_check_intervalFixServer.starting()FixServer.statusFixServer.stop()FixServer.stop_timeoutFixServer.stopped_check()FixServer.stopped_check_intervalFixServer.stopped_check_with_watch()FixServer.stopping()FixServer.timerFixServer.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
HTTPClientHTTPClient.CONFIGHTTPClient.EXTRACTORSHTTPClient.STATUSHTTPClient.abort()HTTPClient.abort_dependencies()HTTPClient.abortedHTTPClient.aborting()HTTPClient.activeHTTPClient.async_startHTTPClient.auto_startHTTPClient.cfgHTTPClient.connection_identifierHTTPClient.contextHTTPClient.context_input()HTTPClient.define_runpath()HTTPClient.delete()HTTPClient.errpathHTTPClient.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.hostHTTPClient.install_files()HTTPClient.is_aliveHTTPClient.loggerHTTPClient.logpathHTTPClient.make_runpath_dirs()HTTPClient.nameHTTPClient.options()HTTPClient.outpathHTTPClient.parentHTTPClient.patch()HTTPClient.pause()HTTPClient.pausing()HTTPClient.pending_work()HTTPClient.portHTTPClient.post()HTTPClient.post_start()HTTPClient.post_stop()HTTPClient.pre_start()HTTPClient.pre_stop()HTTPClient.put()HTTPClient.receive()HTTPClient.register_failover()HTTPClient.reportHTTPClient.restart()HTTPClient.resume()HTTPClient.resuming()HTTPClient.runpathHTTPClient.scratchHTTPClient.send()HTTPClient.start()HTTPClient.start_timeoutHTTPClient.started_check()HTTPClient.started_check_intervalHTTPClient.starting()HTTPClient.statusHTTPClient.stop()HTTPClient.stop_timeoutHTTPClient.stopped_check()HTTPClient.stopped_check_intervalHTTPClient.stopped_check_with_watch()HTTPClient.stopping()HTTPClient.timerHTTPClient.uid()HTTPClient.wait()
HTTPClientConfig
- testplan.testing.multitest.driver.http.server module
HTTPRequestHandlerHTTPRequestHandler.MessageClassHTTPRequestHandler.address_string()HTTPRequestHandler.date_time_string()HTTPRequestHandler.default_request_versionHTTPRequestHandler.disable_nagle_algorithmHTTPRequestHandler.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_typeHTTPRequestHandler.error_message_formatHTTPRequestHandler.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.monthnameHTTPRequestHandler.parse_request()HTTPRequestHandler.protocol_versionHTTPRequestHandler.rbufsizeHTTPRequestHandler.responsesHTTPRequestHandler.send_error()HTTPRequestHandler.send_header()HTTPRequestHandler.send_response()HTTPRequestHandler.send_response_only()HTTPRequestHandler.server_versionHTTPRequestHandler.setup()HTTPRequestHandler.sys_versionHTTPRequestHandler.timeoutHTTPRequestHandler.version_string()HTTPRequestHandler.wbufsizeHTTPRequestHandler.weekdayname
HTTPResponseHTTPServerHTTPServer.CONFIGHTTPServer.EXTRACTORSHTTPServer.STATUSHTTPServer.abort()HTTPServer.abort_dependencies()HTTPServer.abortedHTTPServer.aborting()HTTPServer.activeHTTPServer.async_startHTTPServer.auto_startHTTPServer.cfgHTTPServer.connection_identifierHTTPServer.contextHTTPServer.context_input()HTTPServer.define_runpath()HTTPServer.errpathHTTPServer.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.hostHTTPServer.install_files()HTTPServer.is_aliveHTTPServer.local_hostHTTPServer.local_portHTTPServer.loggerHTTPServer.logpathHTTPServer.make_runpath_dirs()HTTPServer.nameHTTPServer.outpathHTTPServer.parentHTTPServer.pause()HTTPServer.pausing()HTTPServer.pending_work()HTTPServer.portHTTPServer.post_start()HTTPServer.post_stop()HTTPServer.pre_start()HTTPServer.pre_stop()HTTPServer.queue_response()HTTPServer.receive()HTTPServer.register_failover()HTTPServer.reportHTTPServer.respond()HTTPServer.restart()HTTPServer.resume()HTTPServer.resuming()HTTPServer.runpathHTTPServer.scratchHTTPServer.start()HTTPServer.start_timeoutHTTPServer.started_check()HTTPServer.started_check_intervalHTTPServer.starting()HTTPServer.statusHTTPServer.stop()HTTPServer.stop_timeoutHTTPServer.stopped_check()HTTPServer.stopped_check_intervalHTTPServer.stopped_check_with_watch()HTTPServer.stopping()HTTPServer.timerHTTPServer.uid()HTTPServer.wait()
HTTPServerConfigReceivedRequest
- 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:
DriverBinary 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
ContextValueand will be expanded on runtime.args – Arguments to be appended to binary command. An argument can be a
ContextValueand 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
Driveroptions.- 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,
Noneotherwise.
- 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 (
intorNoneType) – timeout in seconds
- class testplan.testing.multitest.driver.app.AppConfig(**options)[source]
Bases:
DriverConfigConfiguration object for
Appresource.- 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:
ExceptionException 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:
ResourceDriver 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
Resourceoptions.- 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:
DriverBasic 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 (
listofstr) – Names of columns to be fetched.
- Returns:
The table contents.
- Return type:
listoflistof 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 (
intorNoneType) – timeout in seconds
- class testplan.testing.multitest.driver.sqlite.Sqlite3Config(**options)[source]
Bases:
DriverConfigConfiguration object for
Sqlite3resource.- 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:
AppDriver 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:
DriverDriver 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:
DriverConfigConfiguration object for
ZookeeperStandaloneresource.
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:
ResourceDriver 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
Resourceoptions.- 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]