Skip to content

Add Windows golden image storage tests (T2)#5126

Draft
Ahmad-Hafe wants to merge 1 commit into
RedHatQE:mainfrom
Ahmad-Hafe:windows-app-consistent-snapshot-test
Draft

Add Windows golden image storage tests (T2)#5126
Ahmad-Hafe wants to merge 1 commit into
RedHatQE:mainfrom
Ahmad-Hafe:windows-app-consistent-snapshot-test

Conversation

@Ahmad-Hafe

@Ahmad-Hafe Ahmad-Hafe commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add T2 Windows storage tests using the self-validation golden image DataSource
  • test_windows_vm_boots_from_golden_image: Verifies VM boot, guest agent connection, and Windows OS detection from the golden image
  • test_windows_multi_disk_snapshot_freeze_within_threshold: Creates a 2-disk Windows VM (boot + blank data disk), takes an online snapshot, and asserts the guest agent freeze window completes within 20 seconds — measuring status.creationTime - metadata.creationTimestamp to isolate freeze duration from backend finalization time

Gating

  • ACCEPT_WINDOWS_EULA=true env var (skips if not set)
  • windows11-golden-image DataSource must exist (skips gracefully if missing)
  • pytest.mark.windows marker — auto-included by T2 script when EULA is accepted

Tested

  • Ran on GCP cluster (sp-balanced-storage), freeze window was 11s, test passed with 20s threshold
  • Snapshot was confirmed app-consistent (Online indication with GuestAgent)

Test plan

  • Test passes on GCP cluster with golden image DataSource present
  • Pre-commit hooks pass (flake8 PID, ruff, mypy)
  • Verify test skips gracefully when golden image DataSource is missing
  • Verify test skips when ACCEPT_WINDOWS_EULA is not set

Made with Cursor

Summary by CodeRabbit

  • Tests
    • Added Windows environment test infrastructure with support for golden image validation.
    • Added tests validating Windows VM boot from golden images.
    • Added tests for application-consistent snapshot functionality on Windows VMs with multiple disks.

Add T2 tests for Windows VMs using the self-validation golden image DataSource:

1. test_windows_vm_boots_from_golden_image: Verifies a Windows VM can boot
   from the golden image, guest agent connects, and reports Windows OS.

2. test_windows_multi_disk_snapshot_freeze_within_threshold: Creates a
   2-disk Windows VM (boot + data disk), takes an online snapshot, and
   asserts the freeze window (guest agent freeze/thaw) completes within
   20 seconds. Measures actual freeze duration using VMSnapshot
   status.creationTime vs metadata.creationTimestamp.

Tests are gated by:
- ACCEPT_WINDOWS_EULA=true environment variable
- Windows golden image DataSource existence (skips gracefully if missing)
- pytest.mark.windows marker (auto-included by T2 when EULA is accepted)

Co-authored-by: Cursor <cursoragent@cursor.com>
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds Windows storage test infrastructure and two validation test modules: a golden image boot test that verifies Windows VM provisioning from a pre-created DataSource, and an app-consistent snapshot freeze-duration test on multi-disk VMs that measures guest agent interaction overhead.

Changes

Windows Storage Test Suite

Layer / File(s) Summary
Windows test infrastructure and EULA enforcement
tests/storage/windows/__init__.py, tests/storage/windows/conftest.py (setup, constants, fixtures)
Module package header and session-scoped EULA acceptance enforcement via ACCEPT_WINDOWS_EULA=true environment variable check. Defines golden image name/namespace, blank disk size (10 GiB), and Windows 11 preference identifier constants.
Golden image DataSource and basic VM provisioning
tests/storage/windows/conftest.py (golden image fixture, VM fixture)
Module-scoped fixture locates pre-created Windows 11 DataSource, skips tests if missing, waits for READY state. Class-scoped fixture provisions a Windows VM from the golden image using VirtualMachineForTests.
Data disk template and running multi-disk VM fixture
tests/storage/windows/conftest.py (data disk template, running VM fixture)
Class-scoped fixture builds blank DataVolume template with 10 GiB size. Running VM fixture provisions a Windows VM with golden image, attaches the blank data disk, waits for guest agent connection (10-minute timeout), and yields for tests.
Windows golden image boot validation test
tests/storage/windows/test_windows_golden_image.py
Boots a Windows VM from golden image, waits for guest agent AGENT_CONNECTED condition, queries guest OS info via agent, and asserts the reported OS name contains "windows".
App-consistent snapshot freeze-duration test
tests/storage/windows/test_windows_app_consistent_snapshot.py
Creates an online VirtualMachineSnapshot on a multi-disk Windows VM, polls status.creationTime, computes freeze duration (VM snapshot creation timestamp to actual snapshot creation time), waits for snapshot completion, validates online indication, and asserts freeze duration is below 20 seconds.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

