tmt.steps package
Subpackages
- tmt.steps.discover package
- Submodules
- tmt.steps.discover.fmf module
DiscoverFmf
DiscoverFmfStepData
DiscoverFmfStepData.adjust_tests
DiscoverFmfStepData.dist_git_extract
DiscoverFmfStepData.dist_git_init
DiscoverFmfStepData.dist_git_merge
DiscoverFmfStepData.dist_git_remove_fmf_root
DiscoverFmfStepData.exclude
DiscoverFmfStepData.filter
DiscoverFmfStepData.fmf_id
DiscoverFmfStepData.link
DiscoverFmfStepData.modified_only
DiscoverFmfStepData.modified_ref
DiscoverFmfStepData.modified_url
DiscoverFmfStepData.path
DiscoverFmfStepData.post_normalization()
DiscoverFmfStepData.prune
DiscoverFmfStepData.ref
DiscoverFmfStepData.repository
DiscoverFmfStepData.revision
DiscoverFmfStepData.sync_repo
DiscoverFmfStepData.test
DiscoverFmfStepData.upgrade_path
DiscoverFmfStepData.url
normalize_ref()
- tmt.steps.discover.shell module
DiscoverShell
DiscoverShellData
TestDescription
TestDescription.adjust
TestDescription.author
TestDescription.check
TestDescription.component
TestDescription.contact
TestDescription.description
TestDescription.duration
TestDescription.enabled
TestDescription.environment
TestDescription.framework
TestDescription.from_spec()
TestDescription.id
TestDescription.link
TestDescription.manual
TestDescription.name
TestDescription.order
TestDescription.path
TestDescription.recommend
TestDescription.require
TestDescription.result
TestDescription.summary
TestDescription.tag
TestDescription.test
TestDescription.tier
TestDescription.to_spec()
TestDescription.tty
- Module contents
- tmt.steps.execute package
- Submodules
- tmt.steps.execute.internal module
- tmt.steps.execute.upgrade module
- Module contents
AbortExecute
DEFAULT_SCRIPTS_DEST_DIR
DEFAULT_SCRIPTS_DEST_DIR_OSTREE
Execute
ExecutePlugin
ExecutePlugin.base_command()
ExecutePlugin.cli_invocation
ExecutePlugin.discover
ExecutePlugin.discover_phase
ExecutePlugin.extract_custom_results()
ExecutePlugin.extract_results()
ExecutePlugin.extract_tmt_report_results()
ExecutePlugin.extract_tmt_report_results_restraint()
ExecutePlugin.go()
ExecutePlugin.how
ExecutePlugin.prepare_scripts()
ExecutePlugin.prepare_tests()
ExecutePlugin.results()
ExecutePlugin.run_checks_after_test()
ExecutePlugin.run_checks_before_test()
ExecutePlugin.scripts
ExecutePlugin.timeout_hint()
ExecuteStepData
ResultCollection
SCRIPTS_DEST_DIR_VARIABLE
SCRIPTS_SRC_DIR
Script
ScriptCreatingFile
ScriptTemplate
TestInvocation
TestInvocation.abort_request_path
TestInvocation.abort_requested
TestInvocation.check_data
TestInvocation.check_files_path
TestInvocation.check_results
TestInvocation.end_time
TestInvocation.guest
TestInvocation.handle_reboot()
TestInvocation.handle_restart()
TestInvocation.hard_reboot_requested
TestInvocation.is_guest_healthy
TestInvocation.logger
TestInvocation.path
TestInvocation.phase
TestInvocation.process
TestInvocation.process_lock
TestInvocation.real_duration
TestInvocation.reboot_request_path
TestInvocation.reboot_requested
TestInvocation.relative_path
TestInvocation.relative_test_data_path
TestInvocation.restart_requested
TestInvocation.results
TestInvocation.return_code
TestInvocation.soft_reboot_requested
TestInvocation.start_time
TestInvocation.terminate_process()
TestInvocation.test
TestInvocation.test_data_path
effective_scripts_dest_dir()
- tmt.steps.finish package
- tmt.steps.prepare package
- Subpackages
- Submodules
- tmt.steps.prepare.ansible module
- tmt.steps.prepare.distgit module
- tmt.steps.prepare.install module
Copr
InstallApk
InstallApt
InstallBase
InstallBase.cli_invocation
InstallBase.debuginfo_packages
InstallBase.exclude
InstallBase.guest
InstallBase.install()
InstallBase.install_debuginfo()
InstallBase.install_from_repository()
InstallBase.install_from_url()
InstallBase.install_local()
InstallBase.list_installables()
InstallBase.local_packages
InstallBase.package_directory
InstallBase.packages
InstallBase.prepare_install_local()
InstallBase.prepare_installables()
InstallBase.prepare_repository()
InstallBase.remote_packages
InstallBase.rpm_check()
InstallBase.skip_missing
InstallBootc
InstallDnf
InstallDnf5
InstallRpmOstree
InstallRpmOstree.cli_invocation
InstallRpmOstree.copr_plugin
InstallRpmOstree.enable_copr()
InstallRpmOstree.install_debuginfo()
InstallRpmOstree.install_from_repository()
InstallRpmOstree.install_local()
InstallRpmOstree.recommended_packages
InstallRpmOstree.required_packages
InstallRpmOstree.sort_packages()
InstallYum
PrepareInstall
PrepareInstallData
- tmt.steps.prepare.shell module
- Module contents
- tmt.steps.provision package
- Submodules
- tmt.steps.provision.artemis module
- tmt.steps.provision.bootc module
- tmt.steps.provision.connect module
- tmt.steps.provision.local module
- tmt.steps.provision.mrack module
BEAKER
BeakerAPI
BeakerGuestData
BeakerGuestData.api_session_refresh_tick
BeakerGuestData.arch
BeakerGuestData.beaker_job_group
BeakerGuestData.beaker_job_owner
BeakerGuestData.image
BeakerGuestData.job_id
BeakerGuestData.kickstart
BeakerGuestData.provision_tick
BeakerGuestData.provision_timeout
BeakerGuestData.public_key
BeakerGuestData.user
BeakerGuestData.whiteboard
BeakerProvider
BeakerTransformer
CreateJobParameters
CreateJobParameters.arch
CreateJobParameters.beaker_job_owner
CreateJobParameters.group
CreateJobParameters.hardware
CreateJobParameters.kickstart
CreateJobParameters.name
CreateJobParameters.os
CreateJobParameters.public_key
CreateJobParameters.tmt_name
CreateJobParameters.to_mrack()
CreateJobParameters.whiteboard
DEFAULT_API_SESSION_REFRESH
GuestBeaker
GuestBeaker.api
GuestBeaker.api_session_refresh_tick
GuestBeaker.arch
GuestBeaker.beaker_job_group
GuestBeaker.beaker_job_owner
GuestBeaker.cli_invocation
GuestBeaker.hardware
GuestBeaker.image
GuestBeaker.is_ready
GuestBeaker.job_id
GuestBeaker.kickstart
GuestBeaker.provision_tick
GuestBeaker.provision_timeout
GuestBeaker.public_key
GuestBeaker.reboot()
GuestBeaker.remove()
GuestBeaker.start()
GuestBeaker.whiteboard
GuestInspectType
GuestLogBeaker
MrackBaseHWElement
MrackHWAndGroup
MrackHWBinOp
MrackHWElement
MrackHWGroup
MrackHWKeyValue
MrackHWNotGroup
MrackHWOrGroup
NotAuthenticatedError
ProvisionBeaker
ProvisionBeakerData
ProvisioningError
TmtBeakerTransformer
async_run()
constraint_to_beaker_filter()
import_and_load_mrack_deps()
mrack
mrack_constructs_ks_pre()
operator_to_beaker_op()
providers
- tmt.steps.provision.podman module
GuestContainer
GuestContainer.cli_invocation
GuestContainer.container
GuestContainer.execute()
GuestContainer.force_pull
GuestContainer.image
GuestContainer.is_ready
GuestContainer.logger
GuestContainer.podman()
GuestContainer.pull()
GuestContainer.pull_attempts
GuestContainer.pull_image()
GuestContainer.pull_interval
GuestContainer.push()
GuestContainer.reboot()
GuestContainer.remove()
GuestContainer.start()
GuestContainer.stop()
GuestContainer.stop_time
GuestContainer.user
GuestContainer.wake()
PodmanGuestData
ProvisionPodman
ProvisionPodmanData
- tmt.steps.provision.testcloud module
AArch64ArchitectureConfiguration
BOOT_TIMEOUT
CONNECT_TIMEOUT
DEFAULT_BOOT_TIMEOUT
DEFAULT_CONNECT_TIMEOUT
DomainConfiguration
GuestTestcloud
GuestTestcloud.arch
GuestTestcloud.cli_invocation
GuestTestcloud.connection
GuestTestcloud.disk
GuestTestcloud.image
GuestTestcloud.image_url
GuestTestcloud.instance_name
GuestTestcloud.is_coreos
GuestTestcloud.is_kvm
GuestTestcloud.is_legacy_os
GuestTestcloud.is_ready
GuestTestcloud.memory
GuestTestcloud.prepare_config()
GuestTestcloud.prepare_ssh_key()
GuestTestcloud.reboot()
GuestTestcloud.remove()
GuestTestcloud.start()
GuestTestcloud.stop()
GuestTestcloud.wake()
NON_KVM_TIMEOUT_COEF
Ppc64leArchitectureConfiguration
ProvisionTestcloud
ProvisionTestcloudData
QCow2StorageDevice
RawStorageDevice
S390xArchitectureConfiguration
SystemNetworkConfiguration
TPMConfiguration
TPM_CONFIG_ALLOWS_VERSIONS
TPM_VERSION_ALLOWED_OPERATORS
TPM_VERSION_SUPPORTED_VERSIONS
TestcloudGuestData
UserNetworkConfiguration
Workarounds
X86_64ArchitectureConfiguration
import_testcloud()
normalize_disk_size()
normalize_memory_size()
- Module contents
BASE_SSH_OPTIONS
CheckRsyncOutcome
DEFAULT_REBOOT_TIMEOUT
DEFAULT_SSH_OPTIONS
Guest
Guest.ansible()
Guest.become
Guest.cli_invocation
Guest.essential_requires()
Guest.execute()
Guest.facts
Guest.fetch_logs()
Guest.get_data_class()
Guest.hardware
Guest.is_ready
Guest.load()
Guest.localhost
Guest.logdir
Guest.mkdtemp()
Guest.multihost_name
Guest.options()
Guest.package_manager
Guest.primary_address
Guest.pull()
Guest.push()
Guest.reboot()
Guest.reconnect()
Guest.remove()
Guest.role
Guest.save()
Guest.scripts_path
Guest.setup()
Guest.show()
Guest.start()
Guest.stop()
Guest.topology_address
Guest.wake()
GuestCapability
GuestData
GuestFacts
GuestFacts.arch
GuestFacts.capabilities
GuestFacts.distro
GuestFacts.format()
GuestFacts.has_capability()
GuestFacts.has_selinux
GuestFacts.has_systemd
GuestFacts.in_sync
GuestFacts.is_container
GuestFacts.is_ostree
GuestFacts.is_superuser
GuestFacts.is_toolbox
GuestFacts.kernel_release
GuestFacts.lsb_release_content
GuestFacts.os_release_content
GuestFacts.package_manager
GuestFacts.sync()
GuestFacts.toolbox_container_name
GuestLog
GuestSsh
GuestSsh.cli_invocation
GuestSsh.execute()
GuestSsh.is_ready
GuestSsh.is_ssh_multiplexing_enabled
GuestSsh.key
GuestSsh.password
GuestSsh.perform_reboot()
GuestSsh.port
GuestSsh.pull()
GuestSsh.push()
GuestSsh.reboot()
GuestSsh.remove()
GuestSsh.setup()
GuestSsh.ssh_option
GuestSsh.stop()
GuestSsh.user
GuestSshData
Provision
ProvisionPlugin
ProvisionQueue
ProvisionStepData
ProvisionTask
REBOOT_TIMEOUT
RebootModeNotSupportedError
SSH_MASTER_SOCKET_LENGTH_LIMIT
SSH_MASTER_SOCKET_MAX_HASH_LENGTH
SSH_MASTER_SOCKET_MIN_HASH_LENGTH
STAT_BTIME_PATTERN
configure_ssh_options()
essential_ansible_requires()
format_guest_full_name()
normalize_hardware()
- tmt.steps.report package
- Submodules
- tmt.steps.report.display module
- tmt.steps.report.html module
- tmt.steps.report.junit module
- tmt.steps.report.polarion module
ReportPolarion
ReportPolarionData
ReportPolarionData.arch
ReportPolarionData.assignee
ReportPolarionData.build
ReportPolarionData.compose_id
ReportPolarionData.description
ReportPolarionData.file
ReportPolarionData.fips
ReportPolarionData.include_output_log
ReportPolarionData.logs
ReportPolarionData.planned_in
ReportPolarionData.platform
ReportPolarionData.pool_team
ReportPolarionData.prettify
ReportPolarionData.project_id
ReportPolarionData.sample_image
ReportPolarionData.template
ReportPolarionData.title
ReportPolarionData.upload
ReportPolarionData.use_facts
- tmt.steps.report.reportportal module
LogFilterSettings
ReportReportPortal
ReportReportPortal.TMT_TO_RP_RESULT_STATUS
ReportReportPortal.append_description()
ReportReportPortal.append_link_template()
ReportReportPortal.check_options()
ReportReportPortal.cli_invocation
ReportReportPortal.construct_launch_attributes()
ReportReportPortal.datetime
ReportReportPortal.execute_rp_import()
ReportReportPortal.get_defect_type_locator()
ReportReportPortal.go()
ReportReportPortal.handle_response()
ReportReportPortal.headers
ReportReportPortal.rp_api_get()
ReportReportPortal.rp_api_post()
ReportReportPortal.rp_api_put()
ReportReportPortal.upload_result_logs()
ReportReportPortal.url
ReportReportPortalData
ReportReportPortalData.api_version
ReportReportPortalData.artifacts_url
ReportReportPortalData.defect_type
ReportReportPortalData.exclude_variables
ReportReportPortalData.launch
ReportReportPortalData.launch_description
ReportReportPortalData.launch_per_plan
ReportReportPortalData.launch_rerun
ReportReportPortalData.launch_url
ReportReportPortalData.launch_uuid
ReportReportPortalData.link_template
ReportReportPortalData.log_size_limit
ReportReportPortalData.project
ReportReportPortalData.ssl_verify
ReportReportPortalData.suite_per_plan
ReportReportPortalData.suite_uuid
ReportReportPortalData.test_uuids
ReportReportPortalData.token
ReportReportPortalData.traceback_size_limit
ReportReportPortalData.upload_subresults
ReportReportPortalData.upload_to_launch
ReportReportPortalData.upload_to_suite
ReportReportPortalData.url
- Module contents
Module contents
Step Classes
- class tmt.steps.Action(*, order: int = 50, **kwargs: Any)
Bases:
Phase
,MultiInvokableCommon
A special action performed during a normal step.
Initialize name and relation with the parent object
Prepare the workdir for provided id / directory path or generate a new workdir name if workdir=True given. Store command line context and options for future use if context is provided.
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- cli_invocations: list['tmt.cli.CliInvocation'] = []
- go() None
- class tmt.steps.ActionTask(logger: Logger, phase: Action, **kwargs: Any)
Bases:
GuestlessTask
[None
]A task to run an action
- property name: str
A name of this task.
Left for child classes to implement, because the name depends on the actual task.
- class tmt.steps.BasePlugin(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
Phase
,Generic
[StepDataT
,PluginReturnValueT
]Common parent of all step plugins
Store plugin name, data and parent step
- classmethod base_command(usage: str, method_class: type[Command] | None = None) Command
Create base click command (common for all step plugins)
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- classmethod command() Command
Prepare click command for all supported methods
- data: StepDataT
- default(option: str, default: Any | None = None) Any
Return default data for given option
- classmethod delegate(step: Step, data: StepDataT | None = None, raw_data: _RawStepData | None = None) BasePlugin[StepDataT, PluginReturnValueT]
Return plugin instance implementing the data[‘how’] method
Supports searching by method prefix as well (e.g. ‘virtual’). The first matching method with the lowest ‘order’ wins.
- property enabled_by_when: bool
Check if the plugin is enabled by ‘when’ keyword
- essential_requires() list[DependencySimple | DependencyFmfId | DependencyFile]
Collect all essential requirements of the plugin.
Essential requirements of a plugin are necessary for the plugin to perform its basic functionality.
- Returns:
a list of requirements.
- get(option: str, default: Any | None = None) Any
Get option from plugin data, user/system config or defaults
- classmethod get_data_class() type[StepDataT]
Return step data class for this plugin.
By default,
_data_class
is returned, but plugin may override this method to provide different class.
- classmethod get_step_name() str
- how: str = 'shell'
- classmethod options(how: str | None = None) list[Callable[[Any], Any]]
Prepare command line options for given method
- prune(logger: Logger) None
Prune uninteresting files from the plugin workdir
By default we remove the whole workdir. Individual plugins can override this method to keep files and directories which are useful for inspection when the run is finished.
- property safe_name: str
A safe variant of the name which does not contain special characters.
Override parent implementation as we do not allow phase names to contain slash characters,
/
.
- show(keys: list[str] | None = None) None
Show plugin details for given or all available keys
- wake() None
Wake up the plugin, process data, apply options
Check command line options corresponding to plugin keys and store their value into the ‘self.data’ dictionary if their value is True or non-empty.
By default, all supported options corresponding to common and plugin-specific keys are processed. List of key names in the ‘keys’ parameter can be used to override only selected ones.
- tmt.steps.DEFAULT_REBOOT_COMMAND = <tmt.utils.ShellScript object>
A default command to trigger a guest reboot when executed remotely.
- class tmt.steps.DefaultNameGenerator(known_names: list[str])
Bases:
object
Generator of names for that do not have any.
If user did not set any
name
for one or more phases, tmt will assign them a “dummy” namedefault-N
. This class wraps the generator.Generator of names for that do not have any.
- Parameters:
known_names – already existing names the generator needs to avoid.
- classmethod from_raw_phases(raw_data: Iterable[_RawStepData]) DefaultNameGenerator
Create a generator based on available phase specifications.
A special constructor that extracts
known_names
fromraw_data
.- Parameters:
raw_data – phase specifications as collected from fmf nodes and CLI options.
- get() str
- restart() None
Reset the generator and start from the beginning again
- class tmt.steps.GuestTopology(guest: Guest)
Bases:
SerializableContainer
Describes a guest in the topology of provisioned tmt guests
- hostname: str | None
- name: str
- role: str | None
- class tmt.steps.GuestlessPlugin(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
BasePlugin
[StepDataT
,PluginReturnValueT
]Common parent of all step plugins that do not work against a particular guest
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- go(*, logger: Logger | None = None) PluginReturnValueT
Perform actions shared among plugins when beginning their tasks
- class tmt.steps.Login(*, step: Step, order: int, logger: Logger)
Bases:
Action
Log into the guest
Initialize relations, store the login order
- after_test(result: Result, cwd: Path | None = None, env: Environment | None = None) None
Check and login after test execution
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- cli_invocations: list['tmt.cli.CliInvocation'] = []
- classmethod command(method_class: Method | None = None, usage: str | None = None) Command
Create the login command
- go(force: bool = False) None
Login to the guest(s)
- class tmt.steps.Method(name: str, class_: type[BasePlugin], doc: str | None = None, order: int = 50, installation_hint: str | None = None)
Bases:
object
Step implementation method
Store method data
- describe() str
Format name and summary for a nice method overview
- usage() str
Prepare a detailed usage from summary and description
- tmt.steps.PHASE_ORDER_PREPARE_INSTALL_ESSENTIAL_REQUIRES = 30
Installation of essential plugin and check requirements.
- tmt.steps.PHASE_ORDER_PREPARE_INSTALL_RECOMMENDS = 75
Installation of packages recommended by tests.
- class tmt.steps.Phase(*, order: int = 50, **kwargs: Any)
Bases:
Common
A phase of a step
Initialize name and relation with the parent object
Prepare the workdir for provided id / directory path or generate a new workdir name if workdir=True given. Store command line context and options for future use if context is provided.
- assert_feeling_safe(deprecated_in_version: str, subject: str) None
Raises a tmt.utils.ProvisionError if feeling-safe is required, but not set. Warns when feeling-safe will be required in a future version. :param deprecated_in_version: Version from which feeling-safe is required, e.g. ‘1.38’. :param subject: Subject requiring feeling-safe, e.g. ‘Local provision plugin’.
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- property enabled_by_when: bool
- property is_in_standalone_mode: bool
True if the phase is in stand-alone mode.
Stand-alone mode means that only this phase should be run as a part of the run (and not any other even if requested using –all). This is useful as some plugin options may completely change its behaviour from the regular behaviour based on options (e.g. listing images inside a provision plugin).
- class tmt.steps.PhaseQueue(name: str, logger: Logger)
Bases:
Queue
[ActionTask
|PluginTask
[StepDataT
,PluginReturnValueT
]]Queue class for running phases on guests
- enqueue_plugin(*, phase: Plugin[StepDataT, PluginReturnValueT], guests: list[Guest]) None
- class tmt.steps.Plugin(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
BasePlugin
[StepDataT
,PluginReturnValueT
]Common parent of all step plugins that do work against a particular guest
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- go(*, guest: Guest, environment: Environment | None = None, logger: Logger) PluginReturnValueT
Perform actions shared among plugins when beginning their tasks
- class tmt.steps.PluginReturnValueT
A type variable representing a return value of plugin’s
go()
method.alias of TypeVar(‘PluginReturnValueT’)
- class tmt.steps.PluginTask(logger: Logger, guests: list[Guest], phase: Plugin[StepDataT, PluginReturnValueT], **kwargs: Any)
Bases:
MultiGuestTask
[PluginReturnValueT
],Generic
[StepDataT
,PluginReturnValueT
]A task to run a phase on a given set of guests
- property name: str
A name of this task.
Left for child classes to implement, because the name depends on the actual task.
- phase: Plugin[StepDataT, PluginReturnValueT]
- property phase_name: str
- run_on_guest(guest: Guest, logger: Logger) None
Perform the task.
Called from
go()
once for every guest to run on. Subclasses ofGuestlessTask
should implement their logic in this method rather than ingo()
which is already provided. If your task requires different handling ingo
, it might be better derived directly fromTask
.
- class tmt.steps.PullTask(logger: Logger, guests: list[Guest], source: Path | None = None, **kwargs: Any)
Bases:
MultiGuestTask
[None
]Task performing a workdir pull from a guest
- property name: str
A name of this task.
Left for child classes to implement, because the name depends on the actual task.
- run_on_guest(guest: Guest, logger: Logger) None
Perform the task.
Called from
go()
once for every guest to run on. Subclasses ofGuestlessTask
should implement their logic in this method rather than ingo()
which is already provided. If your task requires different handling ingo
, it might be better derived directly fromTask
.
- source: Path | None
- class tmt.steps.PushTask(logger: Logger, guests: list[Guest], **kwargs: Any)
Bases:
MultiGuestTask
[None
]Task performing a workdir push to a guest
- property name: str
A name of this task.
Left for child classes to implement, because the name depends on the actual task.
- run_on_guest(guest: Guest, logger: Logger) None
Perform the task.
Called from
go()
once for every guest to run on. Subclasses ofGuestlessTask
should implement their logic in this method rather than ingo()
which is already provided. If your task requires different handling ingo
, it might be better derived directly fromTask
.
- class tmt.steps.Reboot(*, step: Step, order: int, logger: Logger)
Bases:
Action
Reboot guest
Initialize relations, store the reboot order
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- cli_invocations: list['tmt.cli.CliInvocation'] = []
- classmethod command(method_class: Method | None = None, usage: str | None = None) Command
Create the reboot command
- go() None
Reboot the guest(s)
- class tmt.steps.ResultT
A type variable representing a result type.
alias of TypeVar(‘ResultT’, bound=
BaseResult
)
- class tmt.steps.Step(*, plan: Plan, data: _RawStepData | list[_RawStepData] | None = None, name: str | None = None, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
MultiInvokableCommon
,Exportable
[Step
]Common parent of all test steps
Initialize and check the step data
- DEFAULT_HOW: str = 'shell'
- actions() None
Run all loaded Login or Reboot action instances of the step
- property allowed_methods_pattern: Pattern[str]
Return a pattern allowed methods must match
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- cli_invocations: list['tmt.cli.CliInvocation'] = []
- property enabled: bool | None
True if the step is enabled
- go(force: bool = False) None
Execute the test step
- load() None
Load status and step data from the workdir
- phases(classes: None = None) list[Phase]
- phases(classes: type[PhaseT]) list[PhaseT]
- phases(classes: tuple[type[PhaseT], ...]) list[PhaseT]
Iterate over phases by their order
By default iterates over all available phases. Optional filter ‘classes’ can be used to iterate only over instances of given class (single class or tuple of classes).
- property plugins_in_standalone_mode: int
The number of plugins in standalone mode.
Stand-alone mode means that only this step should be run as a part of the run (and not any other even if requested using –all). This is useful as some step options may completely change its behaviour from the regular behaviour based on options (e.g. listing images inside provision).
- save() None
Save status and step data to the workdir
- setup_actions() None
Insert login and reboot plugins if requested
- show() None
Show step details
- status(status: str | None = None) str | None
Get and set current step status
The meaning of the status is as follows: todo … config, data and command line processed (we know what to do) done … the final result of the step stored to workdir (we are done)
- property step_name: str
- summary() None
Give a concise summary about the step result
To be implemented by each step.
- classmethod usage(method_overview: str) str
Prepare general usage message for the step
- wake() None
Wake up the step (process workdir and command line)
- class tmt.steps.StepData(name: str, how: str, order: int = 50, when: list[str] = <factory>, summary: str | None = None)
Bases:
SpecBasedContainer
[_RawStepData
,_RawStepData
],NormalizeKeysMixin
,SerializableContainer
Keys necessary to describe, create, save and restore a step.
Very basic set of keys shared across all steps.
Provides basic functionality for transition between “raw” step data, which consists of fmf nodes and CLI options, and this container representation with keys and types more suitable for internal use.
Implementation expects simple 1:1 relation between
StepData
attributes - keys - and their fmf/CLI sources, where keys replace options’ dashes (-
) with underscores (_
). For example, to hold value of an fmf keyfoo-bar
- or value of a corresponding CLI option,--foo-bar
, a step data class should declare key namedfoo_data
. AllStepData
methods would honor this mapping.- classmethod from_spec(raw_data: _RawStepData, logger: Logger) StepDataT
Convert from a specification file or from a CLI option
- how: str
- name: str
- order: int = 50
- post_normalization(raw_data: _RawStepData, logger: Logger) None
Called after normalization, useful for tweaking normalized data
- classmethod pre_normalization(raw_data: _RawStepData, logger: Logger) None
Called before normalization, useful for tweaking raw data
- summary: str | None = None
- to_spec() _RawStepData
Convert to a form suitable for saving in a specification file
- when: list[str]
- class tmt.steps.Topology(guests: list[Guest])
Bases:
SerializableContainer
Describes the topology of provisioned tmt guests
- guest: GuestTopology | None
- guest_names: list[str]
- guests: dict[str, GuestTopology]
- push(*, dirpath: Path, guest: Guest, filename_base: Path | None = None, logger: Logger) Environment
Save and push topology to a given guest
- role_names: list[str]
- roles: dict[str, list[str]]
- save(*, dirpath: Path, filename_base: Path | None = None) list[Path]
Save the topology in files.
- Parameters:
dirpath – a directory to save into.
filename_base – if set, it would be used as a base for filenames, correct suffixes would be added.
- Returns:
list of paths to saved files.
- save_bash(dirpath: Path, filename: Path | None = None) Path
Save the topology in a Bash-sourceable file.
- Parameters:
dirpath – a directory to save into.
filename – if set, it would be used, otherwise a filename is created from
TEST_TOPOLOGY_FILENAME_BASE
and.sh
suffix.
- Returns:
path to the saved file.
- save_yaml(dirpath: Path, filename: Path | None = None) Path
Save the topology in a YAML file.
- Parameters:
dirpath – a directory to save into.
filename – if set, it would be used, otherwise a filename is created from
TEST_TOPOLOGY_FILENAME_BASE
and.yaml
suffix.
- Returns:
path to the saved file.
- to_dict() dict[str, Any]
Convert to a mapping.
See https://tmt.readthedocs.io/en/stable/code/classes.html#class-conversions for more details.
- class tmt.steps.WhereableStepData(where: list[str] = <factory>)
Bases:
object
Keys shared by step data that may be limited to a particular guest.
To be used as a mixin class, adds necessary keys.
See [1] and [2] for specification.
- where: list[str]
- tmt.steps.provides_method(name: str, doc: str | None = None, order: int = 50, installation_hint: str | None = None) Callable[[type[BasePlugin]], type[BasePlugin]]
A plugin class decorator to register plugin’s method with tmt steps.
In the following example, developer marks
SomePlugin
as providing two discover methods,foo
andbar
, withbar
being sorted to later position among methods:@tmt.steps.provides_method('foo') @tmt.steps.provides_method('bar', order=80) class SomePlugin(tmt.steps.discover.DicoverPlugin): ...
- Parameters:
name – name of the method.
doc – method documentation. If not specified, docstring of the decorated class is used.
order – order of the method among other step methods.
- tmt.steps.prune_directory(path: Path, preserved_members: set[str], logger: Logger) set[str]
Remove content of a given directory while preserving selected members.
- Parameters:
path – a directory to prune.
preserved_members – names of directory entries that should not be removed.
logger – used for logging.
- Returns:
names of members that were actually preserved, i.e. members that exist in the directory, and were not removed.
- tmt.steps.safe_filename(template: str, phase: Phase, guest: Guest, **variables: Any) Path
Construct a non-conflicting filename safe for parallel tasks.
Function adds enough uniqueness to a given template by adding a phase name and a guest name that the eventual filename would be safe against conflicting access from a phase running on multiple guests, and against reuse when created by the same plugin in different phases.
At first glance, the name might be an overkill: at one moment, there is just one phase running on the given guest, why bother? No other phase would touch the file on the guest. But:
filenames are created locally. One phase, running against multiple guests, still needs the filename to be unique on the tmt runner. Otherwise, phase running in different threads would contest a single file.
while the scenario is unlikely, user may eventually convince tmt to recognize two different names for the same machine, via
-h connect --guest $IP
. Therefore it may happen that one phase, running against two guests, would actually run on the very same HW. Therefore even the remote per-guest uniqueness is needed.the phase name is included to avoid reuse of the filename by different phases. A plugin may be invoked by multiple phases, and it might use a “constant” name for the file. That would lead to the filename being reused by different plugin executions. Adding the phase name should lower confusion: it would be immediately clear which phase used which filename, or whether a filename was or was not created by given phase.
- Parameters:
template – filename template. It is enhanced with
phase
andguest
safe name, but may use other variables provided invariables
.phase – a phase owning the resulting filename.
guest – a guest on which the filename would be used.
variables – additional variables
template
need when rendering the filename.
- tmt.steps.sync_with_guests(step: Step, action: str, task: GuestSyncTaskT, logger: Logger) None
Push and pull stuff from guests in a parallel manner.
Used by steps that run their plugins against one or more guest. Based on a
PhaseQueue
primitive, parallelized push/pull operations are needed, and this function handles the details.