Skip to content

Storage: Add windows OADP test#4603

Merged
rnetser merged 5 commits intoRedHatQE:mainfrom
dalia-frank:oadp-windows-backup-restore
May 6, 2026
Merged

Storage: Add windows OADP test#4603
rnetser merged 5 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 Windows VM backup and restore test scenarios for OADP without Data Mover, including validation of backup integrity and restore operations.
  • Refactor

    • Consolidated Windows VM file operation utilities into shared modules to reduce code duplication and improve reusability across test suites.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR consolidates Windows VM file handling utilities by migrating verify_file_in_windows_vm from storage migration tests to a centralized utilities/storage.py module, while introducing new OADP-specific test infrastructure with fixtures for Windows VM backup/restore validation without Data Mover, including DPA Velero image override and marker file verification capabilities.

Changes

Cohort / File(s) Summary
OADP Test Infrastructure
tests/data_protection/oadp/conftest.py, tests/data_protection/oadp/test_velero.py
Introduces dpa_velero_image_override fixture for temporary DPA image override, windows_vm_with_data_volume_template fixture provisioning a Windows VM with registry-backed data volume, and velero_backup_first_namespace_without_datamover/velero_restore_first_namespace_without_datamover fixtures for backup/restore workflows. Adds new tier3 Windows VM backup/restore test validating marker file existence and content at a predefined Windows path.
OADP Utilities
tests/data_protection/oadp/utils.py
Adds constants (FILE_PATH_FOR_WINDOWS_BACKUP, OADP_DPA_NAME, OADP_VELERO_IMAGE_FQIN_OVERRIDE) and new helper write_file_windows_vm_for_oadp() for writing Windows marker files. Enhances wait_for_restored_dv() with explicit DataVolume typing and -> None return annotation.
Centralized Windows Utilities
utilities/storage.py
Adds write_file_windows_vm() helper executing PowerShell commands over SSH to write/append file content, and verify_file_in_windows_vm() helper fetching and validating Windows file contents via PowerShell with exact equality assertion.
Storage Migration Refactoring
tests/storage/storage_migration/test_storage_class_migration.py, tests/storage/storage_migration/utils.py, tests/storage/storage_migration/conftest.py
Relocates verify_file_in_windows_vm() from local storage migration utils to centralized utilities.storage. Updates test import to reference new location. Refactors pre-migration file-writing fixture to delegate to write_file_windows_vm() helper instead of inline PowerShell construction.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.89% 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 accurately summarizes the main change: adding Windows OADP (backup/restore) tests. It's concise and clearly indicates the primary purpose of the changeset.
Description check ✅ Passed The description follows the required template with all sections completed: short description, more details, what/why, fixed issues, special notes, and Jira ticket URL. It provides clear context about Windows backup/restore enablement and references the blocking issue resolution.
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

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.67%. Comparing base (b4ad2e0) to head (2f3946a).
⚠️ Report is 131 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4603      +/-   ##
==========================================
+ Coverage   98.63%   98.67%   +0.03%     
==========================================
  Files          25       25              
  Lines        2420     2483      +63     
==========================================
+ Hits         2387     2450      +63     
  Misses         33       33              
