Skip to content

Storage: Add windows OADP test#4603

Open
dalia-frank wants to merge 2 commits intoRedHatQE:mainfrom
dalia-frank:oadp-windows-backup-restore
Open

Storage: Add windows OADP test#4603
dalia-frank wants to merge 2 commits intoRedHatQE:mainfrom
dalia-frank:oadp-windows-backup-restore

Conversation

@dalia-frank
Copy link
Copy Markdown
Contributor

@dalia-frank dalia-frank commented Apr 27, 2026

Short description:

Add automated backup and restore tests for Windows.

More details:

Now that the foundational Windows bug (CNV-84547) has been resolved, we are enabling the test suite for Windows backup and restore. These tests will provide the initial baseline coverage and ensure this functionality remains stable moving forward.

What this PR does / why we need it:

Feature Validation: Implements tests for Windows backup and restore functionality, which was previously blocked.

Continuous Coverage: Ensures that Windows support is tested on a regular basis now that the environment is ready.

Which issue(s) this PR fixes:

Fixes: CNV-84548

Special notes for reviewer:
jira-ticket:

https://redhat.atlassian.net/browse/CNV-84548

Assisted-by: cursor

Summary by CodeRabbit

  • Tests
    • Added end-to-end coverage for backing up and restoring a Windows VM without DataMover: new fixtures for provisioning a Windows VM, scoped Velero backup/restore flows, and a test that verifies a marker file’s content after restore.
  • Refactor
    • Centralized Windows VM file-verification into shared utilities and removed the duplicate test-specific helper.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 196e5476-75ff-4ab0-926e-0b4c9260ae8f

📥 Commits

Reviewing files that changed from the base of the PR and between 89350eb and 09acaa1.

📒 Files selected for processing (2)
  • tests/storage/storage_migration/utils.py
  • utilities/virt.py
💤 Files with no reviewable changes (1)
  • tests/storage/storage_migration/utils.py

📝 Walkthrough

Walkthrough

Adds OADP Velero fixtures and a tier3 Velero test to back up/restore Windows VMs without DataMover, introduces HTTP-backed DataVolume VM provisioning and Windows file write/verify utilities, and moves the Windows file verification helper into utilities/virt.py.

Changes

Cohort / File(s) Summary
OADP Test Fixtures
tests/data_protection/oadp/conftest.py
Added fixtures: dpa_velero_image_override (patches DPA Velero image FQIN), windows_vm_with_data_volume_template (provisions Windows VM from HTTP-backed DataVolume, waits for readiness, writes marker), velero_backup_first_namespace_without_datamover (namespace-scoped backup with fixed name), velero_restore_first_namespace_without_datamover (deletes namespace and restores same backup).
OADP Test Case
tests/data_protection/oadp/test_velero.py
Added test_backup_and_restore_windows_vm (tier3): waits up to 15 minutes for Windows VM Running, verifies marker file at FILE_PATH_FOR_WINDOWS_BACKUP equals TEXT_TO_TEST.
OADP Utilities
tests/data_protection/oadp/utils.py
Added constants FILE_PATH_FOR_WINDOWS_BACKUP, OADP_DPA_NAME, OADP_VELERO_IMAGE_FQIN_OVERRIDE; changed signature wait_for_restored_dv(dv: DataVolume) -> None; added write_file_windows_vm_for_oadp (PowerShell via SSH) and create_windows_vm_from_dv_template context manager (creates HTTP-sourced DataVolume using Artifactory config, instantiates VM from template, optional wait, cleanup).
Storage migration tests & utils
tests/storage/storage_migration/test_storage_class_migration.py, tests/storage/storage_migration/utils.py
Removed verify_file_in_windows_vm from tests/storage/.../utils.py; updated test import to use utilities.virt.verify_file_in_windows_vm. No other test logic changed.
Shared Virt Utilities
utilities/virt.py
Added verify_file_in_windows_vm(windows_vm, file_name_with_path, file_content) which runs PowerShell Get-Content -LiteralPath on the VM, strips output and asserts exact equality with expected string (assertion includes actual vs expected).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Storage: Add windows OADP test' directly summarizes the main change: introducing Windows OADP backup/restore tests. It is concise, specific, and clearly conveys the primary contribution.
Description check ✅ Passed The description follows the repository template with all required sections completed: short description, more details, what/why, issue fixes, special notes, and jira-ticket with full URL. Content is substantive and addresses the PR's objectives.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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

@openshift-virtualization-qe-bot-5
Copy link
Copy Markdown

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: A tracking issue is created for this PR and will be closed when the PR is merged or closed
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: Enabled categories: branch, can-be-merged, cherry-pick, has-conflicts, hold, needs-rebase, size, verified, wip

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (approvers only)
  • /hold cancel - Unblock PR merging
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)
  • /regenerate-welcome - Regenerate this welcome message

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

  • /retest tox - Run Python test suite with tox
  • /retest build-container - Rebuild and test container image
  • /retest verify-bugs-are-open - verify-bugs-are-open
  • /retest all - Run all available tests

Container Operations

  • /build-and-push-container - Build and push container image (tagged with PR number)
    • Supports additional build arguments: /build-and-push-container --build-arg KEY=value

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3

Label Management

  • /<label-name> - Add a label to the PR
  • /<label-name> cancel - Remove a label from the PR

✅ Merge Requirements

This PR will be automatically approved when the following conditions are met:

  1. Approval: /approve from at least one approver
  2. LGTM Count: Minimum 2 /lgtm from reviewers
  3. Status Checks: All required status checks must pass
  4. No Blockers: No wip, hold, has-conflicts labels and PR must be mergeable (no conflicts)
  5. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

  • dshchedr
  • jpeimer
  • myakove
  • rnetser
  • vsibirsk

Reviewers:

  • Ahmad-Hafe
  • RoniKishner
  • acinko-rh
  • dalia-frank
  • dshchedr
  • ema-aka-young
  • geetikakay
  • josemacassan
  • jpeimer
  • kgoldbla
  • kshvaika
  • rnetser
  • vsibirsk
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
AI Features
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6[1m])

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is removed on new commits unless the push is detected as a clean rebase
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Container Builds: Container images are automatically tagged with the PR number
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.66%. Comparing base (b4ad2e0) to head (09acaa1).
⚠️ Report is 97 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4603      +/-   ##
==========================================
+ Coverage   98.63%   98.66%   +0.03%     
==========================================
  Files          25       25              
  Lines        2420     2476      +56     
==========================================
+ Hits         2387     2443      +56     
  Misses         33       33              
Flag Coverage Δ
utilities 98.66% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@tests/data_protection/oadp/conftest.py`:
- Around line 178-195: The fixture currently uses latest_windows =
py_config.get("latest_windows_os_dict") or {} which masks missing config and
passes None into create_windows_vm_from_dv_template and wait_for_windows_vm;
change to require and validate the config: fetch latest_windows via
py_config["latest_windows_os_dict"] (or raise a clear exception if missing) and
assert that IMAGE_PATH_STR, DV_SIZE_STR, and OS_VERSION_STR keys are present and
non-empty in latest_windows, raising a ValueError/RuntimeError with a
descriptive message if any are missing before calling
create_windows_vm_from_dv_template and get_test_artifact_server_url so the test
fails fast on bad/missing metadata.

In `@tests/data_protection/oadp/test_velero.py`:
- Around line 101-130: The new Windows OADP test
(test_backup_and_restore_windows_vm) lacks the required STD/STP traceability:
add or update the module-level docstring to include an STP link (or if no STP
exists, an RFE/Jira-epic link) and create an STD placeholder test/marker before
the implemented test (e.g., a minimal test function named
test_std_windows_backup_restore or a module-level note) that contains the STD
docstring describing scope, preconditions and test steps for review; ensure the
STD placeholder is reviewed/approved before keeping the implemented test and
include the STP/RFE/Jira identifier in the implemented test docstring or as a
module-level comment to satisfy traceability rules.

In `@utilities/virt.py`:
- Around line 1740-1742: The current call builds a single shell string for
Get-Content which breaks on spaces/wildcards; change the command tokens so
PowerShell receives Get-Content with the -LiteralPath parameter and the path as
a separate token (use the existing variables cmd, file_name_with_path and
run_ssh_commands), e.g. construct cmd so it invokes "powershell -command
Get-Content -LiteralPath <path>" with the path passed as its own token rather
than interpolated into a quoted string; keep the call to run_ssh_commands and
the assertion 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: b453c7f3-eafb-4ce7-9edf-155ca92ba735

📥 Commits

Reviewing files that changed from the base of the PR and between b675fe1 and fce5294.

📒 Files selected for processing (6)
  • tests/data_protection/oadp/conftest.py
  • tests/data_protection/oadp/test_velero.py
  • tests/data_protection/oadp/utils.py
  • tests/storage/storage_migration/test_storage_class_migration.py
  • tests/storage/storage_migration/utils.py
  • utilities/virt.py
💤 Files with no reviewable changes (1)
  • tests/storage/storage_migration/utils.py

Comment thread tests/data_protection/oadp/conftest.py Outdated
Comment thread tests/data_protection/oadp/test_velero.py
Comment thread utilities/virt.py Outdated
@openshift-virtualization-qe-bot
Copy link
Copy Markdown

D/S test tox -e verify-tc-requirement-polarion failed: cnv-tests-tox-executor/27242

@openshift-virtualization-qe-bot
Copy link
Copy Markdown

D/S test tox -e verify-tc-requirement-polarion failed: cnv-tests-tox-executor/27277

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
tests/data_protection/oadp/conftest.py (1)

169-197: ⚠️ Potential issue | 🟠 Major

Fail fast on required Windows metadata.

latest_windows.get(...) and .get(..., {}) still mask missing IMAGE_PATH_STR, DV_SIZE_STR, TEMPLATE_LABELS_STR, and OS_VERSION_STR values. That turns a config bug into an opaque VM/setup failure later. Use direct key access here so the fixture stops at the config boundary.

Suggested fix
-        image_url=f"{get_test_artifact_server_url()}{latest_windows.get(IMAGE_PATH_STR)}",
-        dv_size=latest_windows.get(DV_SIZE_STR),
-        template_labels=latest_windows.get(TEMPLATE_LABELS_STR, {}),
+        image_url=f"{get_test_artifact_server_url()}{latest_windows[IMAGE_PATH_STR]}",
+        dv_size=latest_windows[DV_SIZE_STR],
+        template_labels=latest_windows[TEMPLATE_LABELS_STR],
...
-            version=latest_windows.get(OS_VERSION_STR),
+            version=latest_windows[OS_VERSION_STR],

As per coding guidelines, "No defensive programming - fail-fast, don't hide bugs with fake defaults."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/data_protection/oadp/conftest.py` around lines 169 - 197, The fixture
windows_vm_with_data_volume_template currently uses
latest_windows.get(IMAGE_PATH_STR), .get(DV_SIZE_STR), .get(TEMPLATE_LABELS_STR,
{}), and .get(OS_VERSION_STR) which hides missing config keys; change these to
direct key access (e.g. latest_windows[IMAGE_PATH_STR],
latest_windows[DV_SIZE_STR], latest_windows[TEMPLATE_LABELS_STR],
latest_windows[OS_VERSION_STR]) so a KeyError is raised immediately at fixture
creation instead of producing opaque failures later in
create_windows_vm_from_dv_template, wait_for_windows_vm, or
write_file_windows_vm_for_oadp; update all occurrences in the fixture
accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@tests/data_protection/oadp/conftest.py`:
- Around line 169-197: The fixture windows_vm_with_data_volume_template
currently uses latest_windows.get(IMAGE_PATH_STR), .get(DV_SIZE_STR),
.get(TEMPLATE_LABELS_STR, {}), and .get(OS_VERSION_STR) which hides missing
config keys; change these to direct key access (e.g.
latest_windows[IMAGE_PATH_STR], latest_windows[DV_SIZE_STR],
latest_windows[TEMPLATE_LABELS_STR], latest_windows[OS_VERSION_STR]) so a
KeyError is raised immediately at fixture creation instead of producing opaque
failures later in create_windows_vm_from_dv_template, wait_for_windows_vm, or
write_file_windows_vm_for_oadp; update all occurrences in the fixture
accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 12ba0557-57a1-45e6-84ca-049aa8eb3e33

📥 Commits

Reviewing files that changed from the base of the PR and between 11b3496 and 89350eb.

📒 Files selected for processing (6)
  • tests/data_protection/oadp/conftest.py
  • tests/data_protection/oadp/test_velero.py
  • tests/data_protection/oadp/utils.py
  • tests/storage/storage_migration/test_storage_class_migration.py
  • tests/storage/storage_migration/utils.py
  • utilities/virt.py
💤 Files with no reviewable changes (1)
  • tests/storage/storage_migration/utils.py

coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 28, 2026
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.

6 participants