Skip to content

virt_tests: extract to standalone virt-framework repository - #1005

Draft
trgill wants to merge 4 commits into
snapshotmanager:mainfrom
trgill:switch_to_external_virt_framework
Draft

virt_tests: extract to standalone virt-framework repository#1005
trgill wants to merge 4 commits into
snapshotmanager:mainfrom
trgill:switch_to_external_virt_framework

Conversation

@trgill

@trgill trgill commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Extract the virt_tests module to a standalone pip-installable package
(virt-framework) so it can be reused by other projects in the snapm
ecosystem (e.g. boom-boot).

The standalone repository is at https://github.com/trgill/virt-framework
and will be moved to https://github.com/snapshotmanager/virt-framework.

Changes:

  • Use explicit CDN URLs for virt-install network installs to avoid CI flakiness from random mirror selection (addresses tests: find out why virt_tests is so flakey on Fedora #914)
  • Update CI workflow to pip install the external virt-framework package and use the virt-framework console script instead of python3 -m virt_tests
  • Add deprecation notice to the embedded virt_tests directory; source files will be removed in a future release
  • The embedded virt_tests code has zero dependencies on the snapm package (stdlib-only imports), making it a clean extraction. The standalone package preserves the full git history and provides the same CLI interface with identical arguments.

Testing: CI workflow runs the external package against the full
matrix (firmware x storage x OS) to validate the integration.

Addresses: #914

Summary by CodeRabbit

  • New Features

    • Virtualization tests now run through the standalone virtualization test framework.
    • Existing test options for firmware, storage, operating system, repository, and revision remain available.
  • Documentation

    • Updated contribution guidance for test-related commit messages.
    • Marked the bundled virtualization test copy as deprecated and documented its replacement.
  • Refactor

    • Removed the legacy bundled virtualization test implementation and command-line runner.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6b75f420-4d38-49e6-9ebe-27945f922d90

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The local virt_tests CLI and VM strategy are removed, the package is marked as extracted, and CI installs and invokes standalone virt-framework. Security risk: Medium; CI executes mutable main-branch code with sudo.

Changes

virt-framework extraction

Layer / File(s) Summary
Local implementation extraction
virt_tests/__main__.py, virt_tests/strategy.py, virt_tests/testvm.py, virt_tests/util.py, virt_tests/README.md, setup.cfg, CONTRIBUTING.md
The local virtualization test CLI, strategy, VM infrastructure, and utility helpers are removed; package discovery and documentation reflect the standalone repository.
CI execution handoff
.github/workflows/snapm.yml
The virt_tests job installs virt-framework from GitHub and replaces module execution with the virt-framework command while preserving existing arguments.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: Testing, CI

Suggested reviewers: bmr-cymru

🚥 Pre-merge checks | ✅ 9
✅ Passed checks (9 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No-Hardcoded-Secrets ✅ Passed No hardcoded secrets, credentialed URLs, or secret-named string assignments were introduced; only public URLs and a commit hash appear.
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/ECB or custom crypto/secret comparisons appear in the patch; changes are docs, workflow updates, and code removal only.
No-Injection-Vectors ✅ Passed PASS: The patch adds no SQL/eval/pickle/yaml.load/os.system/shell=True sinks; the new workflow uses quoted args and the old virt_tests code is removed.
No-Sensitive-Data-In-Logs ✅ Passed No passwords, tokens, PII, or internal hosts are logged; the workflow only echoes status text and archives logs without printing contents.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: extracting virt_tests into a standalone virt-framework repository.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@trgill

trgill commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

This is not ready for merge. Just testing withe the gh workflow.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

@trgill Understood — I’ll run the review as a workflow test only. This does not indicate merge readiness or approval.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@packit-as-a-service

Copy link
Copy Markdown

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo dnf install -y 'dnf*-command(copr)'
  • dnf copr enable packit/snapshotmanager-snapm-1005
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/snapm.yml (1)

219-224: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Remove or update the fedora44 matrix entry. virt-framework’s README only lists fedora42, fedora43, centos-stream9, and centos-stream10, so this job will likely fail on the fedora44 lane until support is added.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/snapm.yml around lines 219 - 224, Update the matrix
configuration used by the virt-framework invocation to remove the unsupported
fedora44 entry, or replace it with a currently supported image such as fedora42,
fedora43, centos-stream9, or centos-stream10. Keep the existing "$BASE_OS"
wiring and other workflow arguments unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/snapm.yml:
- Around line 148-151: Harden the workflow steps installing virt-framework and
checking out the repository: replace the mutable main reference with an
immutable commit or release, pin actions/checkout to its full commit SHA, and
set persist-credentials to false unless the workflow requires the checkout
token. Apply these changes to the relevant virt-framework installation steps,
including the one near line 219.

In `@virt_tests/README.md`:
- Line 10: Update the installation command in the README to reference an
immutable virt-framework commit SHA or release tag instead of the moving default
branch. Keep the existing pip install format and repository target unchanged.

---

Outside diff comments:
In @.github/workflows/snapm.yml:
- Around line 219-224: Update the matrix configuration used by the
virt-framework invocation to remove the unsupported fedora44 entry, or replace
it with a currently supported image such as fedora42, fedora43, centos-stream9,
or centos-stream10. Keep the existing "$BASE_OS" wiring and other workflow
arguments unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d31398a1-a6ad-45fc-8c82-050d9d287b7a

📥 Commits

Reviewing files that changed from the base of the PR and between 880f8d5 and ca29e22.

📒 Files selected for processing (9)
  • .github/workflows/snapm.yml
  • CONTRIBUTING.md
  • setup.cfg
  • virt_tests/README.md
  • virt_tests/__init__.py
  • virt_tests/__main__.py
  • virt_tests/strategy.py
  • virt_tests/testvm.py
  • virt_tests/util.py
💤 Files with no reviewable changes (5)
  • setup.cfg
  • virt_tests/main.py
  • virt_tests/util.py
  • virt_tests/strategy.py
  • virt_tests/testvm.py

Comment on lines +148 to +151
- name: Install virt-framework
run: |
set -euo pipefail
sudo pip install git+https://github.com/trgill/virt-framework.git@main

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/workflows/snapm.yml"

echo "== Line count =="
wc -l "$file"

echo
echo "== Relevant excerpt =="
nl -ba "$file" | sed -n '120,240p'

echo
echo "== Search for checkout / permissions / persist-credentials =="
rg -n "actions/checkout|permissions:|persist-credentials|fedora44|virt-framework|sudo pip install|sudo " "$file"

Repository: snapshotmanager/snapm

Length of output: 273


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/workflows/snapm.yml"

echo "== Relevant excerpt with line numbers =="
awk 'NR>=120 && NR<=240 { printf "%4d  %s\n", NR, $0 }' "$file"

echo
echo "== Checkout / permissions / persist-credentials / matrix markers =="
rg -n "actions/checkout|permissions:|persist-credentials|fedora44|virt-framework|sudo pip install|sudo " "$file"

Repository: snapshotmanager/snapm

Length of output: 10160


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/workflows/snapm.yml"

echo "== Top of workflow =="
awk 'NR>=1 && NR<=40 { printf "%4d  %s\n", NR, $0 }' "$file"

echo
echo "== Checkout config details =="
rg -n -C 2 "uses: actions/checkout|persist-credentials|permissions:" "$file"

Repository: snapshotmanager/snapm

Length of output: 1747


Don’t run mutable upstream code as root

Lines 148-151 and 219: virt-framework comes from mutable main and is executed with sudo, so upstream changes run as root on the runner. Pin it to an immutable commit/release, and pin actions/checkout to a full SHA; set persist-credentials: false unless the token is needed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/snapm.yml around lines 148 - 151, Harden the workflow
steps installing virt-framework and checking out the repository: replace the
mutable main reference with an immutable commit or release, pin actions/checkout
to its full commit SHA, and set persist-credentials to false unless the workflow
requires the checkout token. Apply these changes to the relevant virt-framework
installation steps, including the one near line 219.

Source: Path instructions

Comment thread virt_tests/README.md
This copy will be removed in a future release. Use the standalone
package instead:

pip install git+https://github.com/trgill/virt-framework.git

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'README excerpt:\n'
nl -ba virt_tests/README.md | sed -n '1,25p'

printf '\nSearch for other install references:\n'
rg -n "git\+https://github.com/trgill/virt-framework\.git|virt-framework" -S virt_tests/README.md . || true

Repository: snapshotmanager/snapm

Length of output: 215


🌐 Web query:

trgill/virt-framework GitHub releases tags

💡 Result:

There is no public GitHub repository found under the name "trgill/virt-framework". As of July 20, 2026, searches for this specific path yield no results on GitHub [1-10]. It is possible the repository name is incorrect, private, or has been deleted. If you are looking for virtualization-related frameworks on GitHub, several projects with similar names or purposes exist, such as: - vandycknick/virt-fwk: Rust bindings for Apple's Virtualization Framework [1]. - vortemain/vorte-framework: An AI-first Python API framework [2]. - projectbeskar/virtrigaud: A storage-agnostic cross-hypervisor migration tool [3][4]. - kubevirt/kubevirt: A virtualization API for Kubernetes [5]. Please verify the repository owner or name.

Citations:


Pin the install target. pip install git+https://github.com/trgill/virt-framework.git pulls the repository’s moving default branch, so users can get different code over time. Use an immutable commit SHA or release tag instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@virt_tests/README.md` at line 10, Update the installation command in the
README to reference an immutable virt-framework commit SHA or release tag
instead of the moving default branch. Keep the existing pip install format and
repository target unchanged.

Source: Path instructions

trgill added 3 commits July 20, 2026 16:10
Replace virt-install auto-discovery (--install <os>) with explicit
--location URLs pointing to official CDN endpoints. This avoids
random mirror selection that can cause network flakiness in CI,
particularly on Fedora.

Also add inst.repo= parameter to ensure package downloads use the
same reliable CDN endpoints.

Addresses: snapshotmanager#914

Assisted-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Todd Gill <tgill@redhat.com>
Replace the embedded virt_tests module with the standalone
virt-framework package installed from GitHub.

Changes:
- Add step to pip install virt-framework from trgill/virt-framework
- Replace 'python3 -m virt_tests' with 'virt-framework' command

The virt-framework repository will be moved from trgill/ to
snapshotmanager/ and the install URL updated accordingly.

Related: snapshotmanager#941

Assisted-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Todd Gill <tgill@redhat.com>
The virt_tests module has been extracted to a standalone repository
at https://github.com/trgill/virt-framework and will be removed
from this repo in a future release.

Assisted-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Todd Gill <tgill@redhat.com>
@trgill
trgill force-pushed the switch_to_external_virt_framework branch from ca29e22 to c2b0e8d Compare July 20, 2026 20:10
@bmr-cymru

Copy link
Copy Markdown
Contributor

I've had a quick look at the new repo, and there is a lot there that I like: I think this is a good direction for the VM tests to head in, and I think it will enable us to land other useful features in future (e.g.: converting the test strategy from code to data).

I haven't done a thorough review of the code yet (there's a lot of net-new code in the refactored virt_tests package - there's a lot to think about here, but my general initial thoughts are:

  • Do we want to pick a less generic name? I am fine with virt-framework if we are not planning to package or make releases from the repo (which I think is reasonable, at least for now) then I'm fine with that name. If we are going to actually make releases then I think something like "sm-virt-framework" might be a better choice.
  • Ack to moving this into the snapshotmanager org once it's stable & ready for the switch
  • Some of the new code is a bit outside my in-depth knowledge, so it will take a bit of time for me to crunch through it
  • Module names: I'd prefer to avoid module with names like test_foo unless they contain unittest.TestCase style test classes: I'd be happy with matrix, runner without the test_ prefix.
  • Code style should conform to black conventions: right now it wants to reformat 7/10 files in the refactored repo (with a big diffstat)
  • One of the things about the existing virt_tests that I wasn't 100% happy with was the proliferation of multi-line triple-quoted string literals as templates. This is mostly an aesthetic/maintenance concern - it's hard to get these strings both formatted correctly and maintain readability*, and it is easy to break them when making updates. It's one of the weaker aspects of the existing virt_tests imho. Something like jinja might be overkill for our needs, but I think it's worth filing an issue for this and considering other options.

Lastly, and I get this is a big ask that adds extra work, but I think it would be easier to review & reason about these changes if we made the changes to the in-tree copy first, and then separate out the extraction to a separate repo as a separate PR once all those changes have been merged. There are some git tricks that can make this easier - I'm happy to help with that to get this into shape.

@bmr-cymru

Copy link
Copy Markdown
Contributor

(*) e.g. this is a really common triple quoted anti-pattern I see in Python code:

       some_thing = f"""
foo bar baz quux
lorem ipsum dolor sit amet
"""

The user might expect some_thing to have the value "foo bar baz quux\nlorem ipsum dolor sit amet\n", but the string is actually "\nfoo bar baz quux\nlorem ipsum dolor sit amet\n" (with a leading newline) because the whitespace following the f"""becomes part of the string. Writing it correctly, without the extra whitespace is less readable because it shunts the first line out of alignment with everything else that follows.

This is really common and can lead to funky/unexpected formatting when these strings are output or written to a file (/etc/fstab in Fedora/CentOS/RHEL has had a leading newline since ~2008 for this reason).

@trgill
trgill force-pushed the switch_to_external_virt_framework branch from c2b0e8d to 3c65ac9 Compare July 23, 2026 15:17
Remove the virt_tests source code that has been extracted to the
standalone virt-framework repository. The CI workflow now installs
the external package via pip.

The deprecation README is retained to direct users to the new
repository at https://github.com/trgill/virt-framework.

Changes:
- Remove __init__.py, __main__.py, strategy.py, testvm.py, util.py
- Remove virt_tests exclude from setup.cfg (no longer needed)
- Update CONTRIBUTING.md to remove virt_tests reference

Assisted-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Todd Gill <tgill@redhat.com>
@trgill
trgill force-pushed the switch_to_external_virt_framework branch from 3c65ac9 to 9d61c93 Compare July 23, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants