Skip to content

[Storage] refactor snapshots test to use win 2k22 and vtpm#4687

Open
acinko-rh wants to merge 16 commits into
RedHatQE:mainfrom
acinko-rh:add_vtpm_to_win_machines_snapshots
Open

[Storage] refactor snapshots test to use win 2k22 and vtpm#4687
acinko-rh wants to merge 16 commits into
RedHatQE:mainfrom
acinko-rh:add_vtpm_to_win_machines_snapshots

Conversation

@acinko-rh
Copy link
Copy Markdown
Contributor

@acinko-rh acinko-rh commented Apr 30, 2026

Short description:

Refactor snapshots module to use Win 2k22 with vTPM.

More details:

Using registry image of Windows 2022 with preference and instance types to create a VM with vTPM for the tests.

What this PR does / why we need it:

Many customers are using Windows 2022 with vTPM and we need to reflect it in our testing.

Which issue(s) this PR fixes:

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

Special notes for reviewer:

Co-Authored: Claude Code

jira-ticket:

Summary by CodeRabbit

  • Tests
    • Windows snapshot and restore tests now run against VTpm-enabled Windows Server 2022 VMs; online-restore and in-snapshot file-write scenarios updated and marked as tier tests.
  • Chores
    • Test fixtures and helpers renamed/simplified to use VTpm-enabled Windows 2022 flows; legacy Windows Server 2019 VM helper removed.
  • Other
    • Added a Windows Server 2022 preference constant.

@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 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.65%. Comparing base (a2dc143) to head (8d22cf3).
⚠️ Report is 78 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4687      +/-   ##
==========================================
- Coverage   98.67%   98.65%   -0.02%     
==========================================
  Files          25       25              
  Lines        2487     2457      -30     
==========================================
- Hits         2454     2424      -30     
  Misses         33       33              
Flag Coverage Δ
utilities 98.65% <100.00%> (-0.02%) ⬇️

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.

@acinko-rh
Copy link
Copy Markdown
Contributor Author

/wip

@openshift-virtualization-qe-bot-5 openshift-virtualization-qe-bot-5 changed the title [Storage] refactor snapshots test to use win 2k22 and vtpm WIP: [Storage] refactor snapshots test to use win 2k22 and vtpm Apr 30, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c2dc3872-d2ac-40ce-a32c-9c9322d3c64f

📥 Commits

Reviewing files that changed from the base of the PR and between 637a20a and 8d22cf3.

📒 Files selected for processing (6)
  • tests/storage/snapshots/conftest.py
  • tests/storage/snapshots/test_snapshots.py
  • tests/storage/test_hotplug.py
  • tests/storage/utils.py
  • tests/utils.py
  • utilities/constants.py

📝 Walkthrough

Walkthrough

Replace legacy Windows-2019 snapshot fixtures with VTpm-enabled Windows 2022 DV-template fixtures; update downstream snapshot fixtures/tests, rename registry-based helpers to template variants, remove the old create_windows19_vm helper, and add a WINDOWS_2K22_PREFERENCE constant.

Changes

Windows Snapshot Test Fixture Migration

