WIP: [Storage] Windows tests should all use vTPM - module CDI Clone#4571
WIP: [Storage] Windows tests should all use vTPM - module CDI Clone#4571acinko-rh wants to merge 3 commits intoRedHatQE:mainfrom
Conversation
Co-Authored: Claude Code Signed-off-by: Adam Cinko <acinko@redhat.com>
|
/wip |
📝 WalkthroughWalkthroughAdds Windows vTPM provisioning and validation: a helper that creates Windows VMs with vTPM from cloned DataVolumes, validates guest-agent OS info, and conditionally verifies vTPM with admin privileges. Adds a tier3 test cloning a Windows 11 DV and a utility to verify vTPM at hypervisor and guest levels. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
tests/storage/utils.py (1)
541-584:⚠️ Potential issue | 🟠 Major[HIGH] Landing a helper already labeled "DEBUG ONLY - MARKED FOR DELETION" contradicts the dead-code policy.
The docstring and the trailing
# TODO: Remove - debug onlyon Line 541 announce this function is scaffolding, yet it's imported and exercised bytest_successful_vm_from_cloned_dv_windows_with_vtpmintests/storage/cdi_clone/test_clone.py. Either the verification is part of the intended coverage (then drop the "debug only" labeling and keep it properly) or it isn't (then don't merge it). Shipping code pre-flagged for deletion is how dead code quietly permanents itself in the repo.As per coding guidelines: "No dead code in Python. Every function, variable, fixture MUST be used or removed."
✂️ Suggested cleanup
-def verify_vtpm_in_windows_vm(vm, admin_client): # TODO: Remove - debug only +def verify_vtpm_in_windows_vm(vm, admin_client): """ Verify vTPM is properly configured and detected in a Windows VM. - **DEBUG ONLY - MARKED FOR DELETION** - Performs two-layer validation:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/storage/utils.py` around lines 541 - 584, The helper verify_vtpm_in_windows_vm is labelled "DEBUG ONLY - MARKED FOR DELETION" yet is referenced by test_successful_vm_from_cloned_dv_windows_with_vtpm, so remove the dead-code marker and make the function a first-class test utility: delete the "# TODO: Remove - debug only" comment, update the docstring to reflect it is an intentional test helper (remove "DEBUG ONLY"), and ensure any module exports/imports remain correct so tests continue to import verify_vtpm_in_windows_vm; alternatively, if you truly intend to delete it, remove all imports/usages (notably in tests/storage/cdi_clone/test_clone.py) and delete the function instead.tests/storage/cdi_clone/test_clone.py (1)
1-3:⚠️ Potential issue | 🟡 Minor[MEDIUM] New feature test requires an STP (or RFE/Jira epic) link in the module docstring.
The module docstring is still just
"""Clone tests""", but this PR adds a new feature test (test_successful_vm_from_cloned_dv_windows_with_vtpm) covering vTPM on cloned Windows DVs. As per coding guidelines: "Every new feature test module MUST include an STP link in the module docstring. If there is no STP, the module docstring MUST include a link to the RFE or Jira epic (not support cases) for coverage tracking." The PR description also has an empty Jira ticket field, which needs to be filled in.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/storage/cdi_clone/test_clone.py` around lines 1 - 3, The module docstring currently just says "Clone tests" but this PR adds the new feature test test_successful_vm_from_cloned_dv_windows_with_vtpm, so update the module docstring to include the required STP link (or, if none, the RFE/Jira epic URL) for coverage tracking and also populate the empty Jira ticket field in the PR description; modify the top-of-file docstring in the test module to include a one-line reference (e.g., "STP: <link>" or "RFE/Jira: <epic-link>") alongside the existing summary so automated checks and reviewers can verify the traceability.
🤖 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/storage/cdi_clone/test_clone.py`:
- Line 248: The test contains a placeholder Polarion ID in the pytest marker:
replace pytest.mark.polarion("CNV-XXXXX") in
tests/storage/cdi_clone/test_clone.py with the real Polarion/Jira ID for this
test (use the official ticket string), and update the PR description’s empty
Jira ticket field to the same ID so reporting and traceability are correct;
ensure the marker value is a non-placeholder string and re-run the
test/reporting to verify the ID appears properly.
- Around line 72-110: Move the helper
create_windows_vm_with_vtpm_validate_guest_agent_info out of the test module
into tests/storage/utils.py (next to
create_windows_vm_validate_guest_agent_info), make admin_client a required
positional argument (remove the =None default) so vTPM validation always runs,
relocate the imports to the top of the new module (import
validate_os_info_vmi_vs_windows_os from utilities.ssp, wait_for_windows_vm from
utilities.virt, and verify_vtpm_in_windows_vm from tests.storage.utils or the
correct canonical module), and remove the runtime None check (do not gate
verify_vtpm_in_windows_vm with if admin_client; call it directly). Ensure any
remaining None comparisons use identity (if x is None) when applicable.
- Line 103: The test creates the VM in a halted state
(VirtualMachine.RunStrategy.HALTED) so wait_for_windows_vm(vm=vm, ...) fails
because it immediately runs SSH; call running_vm(vm=vm) to transition the VM to
Running before calling wait_for_windows_vm. Insert a running_vm(vm=vm)
invocation inside the context manager just prior to wait_for_windows_vm
(mirroring create_windows19_vm) so the VM is started and SSH connectivity is
available.
---
Outside diff comments:
In `@tests/storage/cdi_clone/test_clone.py`:
- Around line 1-3: The module docstring currently just says "Clone tests" but
this PR adds the new feature test
test_successful_vm_from_cloned_dv_windows_with_vtpm, so update the module
docstring to include the required STP link (or, if none, the RFE/Jira epic URL)
for coverage tracking and also populate the empty Jira ticket field in the PR
description; modify the top-of-file docstring in the test module to include a
one-line reference (e.g., "STP: <link>" or "RFE/Jira: <epic-link>") alongside
the existing summary so automated checks and reviewers can verify the
traceability.
In `@tests/storage/utils.py`:
- Around line 541-584: The helper verify_vtpm_in_windows_vm is labelled "DEBUG
ONLY - MARKED FOR DELETION" yet is referenced by
test_successful_vm_from_cloned_dv_windows_with_vtpm, so remove the dead-code
marker and make the function a first-class test utility: delete the "# TODO:
Remove - debug only" comment, update the docstring to reflect it is an
intentional test helper (remove "DEBUG ONLY"), and ensure any module
exports/imports remain correct so tests continue to import
verify_vtpm_in_windows_vm; alternatively, if you truly intend to delete it,
remove all imports/usages (notably in tests/storage/cdi_clone/test_clone.py) and
delete the function instead.
🪄 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: 11e3ec8d-d6fa-4f0b-9a1f-4e1aa2980145
📒 Files selected for processing (2)
tests/storage/cdi_clone/test_clone.pytests/storage/utils.py
| def create_windows_vm_with_vtpm_validate_guest_agent_info( | ||
| dv, | ||
| namespace, | ||
| unprivileged_client, | ||
| windows_version, | ||
| admin_client=None, | ||
| ): | ||
| """ | ||
| Create Windows VM with vTPM using instance types and preferences. | ||
|
|
||
| Args: | ||
| dv: DataVolume to use for the VM | ||
| namespace: Namespace object | ||
| unprivileged_client: Client to use | ||
| windows_version: Windows version string ("11", "2k22", etc.) | ||
| admin_client: Optional admin client for vTPM validation | ||
| """ | ||
| from tests.storage.utils import validate_os_info_vmi_vs_windows_os, wait_for_windows_vm | ||
|
|
||
| # Map Windows version to preference name | ||
| preference_name = f"windows.{windows_version}" # e.g., "windows.11", "windows.2k22" | ||
|
|
||
| with VirtualMachineForTests( | ||
| name=f"vm-win-{windows_version}-vtpm", | ||
| namespace=namespace.name, | ||
| client=unprivileged_client, | ||
| os_flavor=OS_FLAVOR_WINDOWS, | ||
| vm_instance_type=VirtualMachineClusterInstancetype(name="u1.large", client=unprivileged_client), | ||
| vm_preference=VirtualMachineClusterPreference(name=preference_name, client=unprivileged_client), | ||
| data_volume_template={"metadata": dv.res["metadata"], "spec": dv.res["spec"]}, | ||
| ) as vm: | ||
| wait_for_windows_vm(vm=vm, version=windows_version, timeout=TIMEOUT_40MIN) | ||
| validate_os_info_vmi_vs_windows_os(vm=vm) | ||
|
|
||
| # Validate vTPM if admin_client provided | ||
| if admin_client: | ||
| from tests.storage.utils import verify_vtpm_in_windows_vm | ||
|
|
||
| verify_vtpm_in_windows_vm(vm=vm, admin_client=admin_client) |
There was a problem hiding this comment.
[HIGH] Helper function must not live in a test_*.py module — and its imports must not live inside its body.
Multiple guideline violations are stacking up here:
-
Helper in test file — As per coding guidelines: "conftest.py is for fixtures only. Helper functions, utility functions, and classes must NOT be defined in conftest.py or test_*.py; place them in dedicated utility modules instead." Move
create_windows_vm_with_vtpm_validate_guest_agent_infototests/storage/utils.py(right next to the siblingcreate_windows_vm_validate_guest_agent_info). -
Imports inside function body (Lines 89, 108) — As per coding guidelines: "Imports must always be at the top of the Python module. Do not import inside functions." Also,
validate_os_info_vmi_vs_windows_osoriginates fromutilities.sspandwait_for_windows_vmfromutilities.virt; importing them viatests.storage.utilsas a re-export surface is misleading. Import from the canonical modules. -
Optional vTPM validation defeats the PR's goal —
admin_client=Noneplus theif admin_client:gate makes the whole reason this helper exists (vTPM verification) conditional and invisible to the caller. The PR title is literally "Windows tests should all use vTPM". As per coding guidelines: "Function behavior MUST be controlled via explicit arguments, not hardcoded internally. No hidden side effects" and "Do not use defensive programming. Fail fast and don't hide bugs with fake defaults." Makeadmin_clienta required positional argument. -
Identity comparison for None — even if you keep the optional form, use
if admin_client is not None:. As per coding guidelines: "Use identity for None:if x is None:".
♻️ Proposed refactor (after moving to tests/storage/utils.py)
-def create_windows_vm_with_vtpm_validate_guest_agent_info(
- dv,
- namespace,
- unprivileged_client,
- windows_version,
- admin_client=None,
-):
- """
- Create Windows VM with vTPM using instance types and preferences.
-
- Args:
- dv: DataVolume to use for the VM
- namespace: Namespace object
- unprivileged_client: Client to use
- windows_version: Windows version string ("11", "2k22", etc.)
- admin_client: Optional admin client for vTPM validation
- """
- from tests.storage.utils import validate_os_info_vmi_vs_windows_os, wait_for_windows_vm
-
- # Map Windows version to preference name
- preference_name = f"windows.{windows_version}" # e.g., "windows.11", "windows.2k22"
-
- with VirtualMachineForTests(
- name=f"vm-win-{windows_version}-vtpm",
- namespace=namespace.name,
- client=unprivileged_client,
- os_flavor=OS_FLAVOR_WINDOWS,
- vm_instance_type=VirtualMachineClusterInstancetype(name="u1.large", client=unprivileged_client),
- vm_preference=VirtualMachineClusterPreference(name=preference_name, client=unprivileged_client),
- data_volume_template={"metadata": dv.res["metadata"], "spec": dv.res["spec"]},
- ) as vm:
- wait_for_windows_vm(vm=vm, version=windows_version, timeout=TIMEOUT_40MIN)
- validate_os_info_vmi_vs_windows_os(vm=vm)
-
- # Validate vTPM if admin_client provided
- if admin_client:
- from tests.storage.utils import verify_vtpm_in_windows_vm
-
- verify_vtpm_in_windows_vm(vm=vm, admin_client=admin_client)
+# In tests/storage/utils.py, with top-level imports:
+# from utilities.ssp import validate_os_info_vmi_vs_windows_os
+# from utilities.virt import VirtualMachineForTests, wait_for_windows_vm
+# from ocp_resources.virtual_machine_cluster_instancetype import VirtualMachineClusterInstancetype
+# from ocp_resources.virtual_machine_cluster_preference import VirtualMachineClusterPreference
+
+def create_windows_vm_with_vtpm_validate_guest_agent_info(
+ dv,
+ namespace,
+ unprivileged_client,
+ admin_client,
+ windows_version,
+):
+ """Create a Windows VM with vTPM via instancetype/preference and validate guest agent + vTPM.
+
+ Args:
+ dv: Cloned DataVolume whose metadata/spec seed the VM's dataVolumeTemplate.
+ namespace: Namespace where the VM is created.
+ unprivileged_client: Client used to create the VM.
+ admin_client: Admin client required for privileged VM XML access during vTPM verification.
+ windows_version: Windows version suffix (e.g. "11", "2k22") used to pick the preference.
+ """
+ with VirtualMachineForTests(
+ name=f"vm-win-{windows_version}-vtpm",
+ namespace=namespace.name,
+ client=unprivileged_client,
+ os_flavor=OS_FLAVOR_WINDOWS,
+ vm_instance_type=VirtualMachineClusterInstancetype(name="u1.large", client=unprivileged_client),
+ vm_preference=VirtualMachineClusterPreference(
+ name=f"windows.{windows_version}", client=unprivileged_client
+ ),
+ data_volume_template={"metadata": dv.res["metadata"], "spec": dv.res["spec"]},
+ ) as vm:
+ wait_for_windows_vm(vm=vm, version=windows_version, timeout=TIMEOUT_40MIN)
+ validate_os_info_vmi_vs_windows_os(vm=vm)
+ verify_vtpm_in_windows_vm(vm=vm, admin_client=admin_client)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/storage/cdi_clone/test_clone.py` around lines 72 - 110, Move the helper
create_windows_vm_with_vtpm_validate_guest_agent_info out of the test module
into tests/storage/utils.py (next to
create_windows_vm_validate_guest_agent_info), make admin_client a required
positional argument (remove the =None default) so vTPM validation always runs,
relocate the imports to the top of the new module (import
validate_os_info_vmi_vs_windows_os from utilities.ssp, wait_for_windows_vm from
utilities.virt, and verify_vtpm_in_windows_vm from tests.storage.utils or the
correct canonical module), and remove the runtime None check (do not gate
verify_vtpm_in_windows_vm with if admin_client; call it directly). Ensure any
remaining None comparisons use identity (if x is None) when applicable.
| vm_preference=VirtualMachineClusterPreference(name=preference_name, client=unprivileged_client), | ||
| data_volume_template={"metadata": dv.res["metadata"], "spec": dv.res["spec"]}, | ||
| ) as vm: | ||
| wait_for_windows_vm(vm=vm, version=windows_version, timeout=TIMEOUT_40MIN) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check whether wait_for_windows_vm starts the VM, and cross-check the sibling pattern.
ast-grep --pattern 'def wait_for_windows_vm($$$):
$$$'
echo "---"
rg -nP --type=py -C2 '\brunning_vm\s*\(|\bvm\.start\s*\(' utilities/virt.py | head -n 80Repository: RedHatQE/openshift-virtualization-tests
Length of output: 1959
🏁 Script executed:
# Get the context around line 103 in test_clone.py
cat -n tests/storage/cdi_clone/test_clone.py | sed -n '95,115p'Repository: RedHatQE/openshift-virtualization-tests
Length of output: 1140
🏁 Script executed:
# Get the sibling pattern from tests/storage/utils.py around line 375
cat -n tests/storage/utils.py | sed -n '370,385p'Repository: RedHatQE/openshift-virtualization-tests
Length of output: 781
🏁 Script executed:
# Check the full wait_for_windows_vm function to confirm it doesn't start the VM
cat -n utilities/virt.py | sed -n '1693,1710p'Repository: RedHatQE/openshift-virtualization-tests
Length of output: 739
Add running_vm(vm=vm) before wait_for_windows_vm(...).
VirtualMachineForTests creates the VM with run_strategy=VirtualMachine.RunStrategy.HALTED, so the context manager at line 102 creates a stopped VM. The wait_for_windows_vm() function does not start the VM—it immediately attempts to execute vm.ssh_exec.run_command() (utilities/virt.py:1703), which requires SSH connectivity and therefore a Running VM. Without the VM in Running state, the SSH command will fail.
The sibling helper create_windows19_vm (tests/storage/utils.py:375) explicitly calls running_vm(vm=vm) before yielding, following the same pattern. Add the same call here before line 103:
Suggested change
) as vm:
running_vm(vm=vm)
wait_for_windows_vm(vm=vm, version=windows_version, timeout=TIMEOUT_40MIN)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/storage/cdi_clone/test_clone.py` at line 103, The test creates the VM
in a halted state (VirtualMachine.RunStrategy.HALTED) so
wait_for_windows_vm(vm=vm, ...) fails because it immediately runs SSH; call
running_vm(vm=vm) to transition the VM to Running before calling
wait_for_windows_vm. Insert a running_vm(vm=vm) invocation inside the context
manager just prior to wait_for_windows_vm (mirroring create_windows19_vm) so the
VM is started and SSH connectivity is available.
| windows_version: Windows version string ("11", "2k22", etc.) | ||
| admin_client: Optional admin client for vTPM validation | ||
| """ | ||
| from tests.storage.utils import validate_os_info_vmi_vs_windows_os, wait_for_windows_vm |
There was a problem hiding this comment.
Please move imports to the beginning of the file
| namespace=namespace.name, | ||
| client=unprivileged_client, | ||
| os_flavor=OS_FLAVOR_WINDOWS, | ||
| vm_instance_type=VirtualMachineClusterInstancetype(name="u1.large", client=unprivileged_client), |
There was a problem hiding this comment.
Please use U1_LARGE constant
| vm_console.expect(pattern=file_content, timeout=TIMEOUT_20SEC) | ||
|
|
||
|
|
||
| def verify_vtpm_in_windows_vm(vm, admin_client): # TODO: Remove - debug only |
There was a problem hiding this comment.
Please mark PR as work-in-progress
/wip
| with create_dv( | ||
| client=unprivileged_client, | ||
| source="pvc", | ||
| dv_name="dv-target-win11-vtpm", | ||
| namespace=data_volume_multi_storage_scope_function.namespace, | ||
| size=data_volume_multi_storage_scope_function.size, | ||
| source_pvc=data_volume_multi_storage_scope_function.name, | ||
| storage_class=data_volume_multi_storage_scope_function.storage_class, | ||
| ) as cdv: |
There was a problem hiding this comment.
So here, you created a DV, which is cloned from data_volume_multi_storage_scope_function
| create_windows_vm_with_vtpm_validate_guest_agent_info( | ||
| dv=cdv, | ||
| namespace=namespace, | ||
| unprivileged_client=unprivileged_client, | ||
| windows_version="11", | ||
| admin_client=admin_client, | ||
| ) |
There was a problem hiding this comment.
And here, the way this function is written right now, your VM will create a new DV, which is a clone of cdv.
| { | ||
| "dv_name": "dv-source-win11-vtpm", | ||
| "source": "http", | ||
| "image": f"{Images.Windows.DIR}/{Images.Windows.WIN11_IMG}", |
There was a problem hiding this comment.
It may be better to use this image - images in the 'registry' are better maintained. And WINDOWS_2022 is more preferable than Win11.
url=f"{get_test_artifact_server_url(schema='registry')}/{WINDOWS_2022[CONTAINER_DISK_IMAGE_PATH_STR]}", (see how it's used in another test)
Signed-off-by: Adam Cinko <acinko@redhat.com>
|
/wip |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/storage/cdi_clone/test_clone.py`:
- Around line 245-248: The parametrize entry reuses Polarion ID CNV-3638 and
uses WIN11_IMG; update the test parameterization for the vTPM variant so it has
a unique Polarion ID (replace the duplicated pytest.mark.polarion("CNV-3638")
with a new, unused ID) and switch the image constant from
Images.Windows.WIN11_IMG to Images.Windows.WINDOWS_2022 in that dict; locate the
offending param set near the test_successful_vm_from_cloned_dv_windows
parametrization and also add the missing Jira ticket ID to the PR description as
requested.
🪄 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: 4ae5ffd8-49f1-4053-9b43-20bc03dede7a
📒 Files selected for processing (1)
tests/storage/cdi_clone/test_clone.py
| "image": f"{Images.Windows.DIR}/{Images.Windows.WIN11_IMG}", | ||
| "dv_size": Images.Windows.DEFAULT_DV_SIZE, | ||
| }, | ||
| marks=pytest.mark.polarion("CNV-3638"), |
There was a problem hiding this comment.
[MEDIUM/CRITICAL] Reuse of Polarion ID CNV-3638 and WIN11_IMG — see prior reviews.
Two distinct issues remain on this parametrize entry:
- Duplicate Polarion ID (CRITICAL).
CNV-3638is already attached totest_successful_vm_from_cloned_dv_windowsat line 208. Two different tests cannot share the same Polarion ID — reporting will collide and traceability is lost. Allocate a fresh Polarion ID for the vTPM variant (and fill in the empty Jira ticket field on the PR description, as previously requested). - Image choice. As previously suggested, prefer
WINDOWS_2022from the registry artifact server overWIN11_IMG— registry images are better maintained and Windows 2022 is the preferred coverage target.
- "image": f"{Images.Windows.DIR}/{Images.Windows.WIN11_IMG}",
- "dv_size": Images.Windows.DEFAULT_DV_SIZE,
+ "image": f"{Images.Windows.DIR}/{Images.Windows.WIN11_IMG}", # consider WINDOWS_2022 from registry
+ "dv_size": Images.Windows.DEFAULT_DV_SIZE,
},
- marks=pytest.mark.polarion("CNV-3638"),
+ marks=pytest.mark.polarion("CNV-<new-id>"),🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/storage/cdi_clone/test_clone.py` around lines 245 - 248, The
parametrize entry reuses Polarion ID CNV-3638 and uses WIN11_IMG; update the
test parameterization for the vTPM variant so it has a unique Polarion ID
(replace the duplicated pytest.mark.polarion("CNV-3638") with a new, unused ID)
and switch the image constant from Images.Windows.WIN11_IMG to
Images.Windows.WINDOWS_2022 in that dict; locate the offending param set near
the test_successful_vm_from_cloned_dv_windows parametrization and also add the
missing Jira ticket ID to the PR description as requested.
There was a problem hiding this comment.
the test will replace one another, I keep the duplicate for debugging so far
There was a problem hiding this comment.
@acinko-rh, understood — thanks for the context. A couple of things worth keeping in mind before this merges:
-
CRITICAL: Don't merge with the duplicate ID. If both tests land on
mainwithCNV-3638, Polarion reporting will aggregate results from two distinct tests under the same ID, which corrupts historical traceability. Please ensure the old test is removed (or gets a different ID) before merging, not after. -
Before the PR is marked
/verified, the final state should have exactly one test owningCNV-3638(or the new test gets a fresh ID). Temporary debugging duplicates are fine locally, but they shouldn't survive a merge review.
If the intent is that test_successful_vm_from_cloned_dv_windows will be deleted in this same PR once you're satisfied with the vTPM variant, that's the cleanest path — just make sure the deletion is included before the PR is approved.
🧠 Learnings used
Learnt from: rlobillo
Repo: RedHatQE/openshift-virtualization-tests PR: 2249
File: tests/install_upgrade_operators/must_gather/test_must_gather.py:428-441
Timestamp: 2025-10-16T12:47:04.521Z
Learning: In openshift-virtualization-tests repository, DataVolumes in the openshift-virtualization-os-images namespace are volatile resources managed by DataImportCron. They can be created/destroyed between must-gather collection listing and file retrieval, requiring FileNotFoundError exception handling in test_crd_resources to skip these volatile resources gracefully while still validating DataVolumes in other namespaces. There is no pytest_generate_tests hook that filters out datavolumes from test parametrization.
Learnt from: hmeir
Repo: RedHatQE/openshift-virtualization-tests PR: 3081
File: tests/install_upgrade_operators/product_install/test_install_openshift_virtualization.py:189-191
Timestamp: 2025-12-29T10:07:12.804Z
Learning: In test_ocs_virt_default_storage_class in tests/install_upgrade_operators/product_install/test_install_openshift_virtualization.py, consecutive_checks_count=3 is sufficient for verify_boot_sources_reimported because datasources update quickly in the installation lane scenario after storage class changes.
Learnt from: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 4108
File: tests/storage/cross_cluster_live_migration/test_cclm.py:88-90
Timestamp: 2026-03-09T10:25:32.742Z
Learning: In tests/storage/cross_cluster_live_migration/test_cclm.py (TestCCLMSeveralVMs), test_source_vms_can_be_deleted intentionally has NO pytest-dependency on test_migrate_vm_from_remote_to_local_cluster. This is by design: the test acts as a cleanup step to delete source VMs and must run regardless of whether the migration test passes or fails, to avoid leaving orphaned resources.
Learnt from: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 954
File: tests/storage/storage_migration/conftest.py:156-176
Timestamp: 2025-05-21T09:41:46.532Z
Learning: In the RedHatQE/openshift-virtualization-tests codebase, the pattern of calling to_dict() on a DataVolume object and then accessing dv.res to populate data_volume_template is the preferred approach rather than building the template dict explicitly.
Learnt from: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 1166
File: tests/observability/metrics/test_vms_metrics.py:129-137
Timestamp: 2025-06-18T09:19:05.769Z
Learning: For Windows VM testing in tests/observability/metrics/test_vms_metrics.py, it's acceptable to have more fixture parameters than typical pylint recommendations when reusing expensive Windows VM fixtures for performance. Windows VMs take a long time to deploy, so reusing fixtures like windows_vm_for_test and adding labels via windows_vm_with_low_bandwidth_migration_policy is preferred over creating separate fixtures that would require additional VM deployments.
Learnt from: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 1166
File: tests/observability/metrics/conftest.py:1065-1077
Timestamp: 2025-06-18T09:21:34.315Z
Learning: In tests/observability/metrics/conftest.py, when creating fixtures that modify shared Windows VM state (like changing nodeSelector), prefer using function scope rather than class scope to ensure ResourceEditor context managers properly restore the VM state after each test, maintaining test isolation while still reusing expensive Windows VM fixtures.
Learnt from: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 2014
File: tests/storage/cdi_clone/test_clone.py:0-0
Timestamp: 2025-09-10T13:25:59.799Z
Learning: In the openshift-virtualization-tests repository, when creating DataVolume objects using ocp_resources, use `api_name="storage"` rather than the default `api_name="pvc"`.
Learnt from: RoniKishner
Repo: RedHatQE/openshift-virtualization-tests PR: 1641
File: tests/infrastructure/golden_images/test_common_templates_data_volumes.py:47-48
Timestamp: 2025-08-13T06:27:29.727Z
Learning: In tests/infrastructure/golden_images/test_common_templates_data_volumes.py, when set_storage_class is True but get_diff_storage_class_from_matrix returns None (indicating only one storage class is available), the test should continue using the default storage class rather than being skipped. This covers special cluster architectures that only have a single storage class available.
Learnt from: ema-aka-young
Repo: RedHatQE/openshift-virtualization-tests PR: 4342
File: tests/storage/cdi_config/test_cdi_config.py:195-205
Timestamp: 2026-04-02T09:03:57.004Z
Learning: When calling `utilities.storage.get_dv_size_from_datasource()` in this repo, do not require an extra `None` guard for its return value if the `datasource` argument originates from a fixture that uses `ensure_exists=True` (e.g., `fedora_data_source_scope_module`). Those fixtures guarantee the datasource exists and provides a valid size, and other repo usages follow the same pattern without additional fail-fast/`None` checks; therefore, reviewers should not flag missing `None` guarding in this specific fixture-driven scenario.
Learnt from: geetikakay
Repo: RedHatQE/openshift-virtualization-tests PR: 3050
File: tests/infrastructure/golden_images/update_boot_source/test_ssp_data_import_crons.py:277-279
Timestamp: 2025-12-10T10:57:12.630Z
Learning: In tests/infrastructure/golden_images/update_boot_source/test_ssp_data_import_crons.py, the test_all_datasources_support_vm_creation method uses broad Exception catching intentionally to collect all VM creation failures across different data sources for comprehensive reporting, rather than letting specific exceptions bubble up and stop the test early.
Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4578
File: tests/network/localnet/nad_ref_change/test_nad_ref_change.py:18-18
Timestamp: 2026-04-26T11:44:20.150Z
Learning: In this repository’s STD (Standard Test Definition) PRs under `tests/**`, it’s expected that Polarion IDs may be placeholders (e.g., `pytest.mark.polarion("CNV-00000")`) while the test scenarios are still being agreed upon. If the test scenario is disabled for the moment (e.g., the scenario/module sets `__test__ = False`), reviewers should not treat placeholder Polarion IDs as a blocking issue. Real Polarion IDs should be filled in before or during the implementation PR.
Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4147
File: tests/network/upgrade/test_upgrade_network.py:166-177
Timestamp: 2026-03-19T10:36:59.023Z
Learning: In this repository’s pytest-based test files (under `tests/`), do not flag unused test method parameters/fixture arguments for removal when the parameters are intentionally kept only to enforce pytest fixture dependency ordering (e.g., an unused fixture like `bridge_on_one_node`). Treat this as an intentional convention consistent with other fixture definitions in the codebase, and do not open follow-up review issues for those unused parameters.
Learnt from: Ahmad-Hafe
Repo: RedHatQE/openshift-virtualization-tests PR: 3334
File: tests/storage/test_data_import_cron.py:212-215
Timestamp: 2026-01-06T11:47:20.240Z
Learning: In the openshift-virtualization-tests repository, when quarantining flaky tests, the team uses two separate Jira tickets: one for the quarantine action itself (referenced in the PR description) and another for tracking and investigating the underlying issue (referenced in the xfail marker reason). Both references are intentional and serve different purposes.
Learnt from: vsibirsk
Repo: RedHatQE/openshift-virtualization-tests PR: 3755
File: utilities/architecture.py:10-11
Timestamp: 2026-03-15T16:01:27.748Z
Learning: In RedHatQE/openshift-virtualization-tests (PR `#3755`), the `Images` variable in `utilities/constants.py` is initialized at import time using `next(iter(get_cluster_architecture())).upper()` as a transient placeholder only. Before any tests run, `update_cpu_arch_related_config()` in `utilities/pytest_utils.py` (called from `pytest_sessionstart`) re-assigns `constants_module.Images = getattr(constants_module.ArchImages, arch.upper())` with the correct architecture derived from `--cpu-arch` CLI option or cluster detection. Do not flag the import-time `next(iter(...))` call as nondeterministic — the authoritative assignment happens in `update_cpu_arch_related_config` before test collection/execution.
Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 1932
File: tests/virt/node/migration_and_maintenance/conftest.py:57-64
Timestamp: 2025-09-08T21:34:28.924Z
Learning: In OpenShift Virtualization tests, MigrationPolicy fixtures should use static names rather than unique suffixes to enable collision detection. If parallel test runs collide on cluster-scoped resource names like MigrationPolicy, it's better to know about the collision rather than hide it with unique naming, as confirmed by maintainer dshchedr.
Learnt from: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 4267
File: tests/storage/cross_cluster_live_migration/test_cclm.py:96-106
Timestamp: 2026-03-29T13:51:25.599Z
Learning: In this repository, follow the existing pytest convention for `pytest.mark.parametrize` argument names: use a single comma-separated string for `argnames` (e.g., `"dv_wait_timeout, vms_for_cclm"`), not a tuple (e.g., `("dv_wait_timeout", "vms_for_cclm")`). Do not flag or suggest changing `argnames` to a tuple. Also note that PT006 is not enforced by Ruff in this repo, so reviewers should not treat PT006 as a reason to alter the `argnames` format.
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 4328
File: tests/network/flat_overlay/test_multi_network_policy.py:32-32
Timestamp: 2026-04-14T16:15:33.012Z
Learning: For this repository (RedHatQE/openshift-virtualization-tests), when reviewing any PR with "Quarantine" in the title or a `quarantine` label, check compliance with `docs/QUARANTINE_GUIDELINES.md` in any affected pytest test code. Specifically: (1) For Category 1 (Product Bug), require `pytest.mark.jira("CNV-XXXXX", run=False)` and do not suggest replacing it with `xfail` (the `pytest_jira` plugin conditionally skips when the Jira issue is open). (2) For Category 2 (Automation Issue), require `pytest.mark.xfail(run=False, reason=...)` (pytest handles the skip). During review, flag quarantine PRs that use the wrong marker/category, omit a Jira ticket reference for Category 1, or use `run=False` in an incorrect context; raise these compliance questions even if later resolution confirms the marker was correct.
Learnt from: yossisegev
Repo: RedHatQE/openshift-virtualization-tests PR: 4328
File: tests/network/flat_overlay/test_multi_network_policy.py:32-32
Timestamp: 2026-04-14T13:00:57.514Z
Learning: In this repository’s pytest quarantine tests, do not flag or change `pytest.mark.jira(<id>, run=False)` as ineffective. `run=False` on `pytest.mark.jira()` is intentionally handled by the `pytest_jira` plugin, which conditionally skips the test when the referenced Jira issue is open. This is the correct behavior for **Category 1 (Product Bug)** quarantines; the `pytest.mark.xfail(run=False)` approach is reserved for **Category 2 (Automation Issue)** quarantines only (as documented in `docs/QUARANTINE_GUIDELINES.md`).
Learnt from: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2025-12-22T15:56:00.157Z
Learning: In the openshift-virtualization-tests repository, when responding to test execution plan requests from openshift-virtualization-qe-bot-3, do NOT use "REQUEST_CHANGES" review type if the PR author has already marked the PR as verified (e.g., with `/verified` command). Test execution plans are informational guides, not blocking requirements. Use COMMENT event for informational test plans, or only REQUEST_CHANGES if there are actual code issues that need to be addressed before merging.
Learnt from: RoniKishner
Repo: RedHatQE/openshift-virtualization-tests PR: 1946
File: tests/infrastructure/instance_types/supported_os/test_windows_os.py:30-31
Timestamp: 2025-09-03T07:23:37.045Z
Learning: In tests/infrastructure/instance_types/supported_os/test_windows_os.py, test_vm_deletion should depend on test_create_vm (not test_start_vm) to ensure resource cleanup happens even if the VM fails to start, preventing resource leaks in the test environment.
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 3062
File: conftest.py:333-333
Timestamp: 2025-12-16T20:11:03.645Z
Learning: In the openshift-virtualization-tests repository, when determining smoke test impact for changes affecting py_config["os_login_param"], follow this verification methodology: (1) Find all smoke tests: `rg "pytest.mark.smoke" --type=py -B2 | grep "def test_"`, (2) For each smoke test file, search for VM creation patterns: `rg "VirtualMachineForTests|running_vm|VirtualMachineForTestsFromTemplate|wait_for_ssh|check_ssh_connectivity"`, (3) Trace the dependency chain: smoke test → VirtualMachineForTests/running_vm() → wait_for_ssh_connectivity() (default enabled) → vm.login_params property → py_config["os_login_param"][vm.os_flavor], (4) Check utilities/virt.py for login_params usage: `rg "os_login_param|login_params" utilities/virt.py -C3`. Any smoke test creating VMs with default SSH connectivity checks (running_vm with check_ssh_connectivity=True) depends on os_login_param, even if the test doesn't directly reference it.
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 3062
File: conftest.py:333-333
Timestamp: 2025-12-16T15:09:49.597Z
Learning: In the openshift-virtualization-tests repository, when conftest.py or utilities/bitwarden.py changes affect py_config["os_login_param"], smoke test impact must be determined by: (1) finding all smoke tests using `rg "pytest.mark.smoke"`, (2) checking each for VM creation patterns (VirtualMachineForTests, running_vm, VirtualMachineForTestsFromTemplate), (3) tracing whether running_vm is called with default check_ssh_connectivity=True, which accesses vm.login_params property that reads py_config["os_login_param"][vm.os_flavor]. The dependency chain is: smoke test → VM creation → running_vm → wait_for_ssh_connectivity → vm.login_params → os_login_param. Any smoke test creating VMs with SSH connectivity (the default) depends on os_login_param.
Learnt from: RoniKishner
Repo: RedHatQE/openshift-virtualization-tests PR: 1946
File: tests/infrastructure/instance_types/supported_os/test_windows_os.py:27-28
Timestamp: 2025-09-03T07:22:50.446Z
Learning: In tests/infrastructure/instance_types/supported_os/test_windows_os.py, Windows guest images are configured with SSH support (likely through WSL2), so running_vm() should keep the default check_ssh_connectivity=True to verify SSH connectivity is working properly in the Windows guest images.
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 2469
File: utilities/sanity.py:139-142
Timestamp: 2025-11-08T07:36:57.616Z
Learning: In the openshift-virtualization-tests repository, user rnetser prefers to keep refactoring PRs (like PR `#2469`) strictly focused on moving/organizing code into more granular modules without adding new functionality, error handling, or behavioral changes. Such improvements should be handled in separate PRs.
Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 4118
File: utilities/database.py:0-0
Timestamp: 2026-03-17T01:32:02.617Z
Learning: In the RedHatQE/openshift-virtualization-tests repository, CodeRabbit should post targeted inline comments at each applicable location in the Files Changed tab, rather than aggregating multiple issues into a single PR discussion thread reply. This guideline applies to all Python files (any file ending in .py) changed in a PR; for non-Python files, follow the same inline-comment-at-location principle if relevant.
Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 4118
File: utilities/database.py:0-0
Timestamp: 2026-03-17T01:32:02.617Z
Learning: In RedHatQE/openshift-virtualization-tests, when reviewing Python files, post targeted inline comments on the Files changed tab at the exact location (file and line) of the issue rather than opening a single discussion thread for multiple issues. This should be done for each applicable location to improve traceability and clarity. If multiple issues exist in the same file, address them with separate inline comments pointing to the specific lines.
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2025-12-16T14:00:59.076Z
Learning: In the openshift-virtualization-tests repository, when responding to test execution plan requests from openshift-virtualization-qe-bot-3, CodeRabbit must post ONLY an inline review comment on the Files Changed tab and then stop immediately without generating any follow-up comments in the PR discussion thread. No acknowledgment messages, no confirmation of posting, no explanation - silence after posting the inline review equals success. Additional comments create empty/meaningless reviews that clutter the PR.
Learnt from: vamsikrishna-siddu
Repo: RedHatQE/openshift-virtualization-tests PR: 2199
File: tests/storage/test_online_resize.py:108-113
Timestamp: 2025-09-28T14:43:07.181Z
Learning: In the openshift-virtualization-tests repo, PR `#2199` depends on PR `#2139` which adds architecture-specific OS_FLAVOR attributes to the Images.Cirros class (OS_FLAVOR_CIRROS for x86_64/ARM64, OS_FLAVOR_FEDORA for s390x), enabling conditional logic based on the underlying OS flavor in tests.
Learnt from: vsibirsk
Repo: RedHatQE/openshift-virtualization-tests PR: 2045
File: tests/virt/cluster/vm_lifecycle/conftest.py:46-47
Timestamp: 2025-09-15T06:49:53.478Z
Learning: In the openshift-virtualization-tests repo, large fixture refactoring efforts like the golden image data source migration are handled incrementally by directory/team ownership. The virt/cluster directory is handled separately from virt/node, tests/infra, tests/storage, etc., with each area managed by relevant teams in follow-up PRs.
Learnt from: vamsikrishna-siddu
Repo: RedHatQE/openshift-virtualization-tests PR: 2199
File: tests/storage/test_online_resize.py:108-113
Timestamp: 2025-09-28T14:43:07.181Z
Learning: In the openshift-virtualization-tests repo, PR `#2199` depends on PR `#2139` which adds the OS_FLAVOR attribute to the Images.Cirros class, making Images.Cirros.OS_FLAVOR available for conditional logic in tests.
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 3228
File: .coderabbit.yaml:30-41
Timestamp: 2026-01-05T10:33:55.037Z
Learning: In the openshift-virtualization-tests repository, user rnetser prefers minimal pre-merge checks in CodeRabbit configuration: only docstrings enforcement (80% threshold) is needed, not title or description checks.
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 1723
File: conftest.py:496-502
Timestamp: 2025-08-27T12:38:26.496Z
Learning: In PR `#1723`, the user rnetser clarified that updating downstream string comparisons to handle DataVolume enums from StorageClassConfig is not part of the current PR scope, which focuses only on adding conformance storage class support.
Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 3024
File: tests/network/connectivity/utils.py:17-17
Timestamp: 2025-12-15T12:33:06.686Z
Learning: In the test suite, ensure the ipv6_network_data fixture returns a factory function (Callable) and that all call sites invoke it to obtain the actual data dict, i.e., use ipv6_network_data() at call sites. This enables future extensibility for configuring secondary interfaces' IP addresses without changing call sites. Apply this pattern to all Python test files under tests.
Learnt from: yossisegev
Repo: RedHatQE/openshift-virtualization-tests PR: 3196
File: tests/network/upgrade/test_upgrade_network.py:4-4
Timestamp: 2025-12-22T16:27:40.244Z
Learning: For PRs that remove tests, rely on pytest --collect-only to verify the test discovery results (which tests are selected/deselected) and ensure the removal is clean and the test module remains functional. Full test execution is not required for test deletion PRs. This guideline applies to test files anywhere under the tests/ directory (e.g., tests/network/upgrade/test_upgrade_network.py) and should be used for similar test-deletion scenarios across the repository.
Learnt from: yossisegev
Repo: RedHatQE/openshift-virtualization-tests PR: 3358
File: tests/network/sriov/test_sriov.py:21-21
Timestamp: 2026-01-07T09:52:12.342Z
Learning: When a PR only removes or modifies pytest markers in tests (e.g., removing pytest.mark.post_upgrade) and the test logic remains unchanged, prefer verifying with pytest --collect-only instead of running the full test suite. This validates that marker usage and test selection behavior are preserved. If the test logic changes, or markers affect behavior beyond collection, run the full test suite to confirm.
Learnt from: servolkov
Repo: RedHatQE/openshift-virtualization-tests PR: 3387
File: tests/network/provider_migration/libprovider.py:50-52
Timestamp: 2026-01-12T11:24:13.825Z
Learning: In the RedHatQE/openshift-virtualization-tests repository, when catching exceptions in Python, use LOGGER.error before re-raising and do not replace it with LOGGER.exception in except blocks. This follows the established pattern across the codebase.
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 3366
File: tests/storage/cdi_clone/test_clone.py:5-9
Timestamp: 2026-01-12T14:25:05.723Z
Learning: In Python tests and utility code across the repository, bitmath.parse_string_unsafe correctly parses Kubernetes quantities (e.g., '4Gi', '512Mi', PVC storage requests) without supplying system=bitmath.NIST. There are 30+ usages indicating this is the standard behavior. Reviewers should verify that code that builds or compares quantity strings does not pass the NIST parameter, and if a new test relies on quantity parsing, assume no NIST parameter is required unless explicitly documented.
Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 3404
File: tests/virt/upgrade/conftest.py:291-301
Timestamp: 2026-01-14T04:08:23.032Z
Learning: In the openshift-virtualization-tests repository, when using VirtualMachine objects from ocp-resources in tests, if vm.ready is True, vm.vmi is guaranteed to exist. Therefore, you can access vm.vmi.instance.status or vm.vmi attributes without additional defensive checks (e.g., if vm.vmi: ...). Do not rely on vm.vmi being present when vm.ready may be False; guard those code paths accordingly. This guideline applies to tests under tests/ (notably in virt/upgrade/conftest.py and related test modules) and should be followed for any code paths that assume vm.vmi exists only when vm.ready is True.
Learnt from: Anatw
Repo: RedHatQE/openshift-virtualization-tests PR: 3376
File: tests/network/general/test_ip_family_services.py:96-96
Timestamp: 2026-01-18T09:44:17.044Z
Learning: In the openshift-virtualization-tests repository, function-scoped fixtures must use pytest.fixture() with empty parentheses (not pytest.fixture without parentheses). This repo follows this convention despite Ruff PT001. Apply this consistently to all Python test files under tests/ (not just this one) to maintain repository-wide consistency.
Learnt from: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 3273
File: tests/network/connectivity/test_ovs_linux_bridge.py:5-9
Timestamp: 2026-01-18T13:18:48.808Z
Learning: In tests/network/connectivity/test_ovs_linux_bridge.py and similar test files, prefer importing ipaddress as a module and using qualified calls like ipaddress.ip_interface(...) rather than from ipaddress import ip_interface. This preserves module context for readability, especially when chaining properties (e.g., ipaddress.ip_interface(...).ip). This is an intentional exception to the general rule favoring specific imports, and should apply to test files under the tests directory where module context aids understanding.
Learnt from: yossisegev
Repo: RedHatQE/openshift-virtualization-tests PR: 3495
File: tests/network/third_part_ip_request/test_third_party_ip_request.py:4-12
Timestamp: 2026-01-18T14:51:50.846Z
Learning: In the openshift-virtualization-tests repository, tests consistently import pytest as a module (import pytest) and avoid from pytest import ...; this is the established pattern across 398+ test files. Do not flag or refactor imports to use specific pytest names in tests under tests/**. If a file already follows this pattern, leave it as is; this guideline applies broadly to Python test files under the tests directory.
Learnt from: servolkov
Repo: RedHatQE/openshift-virtualization-tests PR: 3387
File: tests/network/provider_migration/libprovider.py:1-8
Timestamp: 2026-01-20T01:03:13.139Z
Learning: In the openshift-virtualization-tests repository, Python imports should consistently use module-level imports for the logging module (i.e., import logging) rather than from logging import ... The established pattern spans 270+ files and should not be flagged for refactoring. Apply this guideline to Python files across the repo (e.g., tests/network/provider_migration/libprovider.py).
Learnt from: geetikakay
Repo: RedHatQE/openshift-virtualization-tests PR: 3559
File: utilities/infra.py:251-254
Timestamp: 2026-01-21T21:26:41.805Z
Learning: In the RedHatQE/openshift-virtualization-tests repository, when reviewing Python code, recognize that with Python 3.14 the syntax 'except ValueError, TypeError:' is valid if there is no 'as' clause, and should not be flagged as Python 2 syntax. If you use an 'as' binding (e.g., 'except (ValueError, TypeError) as e:'), parentheses are required. Ensure this pattern is version-consistent and not flagged as Python 2 syntax when 'as' is absent.
Learnt from: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 3571
File: tests/storage/storage_migration/utils.py:158-167
Timestamp: 2026-01-25T13:18:21.675Z
Learning: In reviews of the openshift-virtualization-tests repo (and similar Python code), avoid suggesting minor stylistic changes that require extra verification (e.g., removing dict.keys() checks for membership) unless the change has clear correctness or maintainability impact. Focus on fixes with observable behavior, security, performance, or maintainability benefits; defer low-impact style tweaks that are costly to verify.
Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 3619
File: tests/network/user_defined_network/test_user_defined_network.py:97-97
Timestamp: 2026-01-27T17:18:49.973Z
Learning: In tests that exercise lookup_iface_status_ip from libs.net.vmspec, rely on the function's built-in descriptive error messages for failures. Do not add extra assertion messages for IP presence checks using this function; instead, assert on the function behavior or catch its exceptions as appropriate. This reduces duplication and clarifies failures.
Learnt from: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 3649
File: tests/network/user_defined_network/ip_specification/libipspec.py:1-4
Timestamp: 2026-01-29T05:30:13.982Z
Learning: In the openshift-virtualization-tests repository, Python imports should use module import style for the standard library 'json' (import json) rather than 'from json import ...'. This improves readability by making calls like json.loads and json.dumps explicit, and aligns with patterns used for modules like logging, ipaddress, cloudinit, and pytest. Apply this to all Python test files under tests/ (and similar test directories).
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 3690
File: tests/after_cluster_deploy_sanity/test_after_cluster_deploy_sanity.py:65-65
Timestamp: 2026-02-02T17:41:12.759Z
Learning: In test files, keep test_* functions with simple one-line docstrings. For helper functions, utilities, and library code with non-obvious return values or side effects, use Google-style docstrings with Args, Returns, and Side effects sections. Do not require Google-style docstrings for pytest test functions themselves.
Learnt from: RoniKishner
Repo: RedHatQE/openshift-virtualization-tests PR: 3697
File: tests/infrastructure/instance_types/test_common_vm_instancetype.py:53-98
Timestamp: 2026-02-03T07:34:34.184Z
Learning: In test files (Python, pytest), prefer using tier3 markers for categorization since tier2, tier1, and tier4 are not used in this repository. Do not rely on non-official markers; formalize and document the allowed markers in pytest.ini (or equivalent) to ensure consistent usage. When reviewing new tests, ensure markers align with this convention (only tier3, unless a project-wide decision defines additional tiers) and remove any unnecessary or undocumented markers.
Learnt from: vsibirsk
Repo: RedHatQE/openshift-virtualization-tests PR: 3577
File: tests/virt/conftest.py:251-267
Timestamp: 2026-02-10T15:04:14.799Z
Learning: In Python tests, remove all bare time.sleep() calls. Replace with a waiting mechanism such as TimeoutSampler from the timeout_sampler package or a function decorated with retry (with appropriate timeout/conditions) to ensure determinism and avoid flakiness. This applies to all Python tests under the tests directory (not just this file) to maintain consistent waiting behavior across the suite.
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 3847
File: utilities/virt.py:2449-2453
Timestamp: 2026-02-18T06:35:39.536Z
Learning: In Python code, a function named clearly and self-descriptively can be deemed not to require a docstring. However, treat this as a context-specific guideline and not a universal rule. For public APIs or functions with side effects, prefer concise docstrings explaining behavior, inputs, outputs, and side effects. This guidance is based on the example in utilities/virt.py from RedHatQE/openshift-virtualization-tests where validate_libvirt_persistent_domain(vm, admin_client) was considered self-documenting.
Learnt from: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 3926
File: tests/storage/cross_cluster_live_migration/utils.py:137-156
Timestamp: 2026-02-19T15:36:04.744Z
Learning: In cross-cluster live migration (CCLM) tests vs storage-migration tests, boot-time verification uses different access methods: console-based (get_vm_boot_time_via_console) when SSH to VMs in the remote cluster is unavailable, and SSH-based (get_vm_boot_time) when VMs remain in the same cluster. Code reviews should enforce separate, clearly named verification functions for each scenario (e.g., verify_vms_boot_time_after_migration vs verify_vms_boot_time_after_storage_migration) and place them in the appropriate modules. This pattern applies to all Python test utilities under tests/storage.
Learnt from: vsibirsk
Repo: RedHatQE/openshift-virtualization-tests PR: 3883
File: utilities/unittests/test_os_utils.py:333-425
Timestamp: 2026-02-23T16:31:34.505Z
Learning: In integration/functional tests located under the tests/ directory, require assertion failure messages using the pattern: assert condition, "descriptive message". For unit tests under utilities/unittests/, rely on pytest's assertion introspection and descriptive test names; explicit failure messages are not required. This guidance helps maintain clear diagnostics for integration tests while keeping unit tests concise and leveraging pytest's built-in introspection.
Learnt from: vsibirsk
Repo: RedHatQE/openshift-virtualization-tests PR: 3883
File: utilities/pytest_utils.py:441-463
Timestamp: 2026-02-23T16:33:22.070Z
Learning: In Python code reviews, the guideline to always use named arguments for multi-argument calls does not apply to built-ins or methods that have positional-only parameters (those defined with a / in their signature). Do not flag or require named arguments for calls like dict.get(key, default=None, /), list.pop(), str.split(sep, maxsplit) and similar built-ins that cannot accept keyword arguments. Apply the named-argument rule only to functions/methods that explicitly accept keyword arguments.
Learnt from: yossisegev
Repo: RedHatQE/openshift-virtualization-tests PR: 3873
File: tests/network/localnet/test_non_udn_localnet.py:7-9
Timestamp: 2026-02-25T10:52:09.679Z
Learning: In the RedHatQE/openshift-virtualization-tests repository, networking infrastructure requirements (nmstate, localnet bridge mappings, NIC availability) are not automatically tier3; they are considered standard test environment capabilities. Only tests with truly platform-specific, time-consuming, or bare-metal requirements should be marked as tier3. Apply this guidance to all Python tests under tests/, including tests/network/localnet/test_non_udn_localnet.py, ensuring tier3 designation is reserved for genuine platform-specific or complex scenarios rather than general networking infra necessities.
Learnt from: yossisegev
Repo: RedHatQE/openshift-virtualization-tests PR: 3873
File: tests/network/localnet/test_non_udn_localnet.py:19-27
Timestamp: 2026-02-25T11:00:02.013Z
Learning: In the test codebase, do not import from conftest.py files. This avoids import ambiguity in pytest. Do not import constants or helpers defined in conftest.py into tests. If a value is needed in both conftest.py and test files, duplicate it in both places or place it in a separate utility module that is importable by tests.
Learnt from: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 4267
File: tests/storage/cross_cluster_live_migration/conftest.py:530-531
Timestamp: 2026-03-25T11:24:07.687Z
Learning: In this repo’s OpenShift virtualization tests, it is a standard pattern to call `to_dict()` on `ocp-resources` objects (e.g., `DataVolume`) without using its return value. The call is used only to populate the object’s `res` attribute, which is then read or mutated (e.g., `dv.res[...] = ...`). Do not flag this as an unused return value and do not request adding an inline comment just to justify it, since maintainers treat this behavior as consistent and intentional across the codebase.
Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4318
File: tests/network/bandwidth/test_bandwidth.py:1-3
Timestamp: 2026-03-31T08:35:22.802Z
Learning: In this repository, when reviewing Python test modules under tests/, only require an STP link in the module docstring for STD (new-feature) tests. If the test module is a support-exception test tied to SUPPORTEX-* tickets (e.g., SUPPORTEX-29574) and therefore has no STP, do not flag missing STP links in the module docstring.
Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4318
File: tests/network/l2_bridge/bandwidth/test_bandwidth.py:5-27
Timestamp: 2026-03-31T10:39:33.409Z
Learning: In this repository’s pytest suite, some STD (Standard Definition) placeholder tests under the `tests/` directory are intentionally implemented as docstring-only functions. They must be marked with `__test__ = False` immediately after the function definition (e.g., `test_x.__test__ = False`) to prevent pytest from collecting/executing them until the real test body exists. During code review, do not flag these as missing executable coverage and do not recommend removing or changing the `__test__ = False` setting when the placeholder pattern matches this accepted STD approach.
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 4328
File: tests/network/flat_overlay/test_multi_network_policy.py:0-0
Timestamp: 2026-04-14T16:15:31.065Z
Learning: When reviewing Python tests, avoid redundant parentheses around f-strings in `pytest.mark.xfail` decorators. Prefer `pytest.mark.xfail(reason=f"...", run=False)` over `pytest.mark.xfail(reason=(f"..."), run=False)`, and flag/suggest removing the extra wrapping parentheses where found.
Learnt from: servolkov
Repo: RedHatQE/openshift-virtualization-tests PR: 4542
File: tests/network/libs/bgp.py:333-354
Timestamp: 2026-04-21T19:08:39.771Z
Learning: In this codebase, when using `retry` imported from `timeout_sampler`, the decorated function must indicate success by returning a truthy value. The decorator retries until it encounters a truthy `sample` (i.e., it does `if sample: return sample`). Therefore, ensure `retry`-decorated functions include `return True` (or another truthy value) on success; avoid removing/altering it on the assumption that the caller ignores the return value. If the function returns `None` (or has no return statement), it will keep retrying and typically end in `TimeoutExpiredError`.
|
Clean rebase detected — no code changes compared to previous head ( |
Short description:
PR merged to tier-2/3 that makes Windows test VMs in sig-storage use vTPM
(preferably through instancetypes, which should be the right and easy way to achieve this)
More details:
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for reviewer:
Co-Authored: Claude Code
jira-ticket:
Summary by CodeRabbit