Flag Coverage Δ
utilities 98.67% <ø> (+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

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: 2

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

22-29: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

HIGH: Add Google-format docstrings for the two public side-effect helpers.

Line 22 (wait_for_restored_dv) and Line 27 (write_file_windows_vm_for_oadp) are public helpers with side effects but don’t provide required Google-format docstrings (Args, and side-effect/behavior context).

Proposed fix
 def wait_for_restored_dv(dv: DataVolume) -> None:
+    """Wait until a restored DataVolume is usable.
+
+    Args:
+        dv: Restored DataVolume to validate.
+
+    Side effects:
+        Blocks until the bound PVC status and DV success state are reached.
+    """
     dv.pvc.wait_for_status(status=PersistentVolumeClaim.Status.BOUND, timeout=TIMEOUT_15SEC)
     dv.wait_for_dv_success(timeout=TIMEOUT_10SEC)
@@
 def write_file_windows_vm_for_oadp(vm: VirtualMachineForTests) -> None:
-    """Write test data to marker file on Windows VM for OADP backup verification."""
+    """Write OADP marker content to a Windows VM before backup.
+
+    Args:
+        vm: Windows VM that should contain the backup marker file.
+
+    Side effects:
+        Writes `TEXT_TO_TEST` into `FILE_PATH_FOR_WINDOWS_BACKUP` on the guest.
+    """
     write_file_windows_vm(vm=vm, file_path=FILE_PATH_FOR_WINDOWS_BACKUP, content=TEXT_TO_TEST)

As per coding guidelines, "Google-format docstrings are REQUIRED for all public functions with non-obvious return values OR side effects".

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

In `@tests/data_protection/oadp/utils.py` around lines 22 - 29, Add Google-style
docstrings to the public helper functions wait_for_restored_dv and
write_file_windows_vm_for_oadp: for wait_for_restored_dv document the function
purpose, Args (dv: DataVolume), behavior/side effects (waits for PVC to be BOUND
and for DV restore success), and any exceptions/timeouts; for
write_file_windows_vm_for_oadp document purpose, Args (vm:
VirtualMachineForTests), behavior/side effects (writes TEXT_TO_TEST to
FILE_PATH_FOR_WINDOWS_BACKUP on the VM), and note any return value (None) and
potential errors/timeouts so the docstrings follow the required Google format.
🤖 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 55-62: After applying the unsupportedOverrides patch to the
DataProtectionApplication (dpa) with ResourceEditor, block until the Velero pods
have rolled out the new image and likewise block again after the patch is
reverted; implement this by using timeout_sampler to poll the Velero
deployment/pods in the same namespace for the container image to equal
OADP_VELERO_IMAGE_FQIN_OVERRIDE (after entering the ResourceEditor context) and
to equal the original image (after exiting/reverting), rather than sleeping;
reference the DataProtectionApplication/dpa and ResourceEditor in your changes
and use timeout_sampler from the timeout_sampler package for both pre-yield and
post-teardown wait loops.

In `@utilities/storage.py`:
- Around line 658-659: The write_file_windows_vm implementation is building cmd
with shlex.split and interpolating file_path unquoted, which breaks on paths
with spaces; update the function to build cmd as a list (like
verify_file_in_windows_vm does) using PowerShell's -LiteralPath with the
file_path wrapped in single quotes and pass the content safely (e.g., as a
quoted string argument or separate list element) so run_ssh_commands receives a
proper argument array (modify the cmd variable construction and the
run_ssh_commands call in write_file_windows_vm to mirror the pattern used in
verify_file_in_windows_vm).

---

Duplicate comments:
In `@tests/data_protection/oadp/utils.py`:
- Around line 22-29: Add Google-style docstrings to the public helper functions
wait_for_restored_dv and write_file_windows_vm_for_oadp: for
wait_for_restored_dv document the function purpose, Args (dv: DataVolume),
behavior/side effects (waits for PVC to be BOUND and for DV restore success),
and any exceptions/timeouts; for write_file_windows_vm_for_oadp document
purpose, Args (vm: VirtualMachineForTests), behavior/side effects (writes
TEXT_TO_TEST to FILE_PATH_FOR_WINDOWS_BACKUP on the VM), and note any return
value (None) and potential errors/timeouts so the docstrings follow the required
Google format.
🪄 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: cdc5233e-56ff-47e7-9d6b-7a02e8ea5149

📥 Commits

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

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

Comment thread tests/data_protection/oadp/conftest.py Outdated
Comment thread utilities/storage.py
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 5, 2026
Comment thread tests/data_protection/oadp/conftest.py Outdated
Comment thread tests/data_protection/oadp/utils.py Outdated
Comment thread utilities/storage.py Outdated
Comment thread tests/data_protection/oadp/conftest.py Outdated
Comment thread tests/data_protection/oadp/conftest.py Outdated
@jpeimer
Copy link
Copy Markdown
Contributor

jpeimer commented May 5, 2026

/approve
/lgtm

@dalia-frank
Copy link
Copy Markdown
Contributor Author

/verified

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

@coderabbitai

Test execution plan request details

CRITICAL: You MUST post an inline review comment on the first changed line of the first file.
The inline comment should contain the Test Execution Plan with the smoke tests recommendation.
Do NOT submit a formal review - just post the inline comment directly.

As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan.
You will post an inline review comment with the test execution plan on the first changed file.
If you fail to run or post a comment, retry.

Analysis Requirements:

  1. Examine code changes in each modified file
  2. Identify affected code paths, functions, and classes
  3. Analyze pytest-specific elements: fixtures (scope, dependencies), parametrization, markers, conftest changes
  4. Trace test dependencies through imports, shared utilities, and fixture inheritance
  5. Detect new tests introduced in the PR
  6. Smoke Test Impact Analysis: Determine if any changes could affect smoke tests by checking:
    • Changes to files/functions used by tests marked with @pytest.mark.smoke
    • Changes to fixtures or utilities imported by smoke tests
    • Changes to conftest.py files that may affect smoke test execution
    • Changes to core infrastructure code (utilities/, libs/) that smoke tests depend on

Your deliverable:
Your change request comment will be based on the following requirements:

Test Execution Plan

  • Run smoke tests: True / False (Based on your smoke test impact analysis - True if any changes may affect smoke tests)
  • path/to/test_file.py - When the entire test file needs verification
  • path/to/test_file.py::TestClass::test_method - When specific test(s) needed
  • path/to/test_file.py::test_function - When specific test(s) needed
  • -m marker - When specific marker(s) can be used to cover multiple cases.

Guidelines:

  • Include only tests directly affected by the changes
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name if only specific tests are needed
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal

Hardware-Related Checks (SR-IOV, GPU, DPDK):

When PR modifies fixtures for hardware-specific resources:

  • Collection Safety: Fixtures MUST have existence checks (return None when hardware unavailable)
  • Test Plan: MUST verify both WITH and WITHOUT hardware:
    • Run affected tests on cluster WITH hardware
    • Verify collection succeeds on cluster WITHOUT hardware

CRITICAL WORKFLOW COMPLETION RULES:

When responding to this test execution plan request, you MUST follow these rules EXACTLY:

  1. YOUR ONLY DELIVERABLE: Post an inline review comment containing the test execution plan on the first changed line
  2. THEN STOP IMMEDIATELY - Do NOT generate any additional response
  3. FALLBACK ONLY: If submitting the review fails after retrying, post as a regular PR comment
  4. SILENCE = SUCCESS: After successfully submitting the review, your task is complete. No confirmation needed.

ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):

  • ❌ Do NOT post acknowledgment messages like "Test execution plan posted", "Review posted successfully", "I've successfully posted"
  • ❌ Do NOT mention review IDs, URLs, or confirmation of posting in the PR thread
  • ❌ Do NOT add any follow-up comments after submitting the review
  • ❌ Do NOT reply to confirm task completion
  • ❌ Do NOT explain what you did - just do it and stop