Layer / File(s) Summary
Constants & imports
utilities/constants.py, tests/storage/snapshots/conftest.py, tests/storage/utils.py, tests/utils.py
Add WINDOWS_2K22_PREFERENCE and update imports to use new registry/template helpers and timeout/SSH utilities.
Core Fixture Implementation
tests/storage/snapshots/conftest.py (windows_dv_template_from_registry, windows_vm_with_vtpm_for_snapshot)
Add fixtures that create a Windows DV template from registry and a vTPM-enabled Windows VM from that template, apply modern CPU model, wait for Windows readiness, and yield the running VM.
Snapshot wiring & cleanup
tests/storage/snapshots/conftest.py (snapshot helpers)
Rewire snapshot_windows_directory, windows_snapshot, snapshot_dirctory_removed, and file_created_during_snapshot to use the new vTPM fixture; perform SSH directory/file ops, create VirtualMachineSnapshot objects and wait for readiness; stop the VM after checks.
Test implementations
tests/storage/snapshots/test_snapshots.py
Update tests to parameterize and accept windows_vm_with_vtpm_for_snapshot, restore/start VMs after restore, and assert WINDOWS_DIRECTORY_PATH. Add @pytest.mark.tier3 to affected tests.
Hotplug & utils renames
tests/storage/test_hotplug.py, tests/utils.py, tests/storage/utils.py
Rename registry helpers to *_dv_template_from_registry and create_windows2022_vm_with_vtpm, change dv_dictdv_template, pass data_volume_template=dv_template when constructing VMs, and remove create_windows19_vm.

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • josemacassan
  • ema-aka-young
  • kgoldbla
  • geetikakay
  • rnetser
  • vsibirsk
  • RoniKishner
  • dshchedr
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: refactoring snapshots tests to use Windows 2022 with vTPM, which is the central objective of this PR.
Description check ✅ Passed The description covers all required template sections: what the PR does (refactor to Win 2k22 with vTPM), why it's needed (customers use this config), the issue fixed (CNV-51351), and includes a note about co-authorship.
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.
Stp Link Required ✅ Passed No new test files or test functions added. All tests in test_snapshots.py existed in main; only parameters/decorators were modified.

✏️ 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-4
Copy link
Copy Markdown

Clean rebase detected — no code changes compared to previous head (25e81ae).

Signed-off-by: Adam Cinko <acinko@redhat.com>
@acinko-rh
Copy link
Copy Markdown
Contributor Author

made a mild refactor of the helper function names and their reference fix so it doesn't break any other tests (currently only test_hotplug.py

@acinko-rh
Copy link
Copy Markdown
Contributor Author

/wip cancel

Signed-off-by: Adam Cinko <acinko@redhat.com>
@josemacassan
Copy link
Copy Markdown
Contributor

/lgtm

@ema-aka-young
Copy link
Copy Markdown
Contributor

Remember to update the PR description to make coderabbit and reviewers happier :)
/lgtm

@acinko-rh
Copy link
Copy Markdown
Contributor Author

@ema-aka-young done, thx for pointing it out

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

/retest all

Auto-triggered: Files in this PR were modified by merged PR #4727.

Overlapping files

tests/storage/utils.py

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

/retest all

Auto-triggered: Files in this PR were modified by merged PR #4954.

Overlapping files

tests/utils.py

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

Clean rebase detected — no code changes compared to previous head (a05c432).

@josemacassan
Copy link
Copy Markdown
Contributor

/lgtm

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

Clean rebase detected — no code changes compared to previous head (a985f97).

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

Clean rebase detected — no code changes compared to previous head (88dc37e).
The following labels were preserved: lgtm-josemacassan, lgtm-ema-aka-young.

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

