tmt-try: Quick experiments with tests and environments


tmt-try: what it does

tmt try lets you quickly experiment with tests and the provisioning method without setting up a full test run. It is handy for trying different OS images, provision methods, and test filters directly from your current directory or a given path.

Tip: If you see a message about outdated caches, run tldr —update (outside of tmt) to refresh your local docs cache. This is not related to tmt itself, but to the tldr pages you might be using in parallel.

Quick start: common starting points

  • Run the default try in the current directory (no tests in the CWD required):
tmt try
  • Run a test in a specific directory:
cd /path/to/test && tmt try
  • Use a specific operating system image:
tmt try {{fedora-41}}
  • Combine a custom image with a provision method (e.g., container):
tmt try {{fedora@container}}
  • Filter tests by name or feature:
tmt try --test {{feature}}
  • Ask for guidance during provisioning (interactive):
tmt try --ask
  • Directly log into the guest without prompting:
tmt try --login
  • Display help and options:
tmt try --help

How to think about the workflow

  • tmt try provisions a guest, runs the selected tests (or a default subset), and then usually tears down the environment unless you interrupt or choose to keep it.
  • It’s ideal for quick experimentation with different OS images, containers, or test filters without creating a full plan.

Practical examples

  • Try tests in a specific directory with a given OS:
cd /projects/metrics/tests/ && tmt try {{fedora-39}}
  • Try a test subset using a feature name:
tmt try --test {{networking}}
  • Use interactive mode to inspect the guest as it’s provisioned:
tmt try --ask

Common pitfalls

  • Missing tests in CWD: If there are no tests in the current directory, tmt try will still provision a guest to explore how provisioning works, but you won’t get test results to review. Ensure you point to a test directory or include —test filters.
  • OS image availability: The image name like {{fedora-41}} must exist in your configured image sources. If it’s unavailable, tmt will error out; verify you can reach the image service or use a different image.
  • Resource usage: Try operations can spin up virtual guests or containers. Be mindful of quotas or local resource limits to avoid long wait times.

Tips for getting the most from tmt try

  • Use —login only when you want an SSH-like session into the guest; otherwise, tmt will run commands and collect results automatically.
  • Combine filters with —test to narrow the scope before provisioning, saving time.
  • If you routinely test a particular OS, add a small script or alias to your shell to speed up the command:
alias ttry='tmt try {{fedora-41}} --test {{networking}}'

See also

See Also