Remember: The pull request review is visible to users. Additional comments are redundant noise.

CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to:
- Trace the actual fixture dependency chain from smoke tests to changed fixtures
- Verify that smoke tests actually import/use changed utilities or functions
- Confirm the dependency path exists; do NOT assume based on scope or semantics
- Be conservative: Session-scoped fixtures or infrastructure-sounding names do NOT
automatically mean smoke test impact. Only flag smoke test impact when you can
demonstrate a concrete dependency path.
WRONG: "This session-scoped storage fixture might affect smoke tests"
RIGHT: "Smoke test X uses fixture Y, which depends on the changed fixture Z"

Comment thread tests/data_protection/oadp/conftest.py
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find all smoke-marked tests and check if they depend on utilities/storage.py
echo "=== Smoke tests using utilities/storage ==="
rg -l "pytest.mark.smoke" --type=py | xargs -I{} sh -c 'rg -l "from utilities.storage|from utilities import storage|utilities\.storage" {} 2>/dev/null && echo {}'

echo ""
echo "=== Files importing utilities/storage ==="
rg -rn "from utilities.storage import|from utilities import.*storage" --type=py -l

echo ""
echo "=== Smoke tests that import write_file_windows_vm or verify_file_in_windows_vm ==="
rg -rn "write_file_windows_vm\|verify_file_in_windows_vm" --type=py

echo ""
echo "=== First changed file and line numbers ==="
git diff origin/main...HEAD --name-only | head -5

echo ""
echo "=== First few lines of diff for first changed file ==="
git diff origin/main...HEAD -- "tests/data_protection/oadp/conftest.py" | head -40

echo ""
echo "=== Smoke tests in storage_migration tests ==="
rg -n "pytest.mark.smoke" tests/storage/storage_migration/ 2>/dev/null

echo ""
echo "=== Smoke tests in OADP tests ==="
rg -n "pytest.mark.smoke" tests/data_protection/oadp/ 2>/dev/null

echo ""
echo "=== Check if utilities/storage.py functions are used by smoke tests ==="
rg -rn "pytest.mark.smoke" --type=py -l | head -20

Length of output: 6883


🏁 Script executed:

#!/bin/bash
# Get the PR details to find the commit SHA for inline review comment
gh pr view 4603 --repo RedHatQE/openshift-virtualization-tests --json headRefOid,number

# Post inline review comment on first changed line (line 4) of tests/data_protection/oadp/conftest.py
gh api \
  --method POST \
  -H "Accept: application/vnd.github+json" \
  /repos/RedHatQE/openshift-virtualization-tests/pulls/4603/reviews \
  --input - << 'EOF'
{
  "event": "COMMENT",
  "comments": [
    {
      "path": "tests/data_protection/oadp/conftest.py",
      "line": 4,
      "side": "RIGHT",
      "body": "## Test Execution Plan\n\n- **Run smoke tests: False**\n  - No smoke tests exist in OADP or `storage_migration` directories.\n  - The new `write_file_windows_vm` / `verify_file_in_windows_vm` helpers added to `utilities/storage.py` are not imported by any smoke-marked test — no concrete dependency path exists.\n\n### Tests to run\n\n- `tests/data_protection/oadp/test_velero.py::test_backup_and_restore_windows_vm`\n  New Windows OADP backup/restore test — primary deliverable of this PR.\n\n- `tests/storage/storage_migration/test_storage_class_migration.py`\n  Import source of `verify_file_in_windows_vm` was changed from `tests.storage.storage_migration.utils` → `utilities.storage`; full file needed to confirm no runtime import errors."
    }
  ]
}
EOF

Length of output: 1807


Dalia Frank and others added 5 commits May 5, 2026 19:45
`

Signed-off-by: Dalia Frank <dafrank@redhat.com>
Switch from Template-based VM creation to modern InstanceType/Preference:
- Use VirtualMachineClusterInstancetype (u1.large)
- Use VirtualMachineClusterPreference (windows.2k22) for vTPM support
- Change DataVolume source from HTTP to registry container disk
- Remove unused modern_cpu_for_migration parameter

Consolidate Windows file operations into shared utilities:
- Add write_file_windows_vm() to utilities/storage.py with retry
- Move verify_file_in_windows_vm() from virt.py to storage.py with retry
- Update all imports in test files

Document DPA Velero workaround:
- Add comment referencing velero-io/velero#9601
- Workaround still needed until fix merges into OADP 1.6

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Dalia Frank <dafrank@redhat.com>
Reduce DataVolume wait timeout from 60 min to 30 min (default):
- Registry container disks are faster than HTTP source
- Other OADP tests (RHEL) use default 30 min timeout
- Test passed with reduced timeout

Remove unused TIMEOUT_60MIN import.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Dalia Frank <dafrank@redhat.com>
Signed-off-by: Dalia Frank <dafrank@redhat.com>
- Use shlex.split() in verify_file_in_windows_vm for consistency
- Replace hardcoded "u1.large" with U1_LARGE constant
- Remove unnecessary disk_type=None parameter
- Remove write_file_windows_vm_for_oadp wrapper, use write_file_windows_vm directly
- Fix line length issue (E501)

Signed-off-by: Dalia Frank <dafrank@redhat.com>
@openshift-virtualization-qe-bot-5
Copy link
Copy Markdown

Clean rebase detected — no code changes compared to previous head (cf35cdb).
The following labels were preserved: verified, approved-jpeimer, lgtm-jpeimer, commented-coderabbitai[bot], lgtm-coderabbitai[bot].

@rnetser
Copy link
Copy Markdown
Collaborator

rnetser commented May 6, 2026

/approve

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

New container for quay.io/openshift-cnv/openshift-virtualization-tests:latest published

Comment on lines +162 to +202
"""Windows 2022 VM with InstanceType and Preference in the backup namespace for OADP backup testing."""
artifactory_secret = None
artifactory_config_map = None

try:
artifactory_secret = get_artifactory_secret(namespace=namespace_for_backup.name)
artifactory_config_map = get_artifactory_config_map(namespace=namespace_for_backup.name)

dv = DataVolume(
name="oadp-windows-dv",
namespace=namespace_for_backup.name,
storage_class=snapshot_storage_class_name_scope_module,
source="registry",
url=(
f"{get_test_artifact_server_url(schema='registry')}/"
f"{py_config['latest_windows_os_dict'][CONTAINER_DISK_IMAGE_PATH_STR]}"
),
size=Images.Windows.CONTAINER_DISK_DV_SIZE,
client=admin_client,
api_name="storage",
secret=artifactory_secret,
cert_configmap=artifactory_config_map.name,
)
dv.to_dict()

with VirtualMachineForTests(
name="oadp-windows-vm",
namespace=namespace_for_backup.name,
client=admin_client,
vm_instance_type=VirtualMachineClusterInstancetype(client=admin_client, name=U1_LARGE),
vm_preference=VirtualMachineClusterPreference(client=admin_client, name="windows.2k22"),
data_volume_template=dv.res,
os_flavor=OS_FLAVOR_WIN_CONTAINER_DISK,
) as vm:
running_vm(vm=vm)
write_file_windows_vm(vm=vm, file_path=FILE_PATH_FOR_WINDOWS_BACKUP, content=TEXT_TO_TEST)
yield vm
finally:
cleanup_artifactory_secret_and_config_map(
artifactory_secret=artifactory_secret, artifactory_config_map=artifactory_config_map
)
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.

Which errors are you catching? The secret and config map get or the DV and/or VM creation?

The try blocks should usually be very specific.

So something like:

try:
    artifactory_secret = get_artifactory_secret(namespace=namespace_for_backup.name)
    artifactory_config_map = get_artifactory_config_map(namespace=namespace_for_backup.name)
else:
    # DV and VM creation here.
finally:
    # Artifactory cleanup here

Let me know if I misinterpreted something.

@weshayutin
Copy link
Copy Markdown

Where are the logs this testing? Perhaps this is something that can only run internal?

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.