🤖 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/snapshots/conftest.py`:
- Around line 53-60: The fixture windows_dv_template_from_registry
unconditionally reads request.param["dv_name"] but
test_write_to_file_while_snapshot does not indirect-parametrize it, causing a
missing request.param; fix by making the test parametrize
windows_dv_template_from_registry as well (add it to the
`@pytest.mark.parametrize`(..., indirect=True) list with the dv_name dict) or
refactor to extract a separate parametrized dv_name fixture consumed by both
windows_dv_template_from_registry and windows_vm_with_vtpm_for_snapshot so
neither fixture reads request.param directly; update references to
create_windows2022_dv_template_from_registry accordingly.

In `@tests/storage/utils.py`:
- Around line 300-314: Before starting dv.watcher, check the current DataVolume
conditions on dv (e.g., (dv.status or {}).get("conditions", [])) using the same
message-match logic as inside the loop and return early if the expected_message
is already present; keep the existing variables (last_conditions, deleted) and
behavior otherwise so the subsequent watcher loop only handles future events and
avoids false negatives and DataVolumeConditionMessageNotFoundError.

In `@tests/utils.py`:
- Line 760: Update the docstring to reference the actual parameter name
dv_template (not dv_dict) wherever the parameter is described; locate the
function or helper in tests/utils.py that declares dv_template (the parameter
named dv_template on or around line 750) and replace occurrences of dv_dict in
the docstring with dv_template so the docstring and parameter list match.

In `@utilities/constants.py`:
- Around line 962-964: Remove the duplicate WINDOWS_2K22_PREFERENCE assignment
and rely on the existing WINDOWS_2K22_PREFERENCE definition already present in
the file; specifically, keep WINDOWS_11_PREFERENCE as defined here but delete
the second WINDOWS_2K22_PREFERENCE line so there is a single source of truth for
WINDOWS_2K22_PREFERENCE (do not redefine or shadow it).
🪄 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: c2dc3872-d2ac-40ce-a32c-9c9322d3c64f

📥 Commits

Reviewing files that changed from the base of the PR and between 637a20a and 8d22cf3.

📒 Files selected for processing (6)
  • tests/storage/snapshots/conftest.py
  • tests/storage/snapshots/test_snapshots.py
  • tests/storage/test_hotplug.py
  • tests/storage/utils.py
  • tests/utils.py
  • utilities/constants.py

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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 4

🤖 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/snapshots/conftest.py`:
- Around line 53-60: The fixture windows_dv_template_from_registry
unconditionally reads request.param["dv_name"] but
test_write_to_file_while_snapshot does not indirect-parametrize it, causing a
missing request.param; fix by making the test parametrize
windows_dv_template_from_registry as well (add it to the
`@pytest.mark.parametrize`(..., indirect=True) list with the dv_name dict) or
refactor to extract a separate parametrized dv_name fixture consumed by both
windows_dv_template_from_registry and windows_vm_with_vtpm_for_snapshot so
neither fixture reads request.param directly; update references to
create_windows2022_dv_template_from_registry accordingly.

In `@tests/storage/utils.py`:
- Around line 300-314: Before starting dv.watcher, check the current DataVolume
conditions on dv (e.g., (dv.status or {}).get("conditions", [])) using the same
message-match logic as inside the loop and return early if the expected_message
is already present; keep the existing variables (last_conditions, deleted) and
behavior otherwise so the subsequent watcher loop only handles future events and
avoids false negatives and DataVolumeConditionMessageNotFoundError.

In `@tests/utils.py`:
- Line 760: Update the docstring to reference the actual parameter name
dv_template (not dv_dict) wherever the parameter is described; locate the
function or helper in tests/utils.py that declares dv_template (the parameter
named dv_template on or around line 750) and replace occurrences of dv_dict in
the docstring with dv_template so the docstring and parameter list match.

In `@utilities/constants.py`:
- Around line 962-964: Remove the duplicate WINDOWS_2K22_PREFERENCE assignment
and rely on the existing WINDOWS_2K22_PREFERENCE definition already present in
the file; specifically, keep WINDOWS_11_PREFERENCE as defined here but delete
the second WINDOWS_2K22_PREFERENCE line so there is a single source of truth for
WINDOWS_2K22_PREFERENCE (do not redefine or shadow it).
🪄 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: c2dc3872-d2ac-40ce-a32c-9c9322d3c64f

📥 Commits

Reviewing files that changed from the base of the PR and between 637a20a and 8d22cf3.

📒 Files selected for processing (6)
  • tests/storage/snapshots/conftest.py
  • tests/storage/snapshots/test_snapshots.py
  • tests/storage/test_hotplug.py
  • tests/storage/utils.py
  • tests/utils.py
  • utilities/constants.py
📜 Review details
🔇 Additional comments (7)
tests/utils.py (2)

704-746: LGTM!


7-7: LGTM!

Also applies to: 22-23, 552-556

tests/storage/snapshots/test_snapshots.py (2)

400-428: LGTM!


431-453: LGTM!

tests/storage/test_hotplug.py (3)

14-14: LGTM!


75-87: LGTM!