new-tests

Suggested reviewers

  • rlobillo
  • vsibirsk
  • dshchedr
  • rnetser
  • albarker-rh
  • hmeir

Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (2 errors)

Check name Status Explanation Resolution
Description check ❌ Error Description provides comprehensive summary, clear test objectives, gating requirements, and testing evidence, but does not follow the required template structure with the specified section headings. Restructure using the template: 'What this PR does/why we need it', 'Which issue(s) this PR fixes', 'Special notes for reviewer', and 'jira-ticket'. Move existing content into appropriate sections.
Stp Link Required ❌ Error Two new test files lack required STP/RFE/Jira links: test_windows_app_consistent_snapshot.py and test_windows_golden_image.py have @pytest.mark.polarion decorators but no STP/RFE/Jira docstring links. Add STP:/RFE:/Jira: links to module/class/function docstrings in both test files. @pytest.mark.polarion alone does not satisfy this requirement.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly and concisely describes the main change: adding Windows golden image storage tests for T2 tier, well under the 120-character limit.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Linked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped RedHatQE/openshift-virtualization-tests-design-docs.


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 and usage tips.

@Ahmad-Hafe Ahmad-Hafe marked this pull request as draft June 3, 2026 21:04

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 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 `@tests/storage/windows/conftest.py`:
- Line 114: The Windows snapshot fixture is disabling SSH validation by calling
running_vm(vm=vm, wait_for_interfaces=True, check_ssh_connectivity=False);
revert this so SSH connectivity is validated: remove the
check_ssh_connectivity=False override (or set it to True) in the running_vm call
inside the Windows snapshot fixture in tests/storage/windows/conftest.py to
ensure the fixture verifies SSH/WSL2 connectivity as expected.

In `@tests/storage/windows/test_windows_app_consistent_snapshot.py`:
- Around line 4-6: The module docstring stating the freeze limit as "< 10s" is
inconsistent with the test assertion that enforces "< 20s"; update the
module-level docstring at the top of
tests/storage/windows/test_windows_app_consistent_snapshot.py to state "< 20s"
so it matches the enforced threshold (or, if policy is to enforce 10s, instead
change the assertion that checks the freeze duration to use 10 seconds). Ensure
you edit the module docstring and confirm consistency with the
assertion/threshold used in the test (the line that asserts the measured freeze
duration is less than 20 seconds).

In `@tests/storage/windows/test_windows_golden_image.py`:
- Line 51: The test disables SSH verification for the golden-image path by
calling running_vm(vm=vm, wait_for_interfaces=True,
check_ssh_connectivity=False); restore SSH checks by removing the override or
setting check_ssh_connectivity=True so running_vm uses the Windows SSH
validation (matching behavior in
tests/infrastructure/instance_types/supported_os/test_windows_os.py). Update the
call in tests/storage/windows/test_windows_golden_image.py to call running_vm
with the default (or explicit True) for check_ssh_connectivity to ensure
SSH/WSL2 paths are validated.
🪄 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: 19ab8428-a352-4bad-b6f3-7bd75e462f3c

📥 Commits

Reviewing files that changed from the base of the PR and between c3f814f and ad0a568.

📒 Files selected for processing (4)
  • tests/storage/windows/__init__.py
  • tests/storage/windows/conftest.py
  • tests/storage/windows/test_windows_app_consistent_snapshot.py
  • tests/storage/windows/test_windows_golden_image.py

),
) as vm:
add_dv_to_vm(vm=vm, template_dv=blank_data_disk_template)
running_vm(vm=vm, wait_for_interfaces=True, check_ssh_connectivity=False)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