91-105: LGTM!

🛑 Comments failed to post (4)
tests/storage/snapshots/conftest.py (1)

53-60: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify which fixture is actually parametrized in the snapshot tests.
# Expected: if only `windows_vm_with_vtpm_for_snapshot` is parametrized,
# then `request.param` is unavailable inside `windows_dv_template_from_registry`.

rg -n -C3 'windows_vm_with_vtpm_for_snapshot|windows_dv_template_from_registry|parametrize\(' tests/storage/snapshots

Repository: RedHatQE/openshift-virtualization-tests

Length of output: 13014


🏁 Script executed:

#!/bin/bash
set -euo pipefail
# 1) Inspect fixture implementation around the reported lines
nl -ba tests/storage/snapshots/conftest.py | sed -n '1,140p'

# 2) Inspect the test parametrizations around the indirect usage
nl -ba tests/storage/snapshots/test_snapshots.py | sed -n '360,520p'

Repository: RedHatQE/openshift-virtualization-tests

Length of output: 126


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== tests/storage/snapshots/conftest.py (top + fixtures) ==="
cat -n tests/storage/snapshots/conftest.py | sed -n '1,160p'

echo "=== tests/storage/snapshots/test_snapshots.py (indirect parametrization) ==="
cat -n tests/storage/snapshots/test_snapshots.py | sed -n '350,480p'

Repository: RedHatQE/openshift-virtualization-tests

Length of output: 9115


🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n "windows_dv_template_from_registry" tests/storage/snapshots/test_snapshots.py

Repository: RedHatQE/openshift-virtualization-tests

Length of output: 163


🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n "parametrize\([^)]*windows_dv_template_from_registry|windows_dv_template_from_registry" tests/storage/snapshots

Repository: RedHatQE/openshift-virtualization-tests

Length of output: 521


🏁 Script executed:

#!/bin/bash
set -euo pipefail
cat -n tests/storage/snapshots/test_snapshots.py | sed -n '380,520p'

Repository: RedHatQE/openshift-virtualization-tests

Length of output: 2873


Fix indirect parametrization: windows_dv_template_from_registry reads request.param but is not parametrized in test_write_to_file_while_snapshot

windows_dv_template_from_registry unconditionally does dv_name=request.param["dv_name"]. That works for test_online_windows_vm_successful_restore (both fixtures are indirect-parametrized), but test_write_to_file_while_snapshot only indirect-parametrizes windows_vm_with_vtpm_for_snapshot, so windows_dv_template_from_registry is invoked without request.param and fixture setup will fail (typically AttributeError / missing param).

Make test_write_to_file_while_snapshot parametrize windows_dv_template_from_registry too (e.g., add it to the @pytest.mark.parametrize(..., indirect=True) list with the dv_name dict), or refactor so both fixtures share a dedicated parametrized dv_name dependency instead of each reading its own request.param.

🤖 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/snapshots/conftest.py` around lines 53 - 60, The fixture
windows_dv_template_from_registry unconditionally reads request.param["dv_name"]
but test_write_to_file_while_snapshot does not indirect-parametrize it, causing
a missing request.param; fix by making the test parametrize
windows_dv_template_from_registry as well (add it to the
`@pytest.mark.parametrize`(..., indirect=True) list with the dv_name dict) or
refactor to extract a separate parametrized dv_name fixture consumed by both
windows_dv_template_from_registry and windows_vm_with_vtpm_for_snapshot so
neither fixture reads request.param directly; update references to
create_windows2022_dv_template_from_registry accordingly.
tests/storage/utils.py (1)

300-314: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

HIGH: Check the current DV conditions before opening the watch.

This helper only looks at future watch events. If CDI has already set the target message by the time this function is called, the watch can stay quiet until timeout and raise DataVolumeConditionMessageNotFoundError even though the condition is already present. That turns fast failures into false negatives.

Suggested fix
 def wait_for_dv_condition_message(dv: DataVolume, expected_message: str, timeout: int = TIMEOUT_5MIN) -> None:
@@
     LOGGER.info(f"Watching {dv.name} for message: {expected_message} for up to {timeout} seconds.")
-    last_conditions: list[dict[str, str]] = []
+    last_conditions = (dv.instance.status or {}).get("conditions", [])
+    if any(expected_message in condition.get("message", "") for condition in last_conditions):
+        LOGGER.info(f"Found expected message in {dv.name}: {expected_message}")
+        return
+
     deleted = False
     for event in dv.watcher(timeout=timeout):
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

    LOGGER.info(f"Watching {dv.name} for message: {expected_message} for up to {timeout} seconds.")
    last_conditions = (dv.instance.status or {}).get("conditions", [])
    if any(expected_message in condition.get("message", "") for condition in last_conditions):
        LOGGER.info(f"Found expected message in {dv.name}: {expected_message}")
        return

    deleted = False
    for event in dv.watcher(timeout=timeout):
        event_type = event["type"]
        if event_type == "DELETED":
            deleted = True
            break
        if event_type not in ("ADDED", "MODIFIED"):
            LOGGER.info(f"Ignoring {event_type} event for DataVolume {dv.name}")
            continue
        last_conditions = (event["object"].status or {}).get("conditions", [])
        if any(expected_message in condition.get("message", "") for condition in last_conditions):
            LOGGER.info(f"Found expected message in {dv.name}: {expected_message}")
            return
🧰 Tools
🪛 Ruff (0.15.15)

[warning] 300-300: Logging statement uses f-string

(G004)


[warning] 309-309: Logging statement uses f-string

(G004)


[warning] 313-313: Logging statement uses f-string

(G004)

🤖 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/utils.py` around lines 300 - 314, Before starting dv.watcher,
check the current DataVolume conditions on dv (e.g., (dv.status or
{}).get("conditions", [])) using the same message-match logic as inside the loop
and return early if the expected_message is already present; keep the existing
variables (last_conditions, deleted) and behavior otherwise so the subsequent
watcher loop only handles future events and avoids false negatives and
DataVolumeConditionMessageNotFoundError.
tests/utils.py (1)

760-760: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix docstring parameter name.

The docstring references dv_dict but the actual parameter is named dv_template (line 750). Update the docstring to match the parameter name.

📝 Proposed fix
     Args:
-        dv_dict: DataVolume template dictionary with metadata and spec
+        dv_template: DataVolume template dictionary with metadata and spec
         namespace: Kubernetes namespace
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

        dv_template: DataVolume template dictionary with metadata and spec
🤖 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/utils.py` at line 760, Update the docstring to reference the actual
parameter name dv_template (not dv_dict) wherever the parameter is described;
locate the function or helper in tests/utils.py that declares dv_template (the
parameter named dv_template on or around line 750) and replace occurrences of
dv_dict in the docstring with dv_template so the docstring and parameter list
match.
utilities/constants.py (1)

962-964: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

LOW: Remove the second WINDOWS_2K22_PREFERENCE definition.

WINDOWS_2K22_PREFERENCE is already defined at Line 822, so this assignment silently shadows the first one. It works today only because both values match, but it creates an easy drift point for the VM preference contract later. Keep a single source of truth and reuse it here instead of redefining it.

🤖 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 `@utilities/constants.py` around lines 962 - 964, Remove the duplicate
WINDOWS_2K22_PREFERENCE assignment and rely on the existing
WINDOWS_2K22_PREFERENCE definition already present in the file; specifically,
keep WINDOWS_11_PREFERENCE as defined here but delete the second
WINDOWS_2K22_PREFERENCE line so there is a single source of truth for
WINDOWS_2K22_PREFERENCE (do not redefine or shadow it).

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

/retest all

Auto-triggered: Files in this PR were modified by merged PR #4916.

Overlapping files

tests/utils.py

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

/retest all

Auto-triggered: Files in this PR were modified by merged PR #5099.

Overlapping files

tests/storage/utils.py

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.

9 participants