HIGH: Keep SSH validation enabled for the Windows snapshot fixture.

This fixture is the readiness gate for the snapshot scenario. With check_ssh_connectivity=False, a Windows image can pass setup even when SSH/WSL2 is broken, so the snapshot test stops validating the expected Windows image contract.

Suggested fix
-        running_vm(vm=vm, wait_for_interfaces=True, check_ssh_connectivity=False)
+        running_vm(vm=vm, wait_for_interfaces=True)

Based on learnings: In tests/infrastructure/instance_types/supported_os/test_windows_os.py, Windows guest images are configured with SSH support, so running_vm() should keep the default check_ssh_connectivity=True to verify SSH connectivity is working properly in the Windows guest images.

🤖 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 `@tests/storage/windows/conftest.py` at line 114, The Windows snapshot fixture
is disabling SSH validation by calling running_vm(vm=vm,
wait_for_interfaces=True, check_ssh_connectivity=False); revert this so SSH
connectivity is validated: remove the check_ssh_connectivity=False override (or
set it to True) in the running_vm call inside the Windows snapshot fixture in
tests/storage/windows/conftest.py to ensure the fixture verifies SSH/WSL2
connectivity as expected.

Comment on lines +4 to +6
Verifies that an online VirtualMachineSnapshot of a multi-disk Windows VM
(boot + data disk) freezes for less than 10 seconds, proving guest agent
freeze/thaw works correctly on the storage provider.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

LOW: Align the documented freeze limit with the enforced threshold.

The module docstring says < 10s, but the code enforces < 20s. That mismatch will mislead anyone triaging runs around the 10-20 second range.

Suggested fix
- Verifies that an online VirtualMachineSnapshot of a multi-disk Windows VM
- (boot + data disk) freezes for less than 10 seconds, proving guest agent
+ Verifies that an online VirtualMachineSnapshot of a multi-disk Windows VM
+ (boot + data disk) freezes for less than 20 seconds, proving guest agent
  freeze/thaw works correctly on the storage provider.

Also applies to: 21-21

🤖 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 `@tests/storage/windows/test_windows_app_consistent_snapshot.py` around lines 4
- 6, The module docstring stating the freeze limit as "< 10s" is inconsistent
with the test assertion that enforces "< 20s"; update the module-level docstring
at the top of tests/storage/windows/test_windows_app_consistent_snapshot.py to
state "< 20s" so it matches the enforced threshold (or, if policy is to enforce
10s, instead change the assertion that checks the freeze duration to use 10
seconds). Ensure you edit the module docstring and confirm consistency with the
assertion/threshold used in the test (the line that asserts the measured freeze
duration is less than 20 seconds).

vm = windows_vm_from_golden_image

LOGGER.info(f"Starting Windows VM {vm.name} from golden image...")
running_vm(vm=vm, wait_for_interfaces=True, check_ssh_connectivity=False)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

HIGH: Re-enable SSH checks in the golden-image validation path.

This is the test that proves the golden image is usable. Disabling SSH verification means the test can still pass when the Windows image boots and reports guest-agent info but its SSH/WSL2 path is broken.

Suggested fix
-        running_vm(vm=vm, wait_for_interfaces=True, check_ssh_connectivity=False)
+        running_vm(vm=vm, wait_for_interfaces=True)

Based on learnings: In tests/infrastructure/instance_types/supported_os/test_windows_os.py, Windows guest images are configured with SSH support, so running_vm() should keep the default check_ssh_connectivity=True to verify SSH connectivity is working properly in the Windows guest images.

🤖 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 `@tests/storage/windows/test_windows_golden_image.py` at line 51, The test
disables SSH verification for the golden-image path by calling running_vm(vm=vm,
wait_for_interfaces=True, check_ssh_connectivity=False); restore SSH checks by
removing the override or setting check_ssh_connectivity=True so running_vm uses
the Windows SSH validation (matching behavior in
tests/infrastructure/instance_types/supported_os/test_windows_os.py). Update the
call in tests/storage/windows/test_windows_golden_image.py to call running_vm
with the default (or explicit True) for check_ssh_connectivity to ensure
SSH/WSL2 paths are validated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants