Skip to content

[storage] [T3] Enable Windows storage tests in self-validation using build-in win22 golden image#5145

Open
Ahmad-Hafe wants to merge 1 commit into
RedHatQE:mainfrom
Ahmad-Hafe:win2022-self-validation
Open

[storage] [T3] Enable Windows storage tests in self-validation using build-in win22 golden image#5145
Ahmad-Hafe wants to merge 1 commit into
RedHatQE:mainfrom
Ahmad-Hafe:win2022-self-validation

Conversation

@Ahmad-Hafe

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

Copy link
Copy Markdown
Contributor
What this PR does / why we need it:

following openshift-cnv/ocp-virt-validation-checkup#84 we now allowing user to run self valdiation with no dependency from artifactory

The self-validation checkup runs -m "conformance or windows" but has no Artifactory access, so the existing Windows storage tests that download images from Artifactory can't run there.

This PR makes 11/22/other Windows storage tests work in self-validation by using the windows2022-golden-image DataSource (already present in openshift-virtualization-os-images) as the VM source instead of pulling from Artifactory.

The change is opt-in: passing --tc=win_golden_image_name:windows2022-golden-image switches to the golden image path. Without it, everything behaves exactly as before.

Tests covered (CNV-89353):

Test Polarion
test_successful_vm_from_cloned_dv_windows CNV-3638
test_windows_hotplug CNV-6525
test_windows_hotplug_migrate CNV-11391
test_online_windows_vm_successful_restore CNV-8307
test_write_to_file_while_snapshot CNV-8536
test_windows_memory_dump CNV-8518
test_vm_storage_class_migration_windows_vm_with_vtpm CNV-11499
test_vm_storage_class_migration_windows_vm_with_vtpm_not_restarted CNV-12051
test_vm_storage_class_migration_windows_vm_with_vtpm_data_integrity CNV-12058
test_vm_storage_class_migration_windows_vm_with_vtpm_storage_class_updated CNV-12059
test_migrate_windows_vm_with_vtpm_after_storage_migration CNV-11515

For the storage migration tests, source and target storage class are set to the same value — self-validation environments typically have one storage class, and migrating within the same SC is still a valid test.

Which issue(s) this PR fixes:

CNV-89353

Special notes for reviewer:

Companion PR that sets up the golden image and passes the required params to pytest: openshift-cnv/ocp-virt-validation-checkup#84

jira-ticket:

CNV-89353

Summary by CodeRabbit

  • Tests

    • Added a Windows test marker and tagged Windows-specific tests.
    • Enhanced test suites to provision VMs from configurable Windows golden images, including snapshot, clone, hotplug, and migration scenarios.
    • Updated fixtures to conditionally use golden-image-backed data sources and Windows VM templates.
  • Chores

    • Added Windows Server 2022 configuration constants.
    • Refined fixture signatures and imports to support the new Windows golden-image flows.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c9914c64-35bd-4d9a-b5b1-03beab4fdd9b

📥 Commits

Reviewing files that changed from the base of the PR and between e948afb and c977bc3.

📒 Files selected for processing (12)
  • pytest.ini
  • tests/conftest.py
  • tests/storage/cdi_clone/conftest.py
  • tests/storage/cdi_clone/test_clone.py
  • tests/storage/constants.py
  • tests/storage/memory_dump/conftest.py
  • tests/storage/memory_dump/test_memory_dump.py
  • tests/storage/snapshots/conftest.py
  • tests/storage/snapshots/test_snapshots.py
  • tests/storage/storage_migration/conftest.py
  • tests/storage/storage_migration/test_storage_class_migration.py
  • tests/storage/test_hotplug.py

📝 Walkthrough

Walkthrough

Adds configurable Windows golden-image support to storage test fixtures and tests: when py_config["win_golden_image_name"] is set, fixtures create/ensure a DataSource for that golden image and provision VMs from the template; otherwise existing DataVolume/registry-based flows remain unchanged.

Changes

Windows Golden Image Test Support

Layer / File(s) Summary
Golden Image Fixture Foundation
tests/conftest.py, pytest.ini, tests/storage/constants.py
Top-level fixtures short-circuit DataVolume creation when win_golden_image_name is set; golden_image_data_source_scope_function creates/ensures a DataSource from the configured golden image name. Adds windows pytest marker and WIN2022 constants.
CDI Clone Windows Support
tests/storage/cdi_clone/conftest.py, tests/storage/cdi_clone/test_clone.py
Adds windows_source_dv_scope_function to source a DV from the golden-image sourceRef when configured, plus vm_params fixture with Windows overrides. Test updated to use these fixtures and marked @pytest.mark.windows.
Snapshots Windows Support
tests/storage/snapshots/conftest.py, tests/storage/snapshots/test_snapshots.py
windows_vm_for_snapshot accepts golden_images_namespace; when golden image configured it creates a DataSource and provisions the VM via vm_instance_from_template and wait_for_windows_vm, otherwise falls back to create_windows19_vm. Two tests marked @pytest.mark.windows.
Storage Migration Windows Support
tests/storage/storage_migration/conftest.py, tests/storage/storage_migration/test_storage_class_migration.py
Adds windows_vm_with_vtpm_golden_image_for_storage_migration fixture that provisions and starts a VM from a golden-image DataSource and sets WINDOWS_2K22_PREFERENCE. Test parametrization conditionally selects this fixture when configured.
Hotplug Windows Support
tests/storage/test_hotplug.py
Registry-based Windows DV fixture yields None when golden image configured; vm_instance_from_template_multi_storage_scope_class accepts golden_images_namespace and either provisions the VM from the golden DataSource or falls back to registry path. Test class marked @pytest.mark.windows.
Memory Dump Minor Updates
tests/storage/memory_dump/conftest.py, tests/storage/memory_dump/test_memory_dump.py
Import reformatted; Windows memory-dump test marked with @pytest.mark.windows.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Suggested reviewers

  • dshchedr
  • rnetser
  • vsibirsk
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: enabling Windows storage tests in self-validation by using a built-in Windows 2022 golden image, and it meets the character limit requirement (96/120 chars).
Description check ✅ Passed The description comprehensively covers all template sections with clear explanations, lists affected tests with Polarion IDs, documents the opt-in behavior, and includes the companion PR reference and Jira ticket.
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 functions added. PR only modifies existing tests (decorators, signatures, parametrization). Check passes per requirement.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

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


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Ahmad-Hafe Ahmad-Hafe force-pushed the win2022-self-validation branch from 7a92f26 to 2367189 Compare June 8, 2026 11:38
@Ahmad-Hafe Ahmad-Hafe force-pushed the win2022-self-validation branch from 2367189 to d3f64b1 Compare June 8, 2026 11:49
@Ahmad-Hafe Ahmad-Hafe force-pushed the win2022-self-validation branch from d3f64b1 to 0f70a91 Compare June 8, 2026 12:00
@Ahmad-Hafe Ahmad-Hafe force-pushed the win2022-self-validation branch from 0f70a91 to a6f718c Compare June 8, 2026 12:16
@Ahmad-Hafe Ahmad-Hafe force-pushed the win2022-self-validation branch 2 times, most recently from 76fe0bc to c1653cf Compare June 8, 2026 13:04
@Ahmad-Hafe Ahmad-Hafe force-pushed the win2022-self-validation branch from 0ea6afd to 982586e Compare June 8, 2026 14:05
@Ahmad-Hafe Ahmad-Hafe force-pushed the win2022-self-validation branch from 982586e to e948afb Compare June 8, 2026 14:08
@Ahmad-Hafe Ahmad-Hafe changed the title [storage] Support Windows self-validation via golden image [storage] Enable Windows storage tests in self-validation using golden image Jun 8, 2026
@Ahmad-Hafe Ahmad-Hafe changed the title [storage] Enable Windows storage tests in self-validation using golden image [storage] [T3] Enable Windows storage tests in self-validation using golden image Jun 8, 2026
@Ahmad-Hafe Ahmad-Hafe changed the title [storage] [T3] Enable Windows storage tests in self-validation using golden image [storage] [T3] Enable Windows storage tests in self-validation using build-in win22 golden image Jun 8, 2026
@Ahmad-Hafe Ahmad-Hafe marked this pull request as ready for review June 8, 2026 14:12
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

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

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

@openshift-virtualization-qe-bot-2

Copy link
Copy Markdown
Contributor

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
  • 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/storage/memory_dump/test_memory_dump.py`:
- Line 13: The test currently uses an unregistered decorator
`@pytest.mark.windows` which will fail collection under strict markers; fix by
either removing the `@pytest.mark.windows` decorator from the test (replace with a
supported marker or a runtime control such as pytest.mark.skipif(sys.platform !=
"win32", reason=...)) or register the "windows" marker in pytest.ini under the
[pytest] markers section; update the test file to remove/replace
`@pytest.mark.windows` or add "windows" to pytest.ini accordingly and re-run
tests.

In `@tests/storage/snapshots/conftest.py`:
- Line 14: Replace the fragile direct import of the internal name `py_config`
with the public singleton export from pytest-testconfig: change the import that
currently references `py_config` so it uses `config` aliased to `py_config`
(i.e., import the public `config` and bind it to the same local name used
elsewhere). Update the import statement that mentions `py_config` so tests
continue to refer to `py_config` but the source is `config` from
`pytest_testconfig`.

In `@tests/storage/test_hotplug.py`:
- Around line 109-137: The golden-image branch that creates the VM using
vm_instance_from_template never sets a CPU model, so the VM gets cpu_model=None
while the registry branch uses modern_cpu_for_migration; update the
vm_instance_from_template invocation to supply the same CPU model (e.g., set
request["cpu_model"] or pass vm_cpu_model=modern_cpu_for_migration) so both
branches use modern_cpu_for_migration (reference vm_instance_from_template and
modern_cpu_for_migration).
🪄 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: 5a4d6c6c-becb-4a26-aea7-fe0dcd153c7f

📥 Commits

Reviewing files that changed from the base of the PR and between 6abe07d and e948afb.

📒 Files selected for processing (11)
  • tests/conftest.py
  • tests/storage/cdi_clone/conftest.py
  • tests/storage/cdi_clone/test_clone.py
  • tests/storage/constants.py
  • tests/storage/memory_dump/conftest.py
  • tests/storage/memory_dump/test_memory_dump.py
  • tests/storage/snapshots/conftest.py
  • tests/storage/snapshots/test_snapshots.py
  • tests/storage/storage_migration/conftest.py
  • tests/storage/storage_migration/test_storage_class_migration.py
  • tests/storage/test_hotplug.py

Comment thread tests/storage/memory_dump/test_memory_dump.py
Comment thread tests/storage/snapshots/conftest.py Outdated
from ocp_resources.role_binding import RoleBinding
from ocp_resources.virtual_machine_snapshot import VirtualMachineSnapshot
from pyhelper_utils.shell import run_ssh_commands
from pytest_testconfig import py_config

@coderabbitai coderabbitai Bot Jun 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Check existing import patterns in repo:"
rg -n "from pytest_testconfig import" tests/conftest.py tests/storage/snapshots/conftest.py

echo
echo "Verify exported symbols from pytest_testconfig:"
uv run python - <<'PY'
import importlib
module = importlib.import_module("pytest_testconfig")
print("has config:", hasattr(module, "config"))
print("has py_config:", hasattr(module, "py_config"))

try:
    from pytest_testconfig import py_config
    print("import py_config: OK")
except Exception as error:
    print(f"import py_config: FAIL ({error.__class__.__name__}: {error})")
PY

Repository: RedHatQE/openshift-virtualization-tests

Length of output: 383


🌐 Web query:

pytest_testconfig module exports py_config vs config

💡 Result:

The pytest-testconfig module exposes a singleton object named config for use in your tests [1][2][3]. When importing configuration data from this plugin, you should use: from pytest_testconfig import config While the underlying implementation in the module does utilize an internal py_config dictionary (with a statement at the end of the module source that assigns config = py_config) [4], the public-facing API intended for user consumption is simply config [1][2][3]. You should not rely on or import py_config directly in your test code [1][2].

Citations:


🌐 Web query:

"from pytest_testconfig import py_config" ImportError

💡 Result:

The ImportError triggered by from pytest_testconfig import py_config typically occurs because the plugin exposes a config object rather than py_config [1][2]. According to the official documentation for the pytest-testconfig package, the correct way to import the configuration singleton is: from pytest_testconfig import config [1][2] If you receive an ImportError, verify the following: 1. Correct Import Path: Ensure you are importing config, not py_config [1][2]. While py_config exists internally within the plugin's source code, it is not part of the public API exposed to your tests [3]. 2. Installation: Confirm the package is installed in your current environment by running pip show pytest-testconfig [4][5]. 3. Python Path Issues: If you are certain the import name is correct but still face an ImportError, ensure your test environment is correctly configured [6]. Pytest may have difficulty resolving imports depending on how you invoke the tests (e.g., python -m pytest vs. pytest) and your import mode settings [6][7]. If you are attempting to use the plugin's internal structures, note that pytest-testconfig has been in beta status for several years and had its last major update in 2020 [4][5][2]. If your project requirements allow, consider checking if the plugin is properly loaded by running pytest --help, which should list the plugin-specific command-line arguments (such as --tc-file) if it is successfully registered [1][2].

Citations:


🌐 Web query:

pytest-testconfig py_config config

💡 Result:

pytest-testconfig: use the plugin’s test config file mechanism and the injected config singleton. 1) Install and enable - Install the package pytest-testconfig into your test environment. The project describes it as a pytest plugin “used for passing test-specific (or test-run specific) configuration data to the tests being executed” [1]. 2) Provide configuration to pytest - The plugin adds command-line flags: - --tc-file=TESTCONFIG (may be specified multiple times; configs are merged in all formats except python) [1][2] - --tc-format=TESTCONFIGFORMAT (default is configparser ini format) [1][2] - --tc=OVERRIDES (Option:Value overrides) [1][2] - --tc-exact (treat dots in override keys as literal path components instead of exploding into nested keys) [1][2] So, for example, you can run: - pytest --tc-file=myconfig.ini - or pytest --tc-file=myconfig.yaml --tc-format=yaml 3) Access the loaded configuration in tests - Tests import the config singleton from pytest_testconfig [1][2]. - Example access pattern (nested dict behavior): - The docs state that YAML parses into a nested dictionary, and ini/configparser is collapsed into nested dictionaries so you can use config['servers']['webapp_ip']-style access [1][2]. 4) About “pytest py_config config” vs built-in pytest config - In core pytest, the built-in fixture pytestconfig is a session-scoped fixture providing access to the session’s pytest.Config object [3][4]. This is different from pytest-testconfig’s own config singleton (which is for your test config data) [1].

Citations:


Fix pytest_testconfig import to prevent collection-time ImportError

tests/storage/snapshots/conftest.py line 14 imports py_config directly, but pytest-testconfig exposes the public singleton as config (not py_config). Importing the internal name can fail at import time and break pytest collection; this repo already uses the safer pattern from pytest_testconfig import config as py_config in tests/conftest.py.

💡 Proposed fix
-from pytest_testconfig import py_config
+from pytest_testconfig import config as py_config
🤖 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` at line 14, Replace the fragile direct
import of the internal name `py_config` with the public singleton export from
pytest-testconfig: change the import that currently references `py_config` so it
uses `config` aliased to `py_config` (i.e., import the public `config` and bind
it to the same local name used elsewhere). Update the import statement that
mentions `py_config` so tests continue to refer to `py_config` but the source is
`config` from `pytest_testconfig`.

Source: Coding guidelines

✅ Addressed in commit 4fc400e

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.

⚠️ This thread was automatically unresolved because it was resolved without a substantive response. Please address the review comment and explain how it was resolved before resolving this thread again.

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.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Current import in tests/storage/snapshots/conftest.py ==="
grep -n "pytest_testconfig" tests/storage/snapshots/conftest.py

echo
echo "=== Check all pytest_testconfig imports across changed files ==="
rg -n "from pytest_testconfig import" tests/storage/snapshots/conftest.py tests/storage/storage_migration/conftest.py tests/storage/test_hotplug.py tests/conftest.py

Length of output: 12288



The fix in tests/storage/snapshots/conftest.py (commit 4fc400e) is confirmed: line 14 now correctly reads from pytest_testconfig import config as py_config. ✅

Why the original import was wrong: py_config is an internal implementation detail of pytest-testconfig. The public API exports config. Importing py_config directly risks ImportError at collection time if the plugin's internals change—and collection-time failures block all tests in that file, not just the ones using the bad import. The aliased form import config as py_config keeps the local name unchanged while binding to the stable public symbol.

However, the same bug is still present in tests/storage/test_hotplug.py (line 13):

# tests/storage/test_hotplug.py — currently BROKEN
from pytest_testconfig import py_config

# fix:
from pytest_testconfig import config as py_config

This file was also modified in this PR and has the identical risk. Please apply the same one-line fix there as well.


🧬 Code Graph Analysis Results

tests/storage/snapshots/conftest.py

[No code snippets included from this file because only the provided external snippets are requested for inclusion.]


tests/conftest.py

Lines 310-314 — admin_client()

def admin_client():
    """
    Get DynamicClient
    """
    return cache_admin_client()

Lines 400-433 — unprivileged_client(...)

def unprivileged_client(
    skip_unprivileged_client,
    admin_client,
    unprivileged_secret,
    identity_provider_with_htpasswd,
    exported_kubeconfig,
):
    """
    Provides none privilege API client
    """
    if skip_unprivileged_client:
        LOGGER.info("no_unprivileged_client was set, using admin_client")
        yield admin_client

    else:
        current_user = get_oc_whoami_username()
        if login_with_user_password(
            api_address=admin_client.configuration.host,
            user=UNPRIVILEGED_USER,
            password=UNPRIVILEGED_PASSWORD,
        ):  # Login to an unprivileged account
            with open(exported_kubeconfig) as fd:
                kubeconfig_content = yaml.safe_load(fd)
            unprivileged_context = kubeconfig_content["current-context"]

            # Get back to an admin account
            login_with_user_password(
                api_address=admin_client.configuration.host,
                user=current_user.strip(),
            )
            yield get_client(config_file=exported_kubeconfig, context=unprivileged_context)

        else:
            yield admin_client

Lines 680-693 — namespace(...)

def namespace(request, admin_client, unprivileged_client):
    """
    To create namespace using admin client, pass {"use_unprivileged_client": False} to request.param
    (default for "use_unprivileged_client" is True)
    """
    use_unprivileged_client = getattr(request, "param", {}).get("use_unprivileged_client", True)
    teardown = getattr(request, "param", {}).get("teardown", True)
    unprivileged_client = unprivileged_client if use_unprivileged_client else None
    yield from create_ns(
        unprivileged_client=unprivileged_client,
        admin_client=admin_client,
        name=generate_namespace_name(file_path=request.fspath.strpath.split(f"{os.path.dirname(__file__)}/")[1]),
        teardown=teardown,
    )

Lines 1083-1093 — modern_cpu_for_migration(...)

def modern_cpu_for_migration(cluster_common_modern_node_cpu, host_cpu_model, nodes_cpu_architecture):
    """
    Get a modern CPU model that is common for all nodes
    """
    return (
        None
        if nodes_cpu_architecture == ARM_64
        else find_common_cpu_model_for_live_migration(
            cluster_cpu=cluster_common_modern_node_cpu, host_cpu_model=host_cpu_model
        )
    )

Lines 1109-1116 — golden_images_namespace(...)

def golden_images_namespace(
    admin_client,
):
    for ns in Namespace.get(
        name=py_config["golden_images_namespace"],
        client=admin_client,
    ):
        return ns

utilities/virt.py

Lines 1169-1186 — ssh_exec property (relevant to run_ssh_commands(...) usage)

def ssh_exec(self):
        # In order to use this property VM should be created with ssh=True
        self.username = self.username or self.login_params["username"]
        self.password = self.password or self.login_params["password"]

        LOGGER.info(f"SSH command: ssh -o 'ProxyCommand={self.virtctl_port_forward_cmd}' {self.username}@{self.name}")
        host = Host(hostname=self.name)
        # For SSH using a key, the public key needs to reside on the server.
        # As the tests use a given set of credentials, this cannot be done in Windows/Cirros.
        if any(flavor in self.os_flavor for flavor in FLAVORS_EXCLUDED_FROM_CLOUD_INIT):
            host_user = user.User(name=self.username, password=self.password)
        else:
            host_user = user.UserWithPKey(name=self.username, private_key=os.environ[CNV_VM_SSH_KEY_PATH])
        host.executor_user = host_user
        host.executor_factory = ssh.RemoteExecutorFactory(
            sock=self.virtctl_port_forward_cmd,
        )
        return host

Lines 1709-1724 — wait_for_windows_vm(...)

def wait_for_windows_vm(vm, version, timeout=TIMEOUT_25MIN):
    """
    Samples Windows VM; wait for it to complete the boot process.
    """

    LOGGER.info(f"Windows VM {vm.name} booting up, will attempt to access it up to {round(timeout / 60)} minutes.")

    sampler = TimeoutSampler(
        wait_timeout=timeout,
        sleep=15,
        func=vm.ssh_exec.run_command,
        command=shlex.split("wmic os get Caption /value"),
    )
    for sample in sampler:
        if version in str(sample):
            return True

Lines 2074-2145 — vm_instance_from_template(...) (VM creation/start used by windows_vm_for_snapshot)

def vm_instance_from_template(
    request,
    unprivileged_client,
    namespace,
    data_source=None,
    data_volume_template=None,
    existing_data_volume=None,
    cloud_init_data=None,
    node_selector=None,
    vm_cpu_model=None,
    vm_cpu_flags=None,
    host_device_name=None,
    gpu_name=None,
    vm_affinity=None,
):
    """Create a VM from template and start it (start step could be skipped by setting
    request.param['start_vm'] to False.

    Prerequisite - a DV must be created prior to VM creation.

    Args:
        data_source (obj `DataSource`): DS object points to a golden image PVC.
        data_volume_template (dict): dataVolumeTemplates dict; will replace dataVolumeTemplates in VM yaml
        existing_data_volume (obj `DataVolume`: DV resource): existing DV to be consumed directly (not cloned)

    Yields:
        obj `VirtualMachine`: VM resource

    """
    params = request.param if hasattr(request, "param") else request
    vm_name = params["vm_name"].replace(".", "-").lower()
    with VirtualMachineForTestsFromTemplate(
        name=vm_name,
        namespace=namespace.name,
        client=unprivileged_client,
        labels=Template.generate_template_labels(**params["template_labels"]),
        data_source=data_source,
        data_volume_template=data_volume_template,
        existing_data_volume=existing_data_volume,
        vm_dict=params.get("vm_dict"),
        cpu_cores=params.get("cpu_cores"),
        cpu_threads=params.get("cpu_threads"),
        memory_requests=params.get("memory_requests"),
        network_model=params.get("network_model"),
        network_multiqueue=params.get("network_multiqueue"),
        cloud_init_data=cloud_init_data,
        attached_secret=params.get("attached_secret"),
        node_selector=node_selector,
        diskless_vm=params.get("diskless_vm"),
        cpu_model=params.get("cpu_model") or vm_cpu_model,
        cpu_flags=params.get("cpu_flags") or vm_cpu_flags,
        cpu_placement=params.get("cpu_placement"),
        isolate_emulator_thread=params.get("isolate_emulator_thread"),
        iothreads_policy=params.get("iothreads_policy"),
        dedicated_iothread=params.get("dedicated_iothread"),
        ssh=params.get("ssh", True),
        disk_options_vm=params.get("disk_io_option"),
        host_device_name=params.get("host_device_name") or host_device_name,
        gpu_name=params.get("gpu_name") or gpu_name,
        cloned_dv_size=params.get("cloned_dv_size"),
        vhostmd=params.get("vhostmd"),
        machine_type=params.get("machine_type"),
        eviction_strategy=params.get("eviction_strategy"),
        vm_affinity=vm_affinity,
    ) as vm:
        if params.get("start_vm", True):
            running_vm(
                vm=vm,
                wait_for_interfaces=params.get("guest_agent", True),
                check_ssh_connectivity=vm.ssh,
            )
        yield vm

tests/storage/utils.py

Lines 229-260 — set_permissions(...)

def set_permissions(
    client: DynamicClient,
    role_name: str,
    role_api_groups: list[str],
    verbs: list[str],
    permissions_to_resources: list[str],
    binding_name: str,
    namespace: str,
    subjects_name: str,
    subjects_kind: str = "User",
    subjects_api_group: str | None = None,
    subjects_namespace: str | None = None,
) -> Generator:
    with create_cluster_role(
        client=client,
        name=role_name,
        api_groups=role_api_groups,
        permissions_to_resources=permissions_to_resources,
        verbs=verbs,
    ) as cluster_role:
        with create_role_binding(
            client=client,
            name=binding_name,
            namespace=namespace,
            subjects_kind=subjects_kind,
            subjects_name=subjects_name,
            subjects_api_group=subjects_api_group,
            subjects_namespace=subjects_namespace,
            role_ref_kind=cluster_role.kind,
            role_ref_name=cluster_role.name,
        ):
            yield

Lines 360-388 — create_windows19_vm(...)

def create_windows19_vm(dv_name, namespace, client, vm_name, cpu_model, storage_class):
    artifactory_secret = get_artifactory_secret(namespace=namespace)
    artifactory_config_map = get_artifactory_config_map(namespace=namespace)
    dv = DataVolume(
        name=dv_name,
        namespace=namespace,
        storage_class=storage_class,
        source="http",
        url=get_http_image_url(image_directory=Images.Windows.UEFI_WIN_DIR, image_name=Images.Windows.WIN2k19_IMG),
        size=Images.Windows.DEFAULT_DV_SIZE,
        client=client,
        api_name="storage",
        secret=artifactory_secret,
        cert_configmap=artifactory_config_map.name,
    )
    dv.to_dict()
    with VirtualMachineForTestsFromTemplate(
        name=vm_name,
        namespace=namespace,
        client=client,
        labels=Template.generate_template_labels(**py_config["latest_windows_os_dict"]["template_labels"]),
        cpu_model=cpu_model,
        data_volume_template={"metadata": dv.res["metadata"], "spec": dv.res["spec"]},
    ) as vm:
        running_vm(vm=vm)
        yield vm
    cleanup_artifactory_secret_and_config_map(
        artifactory_secret=artifactory_secret, artifactory_config_map=artifactory_config_map
    )

Lines 459-466 — assert_windows_directory_existence(...)

def assert_windows_directory_existence(
    expected_result: bool, windows_vm: VirtualMachineForTests, directory_path: str
) -> None:
    cmd = shlex.split(f'powershell -command "Test-Path -Path {directory_path}"')
    out = run_ssh_commands(host=windows_vm.ssh_exec, commands=cmd, wait_timeout=TIMEOUT_2MIN, sleep=TIMEOUT_5SEC)[
        0
    ].strip()
    assert expected_result == ast.literal_eval(out), f"Directory exist: {out}, expected result: {expected_result}"

Lines 469-478 — create_windows_directory(...)

def create_windows_directory(windows_vm: VirtualMachineForTests, directory_path: str) -> None:
    cmd = shlex.split(
        f'powershell -command "New-Item -Path {directory_path} -ItemType Directory -Force"',
    )
    run_ssh_commands(host=windows_vm.ssh_exec, commands=cmd, wait_timeout=TIMEOUT_2MIN, sleep=TIMEOUT_5SEC)
    assert_windows_directory_existence(
        expected_result=True,
        windows_vm=windows_vm,
        directory_path=directory_path,
    )


🧠 Learnings used
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: qwang1
Repo: RedHatQE/openshift-virtualization-tests PR: 1702
File: tests/chaos/oadp/conftest.py:23-45
Timestamp: 2025-09-17T14:56:18.111Z
Learning: In tests/chaos/oadp/conftest.py for the openshift-virtualization-tests repository, user qwang1 confirmed that py_config["latest_rhel_os_dict"]["data_source"] can be accessed directly without defensive .get() calls because the test configuration setup guarantees these keys will always be present in their test execution environment.

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: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 983
File: tests/virt/node/general/test_networkinterfacemultiqueue_feature.py:171-171
Timestamp: 2025-05-28T09:58:57.143Z
Learning: In the OpenShift Virtualization tests codebase, there's a distinction between pytest collection phase and test execution phase. During collection, test parameters may use .get() without default values on configuration dictionaries, which is acceptable because tests are filtered before execution based on architecture and configuration availability. Tests won't execute if they're not part of the current architecture or don't have the required OS configuration set in pyconfig.

Learnt from: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 906
File: tests/observability/metrics/conftest.py:19-19
Timestamp: 2025-06-05T11:36:24.472Z
Learning: The pyhelper_utils package is installed and available in the execution environment for tests/observability/metrics/conftest.py, despite static analysis tools reporting it as missing. The import `from pyhelper_utils.shell import run_ssh_commands` works correctly during test execution.

Learnt from: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 906
File: tests/observability/metrics/conftest.py:19-19
Timestamp: 2025-06-05T11:36:25.219Z
Learning: In the openshift-virtualization-tests repository, the pyhelper_utils package (specifically pyhelper_utils.shell with run_ssh_commands) is installed and available in the test execution environment where the tests are run.

Learnt from: josemacassan
Repo: RedHatQE/openshift-virtualization-tests PR: 5003
File: tests/storage/upgrade/test_upgrade_storage.py:65-77
Timestamp: 2026-05-29T07:23:28.556Z
Learning: In `tests/storage/upgrade/test_upgrade_storage.py` (RedHatQE/openshift-virtualization-tests), snapshot-restore upgrade tests intentionally contain two paired assertions per test: one verifying that a file created *before* the snapshot exists, and one verifying that a file created *after* the snapshot does not exist. These two assertions are deliberately kept in the same test because they jointly validate snapshot-restore correctness (the snapshot boundary). Do not flag or suggest splitting them into separate single-assertion tests.

Learnt from: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 1224
File: tests/storage/storage_migration/conftest.py:419-425
Timestamp: 2025-06-17T14:45:39.291Z
Learning: In tests/storage/storage_migration/conftest.py, the PowerShell command using shlex.split() with properly escaped quotes works correctly and does not break the command structure when passed to run_ssh_commands.

Learnt from: acinko-rh
Repo: RedHatQE/openshift-virtualization-tests PR: 4780
File: tests/storage/snapshots/test_snapshots.py:267-299
Timestamp: 2026-05-20T08:46:30.219Z
Learning: For Python tests under tests/storage/, follow the existing traceability convention: use only `pytest.mark.polarion()` for test traceability. Do not treat missing STP/RFE/Jira-epic links (e.g., absent module-docstring links) as a HIGH-severity finding.

When reviewing changes that add new tests/fixtures, only flag missing STP/RFE/Jira-epic links as LOW/informational if the target file already has the established “STD” traceability pattern (i.e., that file already includes STP/RFE/Jira-epic links in its existing traceability mechanism such as the module docstring). Otherwise, leave these omissions unflagged and rely on `pytest.mark.polarion()` as the traceability mechanism.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 983
File: tests/network/rdp/test_rdp_for_exposed_vm_svc.py:17-17
Timestamp: 2025-05-28T09:56:15.556Z
Learning: In the OpenShift virtualization tests, during pytest collection phase, defensive .get() calls are used to prevent KeyError exceptions even if the resulting values might be None. During actual test execution, tests are filtered based on architecture compatibility and pyconfig settings, so the None values from collection don't cause issues in practice.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2026-05-04T13:45:35.675Z
Learning: In the `openshift-virtualization-tests` repository, the `tests/global_config*.py` files use a pattern where `config` appears undefined to static analysis tools (triggering F821/PLW0604), but `config` is actually injected at runtime by `pytest_testconfig`. The F821 rule is intentionally scoped via `per-file-ignores` in ruff/pyproject.toml for these files. Do not flag `config` usage in `tests/global_config*.py` as undefined or uninitialized.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2026-04-03T18:43:06.192Z
Learning: In `scripts/tests_analyzer/pytest_marker_analyzer.py` in the openshift-virtualization-tests repository, `conftest_resolved=True` is an intentional trade-off: once a conftest pathway is resolved, it stops scanning further dependency paths (including non-conftest ones). Removing this flag causes 21 false positive regressions on 150 PRs (measured). The false negative risk — a 2+ level transitive chain through both conftest and non-conftest paths — is considered theoretical. Do not flag `conftest_resolved=True` as hiding non-conftest dependency paths; this behavior is deliberate and empirically validated.

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: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 4819
File: utilities/unittests/test_sanity.py:22-22
Timestamp: 2026-05-18T06:31:35.221Z
Learning: In RedHatQE/openshift-virtualization-tests, when the PLC0415 (import-outside-top-level) Ruff rule is enabled, pre-existing violations in utilities/unittests/ test files are intentionally suppressed with per-line `# noqa: PLC0415` comments as a temporary measure. These suppressions are documented in the PR description and are candidates for dedicated follow-up cleanup PRs. Do not flag these suppressions as violations; they are an accepted part of the incremental rule-enablement strategy. Additionally, imports inside unit test methods in utilities/unittests/ may be intentionally placed there so they execute after patch decorators activate, which matters when modules have import-time side effects.

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 5039
File: tests/network/l2_bridge/nad_ref_change/lib_helpers.py:1-1
Timestamp: 2026-06-02T21:16:58.118Z
Learning: In RedHatQE/openshift-virtualization-tests, if a PR only relocates functions into shared/helper libraries and updates the corresponding import paths in test files—without any logic/behavior change in the moved functions—do not require full re-execution of the affected caller tests. Instead, at most run `pytest --collect-only` (for the relevant test modules) to confirm the updated imports resolve. Require full re-execution of caller tests only when the moved function’s implementation changes in a way that could affect behavior (e.g., different logic, side effects, return values, error handling, or fixture interaction).

Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 4739
File: tests/virt/node/descheduler/conftest.py:142-146
Timestamp: 2026-05-05T18:28:01.097Z
Learning: In this repository, ignore Ruff rule PT022 in Python test files under `tests/`. If PT022 is triggered in a `pytest` fixture that uses `yield` but has no teardown code, treat it as an acceptable low-value nitpick and do not suggest changing the fixture to use `return` or otherwise flag the issue during code review.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 4000
File: conftest.py:856-858
Timestamp: 2026-02-27T11:25:14.486Z
Learning: In the openshift-virtualization-tests repository, the AI-analysis related code sections in conftest.py (specifically the code that calls setup_ai_analysis() and enrich_junit_xml()) are vendored from https://github.com/myk-org/jenkins-job-insight/blob/main/examples/pytest-junitxml and should be kept as-is to maintain consistency with upstream for easier maintenance and updates. Do not flag style issues in these vendored sections.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 4344
File: scripts/tests_analyzer/pytest_marker_analyzer.py:1750-1761
Timestamp: 2026-04-03T18:43:23.119Z
Learning: In scripts/tests_analyzer/pytest_marker_analyzer.py (openshift-virtualization-tests), module-level import lines in diffs are intentionally treated as "safe unattributed" changes (setting has_unattributed_changes=True rather than returning None). This is a deliberate design decision: import path changes (e.g., from X.Y import Z → from A.B import Z due to file renames) are structural, not behavioral — the resolved symbol Z is identical. Treating imports as conservative fallbacks would reintroduce false positives for file rename PRs (e.g., `#4308`, `#4314`). Broken import paths are caught by pytest --collect-only, not smoke test execution. Do not flag this pattern as a false-positive risk.

Learnt from: hmeir
Repo: RedHatQE/openshift-virtualization-tests PR: 4972
File: conftest.py:562-568
Timestamp: 2026-05-25T11:26:49.733Z
Learning: In the RedHatQE/openshift-virtualization-tests repository, collection-time filter helper functions (e.g., `filter_upgrade_tests`, `filter_deprecated_api_tests`, `filter_sno_only_tests`, `filter_multiarch_tests`, `remove_tests_from_list`) are intentionally defined directly in the top-level `conftest.py`, not moved to `utilities/pytest_utils.py`. Do not flag or suggest moving these pytest-collection filter helpers out of `conftest.py`; this is the established pattern for this repo.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 1168
File: tests/storage/storage_migration/utils.py:92-99
Timestamp: 2025-06-10T09:41:58.035Z
Learning: When CodeRabbit flags technical issues in code reviews, do not resolve the comments without first addressing them and getting a response from the user. Proper procedure is to discuss the technical issues and proposed solutions before marking comments as resolved.

Learnt from: RoniKishner
Repo: RedHatQE/openshift-virtualization-tests PR: 4898
File: tests/infrastructure/instance_types/conftest.py:154-172
Timestamp: 2026-05-19T18:02:29.760Z
Learning: In `tests/infrastructure/instance_types/conftest.py` (RedHatQE/openshift-virtualization-tests), the `latest_windows_data_volume` fixture intentionally reuses an existing DataVolume named `"latest-windows"` in the `LATEST_WINDOWS_IMAGE_NAMESPACE` namespace without validating its registry URL or import state. The design goal is to persist the image on the cluster and reuse it across runs to save time and resources. Do NOT flag this as a staleness/stale-image issue in code review; the team explicitly accepts running on whatever image was previously imported.

Learnt from: RoniKishner
Repo: RedHatQE/openshift-virtualization-tests PR: 4898
File: tests/infrastructure/instance_types/conftest.py:154-172
Timestamp: 2026-05-19T18:02:29.760Z
Learning: In `tests/infrastructure/instance_types/conftest.py` (RedHatQE/openshift-virtualization-tests), the `latest_windows_data_volume` fixture intentionally reuses an existing DataVolume named `"latest-windows"` in the `LATEST_WINDOWS_IMAGE_NAMESPACE` namespace without validating its registry URL or import state. The design goal is to persist the image on the cluster and reuse it across runs to save time. Do NOT flag this as a staleness/stale-image issue in code review; the team explicitly accepts running on whatever image was previously imported.

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: 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: SamAlber
Repo: RedHatQE/openshift-virtualization-tests PR: 3748
File: tests/storage/cdi_import/test_import_http.py:506-508
Timestamp: 2026-04-27T15:30:21.797Z
Learning: In tests/storage/cdi_import/test_import_http.py, prefer hardcoding explicit image constants (e.g., Images.Windows.WIN2022_IMG) directly in parametrize dicts rather than deriving them from LATEST_WINDOWS_OS_DICT.get("image_path"). The rationale is readability and debuggability: the constant is immediately visible when reading the test or triaging a failure, whereas a dict lookup requires chasing the runtime value. Do not flag or suggest changing these explicit image references to dynamic lookups from LATEST_WINDOWS_OS_DICT.

Learnt from: acinko-rh
Repo: RedHatQE/openshift-virtualization-tests PR: 4571
File: tests/storage/cdi_clone/test_clone.py:0-0
Timestamp: 2026-04-28T13:59:51.123Z
Learning: In tests/storage/cdi_clone/test_clone.py (RedHatQE/openshift-virtualization-tests), the test `test_successful_vm_from_cloned_dv_windows_with_vtpm` intentionally does NOT call `verify_vtpm_in_windows_vm`. The vTPM configuration is guaranteed structurally by the instancetype/preference used to create the VM. The `verify_vtpm_in_windows_vm` function (which checks VM XML and runs a WMIC query via SSH) was debug-only scaffolding that the team confirmed is not needed in production tests. Do not flag the absence of `verify_vtpm_in_windows_vm` in this test as missing coverage.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 1244
File: tests/virt/cluster/common_templates/windows/test_windows_custom_options.py:181-181
Timestamp: 2025-06-19T09:56:06.185Z
Learning: In tests/virt/cluster/common_templates/windows/test_windows_custom_options.py, the change from os.path.join to f-string path construction is intentional to handle cases where Images.Windows.WIN2k19_HA_IMG may be None during test collection on architectures where Windows images aren't available. The f-string approach allows pytest collection to succeed gracefully, while actual test execution is controlled by markers and environmental conditions.

Learnt from: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 1166
File: tests/observability/metrics/conftest.py:1065-1082
Timestamp: 2025-08-04T15:27:14.175Z
Learning: In tests/observability/metrics/conftest.py, the `non_existent_node_windows_vm` fixture is used for tier3 Windows VM testing and must use Windows VMs rather than Linux VMs, even though it adds overhead, because it's specifically testing Windows VM status transition metrics as part of dedicated Windows VM test coverage.

Learnt from: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 1166
File: tests/observability/metrics/conftest.py:1183-1186
Timestamp: 2025-06-22T13:47:35.014Z
Learning: In tests/observability/metrics/conftest.py, the `stopped_windows_vm` fixture is designed to temporarily stop the Windows VM for a test, then restart it during teardown (after yield) because the Windows VM is module-scoped and needs to be available for other tests that depend on it being in a running state.

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: 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: servolkov
Repo: RedHatQE/openshift-virtualization-tests PR: 1776
File: libs/net/node_network.py:25-31
Timestamp: 2025-08-20T23:43:28.117Z
Learning: In the RedHatQE/openshift-virtualization-tests project, servolkov's team always uses bare metal (BM) clusters with IPv4 setup in their testing environment, making defensive checks for IPv4 data presence potentially redundant in their networking code.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 3371
File: scripts/tests_analyzer/compare_coderabbit_decisions.py:199-289
Timestamp: 2026-01-13T10:06:14.822Z
Learning: In the openshift-virtualization-tests repository, user rnetser prefers to keep pagination loops inline rather than extracting them into generic helper functions when the loops have different URL patterns and unique post-processing logic, as the inline approach improves readability and makes each endpoint's behavior more explicit.

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: 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: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 1160
File: tests/storage/storage_migration/test_mtc_storage_class_migration.py:165-176
Timestamp: 2025-06-17T07:45:37.776Z
Learning: In the openshift-virtualization-tests repository, user jpeimer prefers explicit fixture parameters over composite fixtures in test methods, even when there are many parameters, as they find this approach more readable and maintainable for understanding test dependencies.

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: akri3i
Repo: RedHatQE/openshift-virtualization-tests PR: 1210
File: tests/virt/cluster/general/mass_machine_type_transition_tests/conftest.py:24-64
Timestamp: 2025-06-23T19:28:20.281Z
Learning: In OpenShift Virtualization mass machine type transition tests, the machine type glob pattern "pc-q35-rhel8.*.*" is intentionally hard-coded in the kubevirt_api_lifecycle_automation_job as it's used only once for this specific test case, with plans to update it in the future if the job needs to support other machine types.

Learnt from: RoniKishner
Repo: RedHatQE/openshift-virtualization-tests PR: 1411
File: utilities/os_utils.py:246-279
Timestamp: 2025-07-22T17:13:59.166Z
Learning: In the RedHatQE/openshift-virtualization-tests repository, CentOS preferences follow the format "centos-stream<version>" (e.g., "centos-stream9", "centos-stream10"). The generate_instance_type_centos_os_matrix function correctly uses regex to extract numeric versions and constructs the latest version string in the same format as the input preferences for proper comparison.

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 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: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2026-05-29T11:02:22.804Z
Learning: In the RedHatQE/openshift-virtualization-tests repository, version-bump PRs that update the main branch to reference a new CNV release (e.g., "Update project `main` to reference cnv 5.0") do NOT add new test files or test modules. These PRs only update metadata (pyproject.toml, tox.ini, .coderabbit.yaml) and clean up resolved Jira fixtures/markers in existing files. The "Stp Link Required" pre-merge check may incorrectly flag hundreds of "newly added" test files as a false positive due to the base-branch comparison shifting after branching — this should be ignored for such 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: RoniKishner
Repo: RedHatQE/openshift-virtualization-tests PR: 4898
File: tests/infrastructure/instance_types/conftest.py:158-162
Timestamp: 2026-05-18T11:17:24.309Z
Learning: In RedHatQE/openshift-virtualization-tests, the `windows_test_images_namespace_role_binding` fixture in `tests/infrastructure/instance_types/conftest.py` intentionally grants `view` to `system:authenticated` on the `windows-test-images` namespace. This is by design: the shared Windows test images must be universally readable by any test or namespace on the cluster (mirroring the OpenShift golden-image namespace pattern). Do not flag this RoleBinding as overly permissive in future reviews.

Learnt from: RoniKishner
Repo: RedHatQE/openshift-virtualization-tests PR: 4898
File: tests/infrastructure/instance_types/conftest.py:158-162
Timestamp: 2026-05-18T11:17:18.196Z
Learning: In RedHatQE/openshift-virtualization-tests, the `windows_test_images_namespace_role_binding` fixture in `tests/infrastructure/instance_types/conftest.py` intentionally grants `view` to `system:authenticated` on the `windows-test-images` namespace. This is by design: the shared Windows test images must be universally readable by any test or namespace on the cluster (mirroring the OpenShift golden-image namespace pattern). Do not flag this RoleBinding as overly permissive in future reviews.

Learnt from: Ahmad-Hafe
Repo: RedHatQE/openshift-virtualization-tests PR: 3399
File: tests/global_config_gcp.py:24-25
Timestamp: 2026-01-20T13:55:28.139Z
Learning: In the openshift-virtualization-tests repository, storage migration tests support same-to-same storage class migration (e.g., storage_class_a = StorageClassNames.GCP and storage_class_b = StorageClassNames.GCP) because migrating from a storage class to the same storage class is a valid migration scenario where a new PVC is still created.

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: 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: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 2348
File: tests/observability/upgrade/conftest.py:1-7
Timestamp: 2026-01-26T10:11:23.629Z
Learning: In conftest.py files that define session-scoped fixtures which provision resources (e.g., VMs, namespaces) for upgrade testing, logging imports and structured INFO logs for setup are optional. Prefer quieter fixture setup to reduce log noise unless debugging is required. Apply this guideline across similar conftest.py fixtures that perform straightforward resource provisioning.

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: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 3649
File: tests/network/user_defined_network/ip_specification/conftest.py:32-48
Timestamp: 2026-01-29T15:01:46.322Z
Learning: In test fixtures (e.g., tests/network/user_defined_network/ip_specification/conftest.py and other VM-related conftest.py files), after vm.start(), prefer calling vm.wait_for_agent_connected() as the validation step. Do not add vm.wait_for_ready_status(status=True) beforehand, since wait_for_agent_connected() ensures the guest OS is actually running (not just powered on) and provides a stronger, more reliable readiness check for test initialization.

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: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 3930
File: tests/network/non_functional/ip_persistence/conftest.py:66-73
Timestamp: 2026-02-23T18:07:57.649Z
Learning: In all conftest.py files under the tests directory, do not flag or require fixes for Ruff FBT001 (Boolean-typed positional argument in function definition) in pytest fixture definitions. Pytest injects fixture parameters by name through dependency injection, so boolean positional arguments in fixture definitions are a false positive in this context. Apply this exception across all tests/* fixtures and document this behavior in review guidelines.

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: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 4053
File: tests/storage/cross_cluster_live_migration/conftest.py:47-55
Timestamp: 2026-03-03T12:01:13.888Z
Learning: In test configuration files (for example tests/.../conftest.py), log the absence of optional CLI arguments or configurations at INFO level. Use WARNING only when missing configuration could cause a problem or be unusual. For parameters that may be present or absent by design, prefer INFO to reflect normality.

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: 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: 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: 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: 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: 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: 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: 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: 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`. 

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: dalia-frank
Repo: RedHatQE/openshift-virtualization-tests PR: 4603
File: tests/data_protection/oadp/test_velero.py:101-130
Timestamp: 2026-04-27T15:40:31.167Z
Learning: When reviewing tests in RedHatQE/openshift-virtualization-tests, do not require STD-first workflow and STP/RFE/Jira-epic module docstring/traceability for tests that are being re-enabled after previously being blocked by a product bug (e.g., after a CNV Jira bug fix). Only enforce these STD-first and STP/RFE/Jira-epic module docstring requirements for genuinely new feature tests; previously blocked tests that are now unblocked/re-enabled should not be flagged as missing traceability.

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4569
File: tests/network/user_defined_network/rhel9_rhel10_cluster/test_connectivity.py:17-51
Timestamp: 2026-05-03T14:47:13.096Z
Learning: In this repository’s pytest suite (files under `tests/`), it is acceptable to have identically named `test_*` functions in different test modules (e.g., same function name in different `.../test_*.py` files). Do not request renaming solely to disambiguate function names across modules, since pytest node IDs remain unique and unambiguous due to the module path prefix. The team accepts the trade-off that `pytest -k <name>` will match tests in all modules containing that name.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 4701
File: tests/virt/node/general/test_windows_vtpm_bitlocker.py:50-52
Timestamp: 2026-05-03T15:38:09.624Z
Learning: During review of PRs that are lint cleanups or tooling/version bumps, do not flag code-quality issues for patterns that pre-existed before the PR. Specifically, if the diff does not introduce/modify constructs such as nested `if` blocks or unnecessary list comprehensions, treat them as known/deferred and leave them for dedicated follow-up cleanup PRs. Only raise issues when the PR itself adds, changes, or refactors the problematic code.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 4725
File: utilities/console.py:54-59
Timestamp: 2026-05-04T13:45:29.122Z
Learning: During review of RedHatQE/openshift-virtualization-tests “lint-cleanup” PRs (e.g., changes targeting lint issues like stale noqa/utf-8 headers), do not flag existing `# type: ignore` directives that were already present before the PR and were not introduced or modified by the PR. Only raise findings for `# type: ignore` suppressions that the PR itself adds, changes, or otherwise makes newly effective (i.e., they appear in the diff as additions/edits).

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 4725
File: tests/virt/cluster/common_templates/centos/test_centos_os_support.py:78-83
Timestamp: 2026-05-04T13:45:33.892Z
Learning: When reviewing lint-cleanup or formatting-only pull requests in this repo (e.g., changes like removing/updating `# noqa` comments or UTF-8 headers), do not raise findings for code patterns that already existed before the PR. Specifically, if a problematic construct such as `.is_connective(tcp_timeout=120)` was present in the base branch, suppress that finding and only raise issues when the PR itself introduces or modifies that construct (i.e., the diff adds/changes the call or its arguments). Apply this rule across all Python files (`**/*.py`).

Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 4739
File: tests/virt/node/descheduler/conftest.py:2-2
Timestamp: 2026-05-05T17:01:15.294Z
Learning: In this repo’s Python code, it’s acceptable (and preferred by convention) to build `run_command` inputs using `shlex.split(f"<command> {arg}")` rather than converting to direct list literals like `['oc', 'adm', 'uncordon', name]`. During code review, generally don’t flag `shlex.split(...)` usage for `run_command` calls and don’t suggest replacing it with list literals; the string-form pattern is used to keep commands readable and consistent with how they’re typed in a terminal.

Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 4739
File: tests/virt/node/descheduler/conftest.py:145-145
Timestamp: 2026-05-05T17:27:32.109Z
Learning: In this repo’s Python tests, `pyhelper_utils.shell.run_command` defaults to `check=True` (so it raises `subprocess.CalledProcessError` on non-zero exit). Therefore, don’t flag missing return-code handling/rc checks for bare calls like `run_command(...)` (or calls where `check` is not explicitly provided). Only flag cases where `check=False` is explicitly passed and the exit code/return value is ignored or not otherwise handled.

Learnt from: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 4162
File: tests/install_upgrade_operators/crypto_policy/utils.py:320-323
Timestamp: 2026-05-07T12:34:42.589Z
Learning: When parsing the output of `openssl list -tls-groups`, remember it prints TLS group names on a single colon-separated line (e.g., `secp256r1:X25519:SecP256r1MLKEM768:...`). Parse individual TLS group names by splitting on `:` (e.g., `output.strip().split(':')`) rather than assuming one group per line. In code that specifically handles this `openssl list -tls-groups` output, do not flag `split(':')` as incorrect.

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4772
File: tests/network/l2_bridge/rhel9_rhel10_cluster/test_connectivity.py:20-22
Timestamp: 2026-05-08T12:31:26.895Z
Learning: In RedHatQE/openshift-virtualization-tests, any pytest test already marked with `pytest.mark.mixed_os_nodes` must not also be marked with `pytest.mark.tier3`. The `mixed_os_nodes` marker is responsible for both environment filtering and selecting the dedicated execution lane for dual-stream (mixed RHCOS 9 + RHCOS 10) cluster scenarios. Apply this rule to all test modules under `tests/` that use the `mixed_os_nodes` marker (e.g., `tests/network/l2_bridge/rhel9_rhel10_cluster/test_connectivity.py`).

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4772
File: tests/network/l2_bridge/rhel9_rhel10_cluster/conftest.py:26-26
Timestamp: 2026-05-08T12:32:45.752Z
Learning: In this repository, pytest fixture return annotations that use `collections.abc.Generator` with a single type parameter (e.g., `Generator[NetworkAttachmentDefinition]`) are the accepted shorthand. Do not flag `Generator[X]` as incorrect, and do not require the longer three-parameter form `Generator[X, None, None]` when used as a fixture return annotation. Apply this convention across all `conftest.py` files under `tests/`.

Learnt from: geetikakay
Repo: RedHatQE/openshift-virtualization-tests PR: 4788
File: utilities/os_utils.py:257-262
Timestamp: 2026-05-08T12:49:20.694Z
Learning: In RedHatQE/openshift-virtualization-tests, the Ruff flake8-boolean-trap rules FBT001/FBT002 are intentionally not enabled (pyproject.toml does not select the FBT rules; confirmed via `ruff check --show-settings`). Therefore, do not flag boolean positional parameters as FBT001/FBT002 violations in this repository. If Ruff configuration changes and starts selecting FBT rules, this exception should be reconsidered.

Learnt from: acinko-rh
Repo: RedHatQE/openshift-virtualization-tests PR: 4780
File: tests/storage/utils.py:568-572
Timestamp: 2026-05-12T05:10:24.601Z
Learning: In this repository, Ruff rule UP043 ("unnecessary default type arguments") is enforced. When annotating `collections.abc.Generator` return types, prefer the single-parameter form `Generator[YieldType]` rather than `Generator[YieldType, None, None]`. Explicit `None, None` for the SendType and ReturnType are unnecessary defaults (per PEP 696) and will trigger UP043. Apply this consistently across all Python files.

Learnt from: Anatw
Repo: RedHatQE/openshift-virtualization-tests PR: 4833
File: tests/network/localnet/migration_stuntime/test_migration_stuntime.py:51-51
Timestamp: 2026-05-12T18:18:20.607Z
Learning: In RedHatQE/openshift-virtualization-tests, do not flag or suggest removing Python linter suppressions `# noqa: PID001` in files under `tests/`. `PID001` is a custom flake8 rule enforced by the Polarion ID checker plugin (not a standard Ruff rule). Therefore Ruff’s `RUF102` (“Invalid rule code in `# noqa`: PID001”) is a false positive in this repo. These `# noqa: PID001` comments are intentional and effective, commonly used on base-class `test_*` methods where the Polarion markers are defined on subclass overrides.

Learnt from: Anatw
Repo: RedHatQE/openshift-virtualization-tests PR: 4833
File: tests/network/localnet/migration_stuntime/libstuntime.py:25-25
Timestamp: 2026-05-13T19:23:09.603Z
Learning: In this repository, do not recommend adding `from __future__ import annotations` to fix forward-reference type annotation issues (e.g., Ruff UP037). Follow the established convention: use quoted string type annotations for forward references when the referenced class/type is defined later in the same file (e.g., `"ContinuousPing"`), and prefer `typing.Self` for self-referential return types.

Learnt from: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 4819
File: utilities/unittests/test_bitwarden.py:207-207
Timestamp: 2026-05-18T06:30:56.781Z
Learning: During Ruff/lint rule-enablement PRs in this repository (e.g., when introducing a new rule like PLC0415), it’s acceptable to keep CI green by adding per-line, targeted suppressions for pre-existing violations: add only `# noqa: <single-ruff-rule-id>` at the end of the specific violating line. In this PR context, reviewers should NOT flag these targeted `# noqa: PLC0415` comments as policy violations, assuming the suppression is for a pre-existing issue and is documented in the PR description as a candidate for follow-up cleanup. Do not allow blanket `# noqa` (without a specific rule) or `per-file-ignores`; those remain disallowed.

Learnt from: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 4819
File: utilities/unittests/test_pytest_utils.py:270-270
Timestamp: 2026-05-18T06:31:12.015Z
Learning: In RedHatQE/openshift-virtualization-tests, if a PR is a Ruff rule-enforcement PR and its “Special notes for reviewer” documents that pre-existing Ruff violations are being temporarily handled via per-line suppressions (e.g., `# noqa: PLC0415`) to keep CI green, reviewers should treat those specific `# noqa: <rule>` comments as an agreed, temporary mechanism. Do not flag them as code-quality issues and do not recommend removing, consolidating, or refactoring those suppressions within the same PR; cleanup/remediation is expected to happen in dedicated follow-up PRs instead.

Learnt from: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 4819
File: utilities/unittests/test_data_collector.py:304-304
Timestamp: 2026-05-18T06:31:15.083Z
Learning: When reviewing Python code in this repository for Ruff/linter rule rollouts, do not treat temporary suppression comments as violations in the specific migration scenario where a PR enables a new Ruff rule (e.g., PLC0415) and the PR description explicitly documents that all *pre-existing* violations are being annotated with `# noqa: <RULE>` as a short-lived measure. In that case, only flag `# noqa: <RULE>` suppressions that are newly introduced on code that did not previously violate the rule—i.e., verify via the PR diff against the prior state (and/or prior Ruff findings) that the suppressed line was already violating before the rule was enabled. Ignore suppressions that are covering violations that existed before the new rule rollout and were intentionally bulk-added for cleanup in follow-up PRs.

Learnt from: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 4819
File: utilities/unittests/test_hco.py:501-501
Timestamp: 2026-05-18T06:31:20.848Z
Learning: When reviewing Python code in RedHatQE/openshift-virtualization-tests, avoid flagging Ruff `# noqa: <RULE>` suppressions as issues if they were intentionally added as a temporary measure to keep CI green after a PR enables a new Ruff/lint rule (e.g., PLC0415) and the PR description documents this under "Special notes for reviewer". Treat these suppressions as deferred technical debt. Only flag `# noqa: PLC0415` (and similar rule-specific suppressions) when they are newly introduced without an accompanying documented intent in the PR (and thus appear to be masking a new violation rather than a pre-existing one).

Learnt from: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 4878
File: utilities/unittests/test_pytest_utils.py:2194-2197
Timestamp: 2026-05-18T09:09:09.479Z
Learning: In this repository (RedHatQE/openshift-virtualization-tests), do not flag missing return type annotations or missing argument type annotations as Ruff “ANN” rule violations (e.g., ANN001/ANN002/ANN201/ANN202). The repo’s Ruff configuration does not enable ANN rules and only uses `extend-select = ["PLC0415"]`, so missing type annotations should not be treated as ANN lint failures during code review.

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4784
File: libs/vm/affinity.py:104-104
Timestamp: 2026-05-19T07:48:17.119Z
Learning: When using Kubernetes API models like `NodeSelectorRequirement` or `LabelSelectorRequirement` with operators `Exists` or `DoesNotExist`, the `values` field must not be non-empty. It is valid for `values` to be omitted / left as `None` (Python) / passed as `null`—Kubernetes rejects non-empty `values` for these operators, but does not require the field to be present or explicitly set to an empty list. In code reviews, do not treat missing `values=[]` for `Exists`/`DoesNotExist` as a validation issue; only flag cases where `values` is provided with actual elements.

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4784
File: libs/vm/affinity.py:104-104
Timestamp: 2026-05-19T07:48:17.119Z
Learning: When constructing Kubernetes `NodeSelectorRequirement` (or `LabelSelectorRequirement`) objects in code, do not treat `values` being omitted, `None`, or an empty list as an API-validation problem when the requirement’s operator is `Exists` or `DoesNotExist`. Per the Kubernetes API spec, these operators only require that the `values` array is not non-empty (i.e., it must be empty); they do not require the field to be explicitly present as `[]`. Therefore, reviewers should not flag `values=None`/missing `values` for `Exists`/`DoesNotExist`.

Learnt from: hmeir
Repo: RedHatQE/openshift-virtualization-tests PR: 4880
File: tests/install_upgrade_operators/deployment/conftest.py:25-28
Timestamp: 2026-05-19T08:28:08.971Z
Learning: In this repository, when reviewing targeted cherry-pick/backport PRs, do not fail the change on pytest fixture naming conventions if the fixture uses an action-verb name (e.g., `xfail_if_<condition>`) and its body calls `pytest.xfail(...)` as a side effect without returning or yielding a value. Treat this fixture pattern as acceptable for the backport until the deferred refactor to noun-based fixture names is done; for non-backport work, follow the usual fixture naming rules.

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4962
File: tests/network/l2_bridge/nad_ref_change/lib_helpers.py:80-81
Timestamp: 2026-05-25T09:13:27.011Z
Learning: When reviewing Python code in this repository, do NOT flag short loop variables like `i` (or other short names) as non-descriptive when they are used as the index in a simple `enumerate()` loop where the variable’s role is immediately obvious from context and the loop body is a single straightforward statement (e.g., `for i, addresses in enumerate(ip_addresses): ethernets[f"eth{i + 1}"] = ...`). In these cases, keep the short index variable and do not recommend renaming it to a longer form like `interface_index`.

Learnt from: Anatw
Repo: RedHatQE/openshift-virtualization-tests PR: 4833
File: tests/network/localnet/migration_stuntime/test_migration_stuntime.py:57-57
Timestamp: 2026-05-25T09:57:03.042Z
Learning: In pytest test files under `tests/`, when using `pytest.mark.parametrize(..., indirect=True)`, ensure the parametrized `param_name` is present in the test function signature (pytest will fail at collection time if it’s missing). When reviewing lints such as `ARG002` (unused argument), do not flag that `param_name` as unused if it only exists to trigger indirect fixtures or to drive other fixtures via the fixture dependency chain— even if the test body never references the value directly.

Learnt from: rlobillo
Repo: RedHatQE/openshift-virtualization-tests PR: 4983
File: utilities/hco.py:376-378
Timestamp: 2026-05-26T15:52:31.613Z
Learning: For Python files in this repo, don’t raise review findings for missing type hints or missing/Google-style docstrings on an existing function when the PR’s only functional change is adding one or more new parameters to that function and the PR does not otherwise refactor or substantially rewrite its body/signature. Treat type-annotation/docstring improvements as out of scope for focused parameter-add PRs and defer them to a follow-up. Only raise missing type-hint or docstring issues when the PR introduces an entirely new function or substantially rewrites an existing one.

Learnt from: RoniKishner
Repo: RedHatQE/openshift-virtualization-tests PR: 4985
File: tests/conftest.py:2632-2634
Timestamp: 2026-05-28T08:24:43.967Z
Learning: In this repository, do not flag missing type hints (parameter/return annotations) on pytest fixture functions—i.e., functions decorated with pytest.fixture (commonly defined in tests/*/conftest.py). Type hints are expected for regular Python functions (especially under utilities/ and libs/), but pytest fixtures may omit annotations consistently to avoid review noise.

Learnt from: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 5023
File: tests/install_upgrade_operators/crypto_policy/utils.py:299-314
Timestamp: 2026-05-28T12:55:07.435Z
Learning: In this repo’s test suite, the `hco_namespace` pytest fixture (defined in `tests/conftest.py`) returns an OpenShift `Namespace` Resource object created by `utilities.hco.get_hco_namespace(...)`. When a function receives `hco_namespace` as a fixture argument, it is valid to access `hco_namespace.name` and it will be the namespace name string. Code review should not flag `hco_namespace.name` as a potential `AttributeError` when the value originates from the `hco_namespace` fixture (i.e., passed in via the fixture parameter); only warn if the value was assigned/derived from something other than the fixture.

Learnt from: josemacassan
Repo: RedHatQE/openshift-virtualization-tests PR: 5003
File: tests/storage/upgrade/constants.py:5-9
Timestamp: 2026-05-29T07:28:31.170Z
Learning: Do not require explicit type annotations for module-level string constants declared in test modules (e.g., `FOO = "bar"` in files under `tests/`). Treat this as an exception to any broader "Type hints are MANDATORY" guideline: only enforce type hints for public functions in `libs/` and `utilities/`, not for simple module-level constant assignments in `tests/`.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 4954
File: tests/network/bgp/evpn/libevpn.py:77-77
Timestamp: 2026-06-01T13:36:34.844Z
Learning: In this repository’s Python code (especially under tests/), for context-manager methods named `__enter__`, do not require `typing.Self` as the return type when the containing class name is already known/declared above the method. It is acceptable to annotate `__enter__` as returning the concrete class name (e.g., `def __enter__(self) -> EndpointTcpClient:`). `typing.Self` may be used, but it must not be mandated. Do not flag `__enter__` annotations of the form `-> ClassName` as needing to be changed to `-> Self`.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 4954
File: .flake8:4-4
Timestamp: 2026-06-01T14:00:39.271Z
Learning: When reviewing the “smoke-marked” tests in this repository (i.e., tests under the tests/ tree), don’t conclude that there is “no smoke dependency path” until you verify the full transitive import/fixture chain. Specifically, trace both direct imports and transitive imports through shared pytest fixtures like tests/storage/conftest.py, and through any modules those fixtures import, to confirm whether the smoke tests ultimately depend on utilities modules such as utilities/storage.py, utilities/hco.py (e.g., wait_for_hco_conditions), utilities/infra.py, and utilities/virt.py.

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.

⚠️ This thread was automatically unresolved because it was resolved without a substantive response. Please address the review comment and explain how it was resolved before resolving this thread again.

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.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== tests/storage/snapshots/conftest.py ==="
grep -n "pytest_testconfig" tests/storage/snapshots/conftest.py

echo
echo "=== tests/storage/test_hotplug.py ==="
grep -n "pytest_testconfig" tests/storage/test_hotplug.py

Length of output: 15295



@openshift-virtualization-qe-bot-3, here is the current resolution status:

[SEVERITY: HIGH]tests/storage/snapshots/conftest.py line 14 ✅ Fixed in commit 4fc400e:

from pytest_testconfig import config as py_config  # correct

[SEVERITY: HIGH]tests/storage/test_hotplug.py line 13 ❌ Still broken:

from pytest_testconfig import py_config  # wrong — imports internal name

Why this matters: py_config is an internal implementation detail of the pytest-testconfig library. The public API exports config. If the library's internals change, from pytest_testconfig import py_config will raise an ImportError at collection time—blocking all tests in that file, not just the ones that use the bad import. The same one-line fix must be applied to tests/storage/test_hotplug.py:

-from pytest_testconfig import py_config
+from pytest_testconfig import config as py_config

This thread cannot be resolved until tests/storage/test_hotplug.py is updated to match the pattern already applied to tests/storage/snapshots/conftest.py.


🧬 Code Graph Analysis Results

tests/storage/snapshots/conftest.py

[L50-L90] windows_vm_for_snapshot (decides between golden-image + DataSource vs create_windows19_vm, then waits for Windows boot when using golden images)

`@pytest.fixture`()
def windows_vm_for_snapshot(
    request,
    namespace,
    unprivileged_client,
    modern_cpu_for_migration,
    storage_class_matrix_snapshot_matrix__module__,
    golden_images_namespace,
):
    win_ds_name = py_config.get("win_golden_image_name")
    if win_ds_name:
        data_source = DataSource(
            namespace=golden_images_namespace.name,
            name=win_ds_name,
            client=golden_images_namespace.client,
            ensure_exists=True,
        )
        with vm_instance_from_template(
            request={
                "vm_name": request.param["vm_name"],
                "template_labels": WIN2022_GOLDEN_IMAGE_TEMPLATE_LABELS,
                "ssh": True,
                "os_version": WIN2022_GOLDEN_IMAGE_OS_VERSION,
            },
            unprivileged_client=unprivileged_client,
            namespace=namespace,
            data_source=data_source,
        ) as vm:
            wait_for_windows_vm(vm=vm, version=WIN2022_GOLDEN_IMAGE_OS_VERSION)
            yield vm
    else:
        with create_windows19_vm(
            dv_name=request.param["dv_name"],
            namespace=namespace.name,
            client=unprivileged_client,
            vm_name=request.param["vm_name"],
            cpu_model=modern_cpu_for_migration,
            storage_class=[*storage_class_matrix_snapshot_matrix__module__][0],
        ) as vm:
            yield vm

[L92-L107] windows_snapshot (creates a VirtualMachineSnapshot for the VM)

`@pytest.fixture`()
def windows_snapshot(
    snapshot_windows_directory,
    windows_vm_for_snapshot,
):
    with VirtualMachineSnapshot(
        name="windows-snapshot",
        namespace=windows_vm_for_snapshot.namespace,
        vm_name=windows_vm_for_snapshot.name,
    ) as snapshot:
        yield snapshot

[L111-L123] snapshot_dirctory_removed (waits snapshot ready, deletes the Windows directory over SSH, asserts it’s gone, then stops the VM)

`@pytest.fixture`()
def snapshot_dirctory_removed(windows_vm_for_snapshot, windows_snapshot):
    windows_snapshot.wait_ready_to_use(timeout=TIMEOUT_10MIN)
    cmd = shlex.split(
        f'powershell -command "Remove-Item -Path {WINDOWS_DIRECTORY_PATH} -Recurse"',
    )
    run_ssh_commands(host=windows_vm_for_snapshot.ssh_exec, commands=cmd, wait_timeout=TIMEOUT_2MIN, sleep=TIMEOUT_5SEC)
    assert_windows_directory_existence(
        expected_result=False,
        windows_vm=windows_vm_for_snapshot,
        directory_path=WINDOWS_DIRECTORY_PATH,
    )
    windows_vm_for_snapshot.stop(wait=True)

[L125-L133] file_created_during_snapshot (creates files over SSH during snapshot, waits for snapshot completion, then stops the VM)

`@pytest.fixture`()
def file_created_during_snapshot(windows_vm_for_snapshot, windows_snapshot):
    file = f"{WINDOWS_DIRECTORY_PATH}\\file.txt"
    cmd = shlex.split(
        f'powershell -command "for($i=1; $i -le 100; $i++){{$i| Out-File -FilePath {file} -Append}}"',
    )
    run_ssh_commands(host=windows_vm_for_snapshot.ssh_exec, commands=cmd, wait_timeout=TIMEOUT_2MIN, sleep=TIMEOUT_5SEC)
    windows_snapshot.wait_snapshot_done(timeout=TIMEOUT_10MIN)
    windows_vm_for_snapshot.stop(wait=True)

tests/conftest.py

[L400-L433] unprivileged_client (authenticates as UNPRIVILEGED_USER using exported_kubeconfig, yields an unprivileged client; otherwise yields admin_client)

def unprivileged_client(
    skip_unprivileged_client,
    admin_client,
    unprivileged_secret,
    identity_provider_with_htpasswd,
    exported_kubeconfig,
):
    """
    Provides none privilege API client
    """
    if skip_unprivileged_client:
        LOGGER.info("no_unprivileged_client was set, using admin_client")
        yield admin_client

    else:
        current_user = get_oc_whoami_username()
        if login_with_user_password(
            api_address=admin_client.configuration.host,
            user=UNPRIVILEGED_USER,
            password=UNPRIVILEGED_PASSWORD,
        ):  # Login to an unprivileged account
            with open(exported_kubeconfig) as fd:
                kubeconfig_content = yaml.safe_load(fd)
            unprivileged_context = kubeconfig_content["current-context"]

            # Get back to an admin account
            login_with_user_password(
                api_address=admin_client.configuration.host,
                user=current_user.strip(),
            )
            yield get_client(config_file=exported_kubeconfig, context=unprivileged_context)

        else:
            yield admin_client

[L680-L693] namespace (creates a namespace with optional use of unprivileged client based on request.param)

def namespace(request, admin_client, unprivileged_client):
    """
    To create namespace using admin client, pass {"use_unprivileged_client": False} to request.param
    (default for "use_unprivileged_client" is True)
    """
    use_unprivileged_client = getattr(request, "param", {}).get("use_unprivileged_client", True)
    teardown = getattr(request, "param", {}).get("teardown", True)
    unprivileged_client = unprivileged_client if use_unprivileged_client else None
    yield from create_ns(
        unprivileged_client=unprivileged_client,
        admin_client=admin_client,
        name=generate_namespace_name(file_path=request.fspath.strpath.split(f"{os.path.dirname(__file__)}/")[1]),
        teardown=teardown,
    )

[L1109-L1116] golden_images_namespace (returns an existing Namespace matching py_config["golden_images_namespace"])

def golden_images_namespace(
    admin_client,
):
    for ns in Namespace.get(
        name=py_config["golden_images_namespace"],
        client=admin_client,
    ):
        return ns

utilities/virt.py

[L2074-L2145] vm_instance_from_template (creates a VM from template/data source, optionally starts it, yields the VM)

def vm_instance_from_template(
    request,
    unprivileged_client,
    namespace,
    data_source=None,
    data_volume_template=None,
    existing_data_volume=None,
    cloud_init_data=None,
    node_selector=None,
    vm_cpu_model=None,
    vm_cpu_flags=None,
    host_device_name=None,
    gpu_name=None,
    vm_affinity=None,
):
    """Create a VM from template and start it (start step could be skipped by setting
    request.param['start_vm'] to False.

    Prerequisite - a DV must be created prior to VM creation.

    Args:
        data_source (obj `DataSource`): DS object points to a golden image PVC.
        data_volume_template (dict): dataVolumeTemplates dict; will replace dataVolumeTemplates in VM yaml
        existing_data_volume (obj `DataVolume`: DV resource): existing DV to be consumed directly (not cloned)

    Yields:
        obj `VirtualMachine`: VM resource

    """
    params = request.param if hasattr(request, "param") else request
    vm_name = params["vm_name"].replace(".", "-").lower()
    with VirtualMachineForTestsFromTemplate(
        name=vm_name,
        namespace=namespace.name,
        client=unprivileged_client,
        labels=Template.generate_template_labels(**params["template_labels"]),
        data_source=data_source,
        data_volume_template=data_volume_template,
        existing_data_volume=existing_data_volume,
        vm_dict=params.get("vm_dict"),
        cpu_cores=params.get("cpu_cores"),
        cpu_threads=params.get("cpu_threads"),
        memory_requests=params.get("memory_requests"),
        network_model=params.get("network_model"),
        network_multiqueue=params.get("network_multiqueue"),
        cloud_init_data=cloud_init_data,
        attached_secret=params.get("attached_secret"),
        node_selector=node_selector,
        diskless_vm=params.get("diskless_vm"),
        cpu_model=params.get("cpu_model") or vm_cpu_model,
        cpu_flags=params.get("cpu_flags") or vm_cpu_flags,
        cpu_placement=params.get("cpu_placement"),
        isolate_emulator_thread=params.get("isolate_emulator_thread"),
        iothreads_policy=params.get("iothreads_policy"),
        dedicated_iothread=params.get("dedicated_iothread"),
        ssh=params.get("ssh", True),
        disk_options_vm=params.get("disk_io_option"),
        host_device_name=params.get("host_device_name") or host_device_name,
        gpu_name=params.get("gpu_name") or gpu_name,
        cloned_dv_size=params.get("cloned_dv_size"),
        vhostmd=params.get("vhostmd"),
        machine_type=params.get("machine_type"),
        eviction_strategy=params.get("eviction_strategy"),
        vm_affinity=vm_affinity,
    ) as vm:
        if params.get("start_vm", True):
            running_vm(
                vm=vm,
                wait_for_interfaces=params.get("guest_agent", True),
                check_ssh_connectivity=vm.ssh,
            )
        yield vm

[L1709-L1724] wait_for_windows_vm (polls via wmic os get Caption over SSH until version appears; returns True when matched)

def wait_for_windows_vm(vm, version, timeout=TIMEOUT_25MIN):
    """
    Samples Windows VM; wait for it to complete the boot process.
    """

    LOGGER.info(f"Windows VM {vm.name} booting up, will attempt to access it up to {round(timeout / 60)} minutes.")

    sampler = TimeoutSampler(
        wait_timeout=timeout,
        sleep=15,
        func=vm.ssh_exec.run_command,
        command=shlex.split("wmic os get Caption /value"),
    )
    for sample in sampler:
        if version in str(sample):
            return True

tests/storage/utils.py

[L229-L260] set_permissions (creates a ClusterRole and RoleBinding, yields control to the caller)

def set_permissions(
    client: DynamicClient,
    role_name: str,
    role_api_groups: list[str],
    verbs: list[str],
    permissions_to_resources: list[str],
    binding_name: str,
    namespace: str,
    subjects_name: str,
    subjects_kind: str = "User",
    subjects_api_group: str | None = None,
    subjects_namespace: str | None = None,
) -> Generator:
    with create_cluster_role(
        client=client,
        name=role_name,
        api_groups=role_api_groups,
        permissions_to_resources=permissions_to_resources,
        verbs=verbs,
    ) as cluster_role:
        with create_role_binding(
            client=client,
            name=binding_name,
            namespace=namespace,
            subjects_kind=subjects_kind,
            subjects_name=subjects_name,
            subjects_api_group=subjects_api_group,
            subjects_namespace=subjects_namespace,
            role_ref_kind=cluster_role.kind,
            role_ref_name=cluster_role.name,
        ):
            yield

[L360-L388] create_windows19_vm (creates a DataVolume from an HTTP source and then a VM from a template, starts VM, yields VM, then cleans up secrets/config maps)

def create_windows19_vm(dv_name, namespace, client, vm_name, cpu_model, storage_class):
    artifactory_secret = get_artifactory_secret(namespace=namespace)
    artifactory_config_map = get_artifactory_config_map(namespace=namespace)
    dv = DataVolume(
        name=dv_name,
        namespace=namespace,
        storage_class=storage_class,
        source="http",
        url=get_http_image_url(image_directory=Images.Windows.UEFI_WIN_DIR, image_name=Images.Windows.WIN2k19_IMG),
        size=Images.Windows.DEFAULT_DV_SIZE,
        client=client,
        api_name="storage",
        secret=artifactory_secret,
        cert_configmap=artifactory_config_map.name,
    )
    dv.to_dict()
    with VirtualMachineForTestsFromTemplate(
        name=vm_name,
        namespace=namespace,
        client=client,
        labels=Template.generate_template_labels(**py_config["latest_windows_os_dict"]["template_labels"]),
        cpu_model=cpu_model,
        data_volume_template={"metadata": dv.res["metadata"], "spec": dv.res["spec"]},
    ) as vm:
        running_vm(vm=vm)
        yield vm
    cleanup_artifactory_secret_and_config_map(
        artifactory_secret=artifactory_secret, artifactory_config_map=artifactory_config_map
    )

[L459-L466] assert_windows_directory_existence (runs PowerShell Test-Path over SSH, parses result, asserts equality with expected_result)

def assert_windows_directory_existence(
    expected_result: bool, windows_vm: VirtualMachineForTests, directory_path: str
) -> None:
    cmd = shlex.split(f'powershell -command "Test-Path -Path {directory_path}"')
    out = run_ssh_commands(host=windows_vm.ssh_exec, commands=cmd, wait_timeout=TIMEOUT_2MIN, sleep=TIMEOUT_5SEC)[
        0
    ].strip()
    assert expected_result == ast.literal_eval(out), f"Directory exist: {out}, expected result: {expected_result}"

[L469-L478] create_windows_directory (runs PowerShell New-Item ... -ItemType Directory -Force, then asserts directory exists)

def create_windows_directory(windows_vm: VirtualMachineForTests, directory_path: str) -> None:
    cmd = shlex.split(
        f'powershell -command "New-Item -Path {directory_path} -ItemType Directory -Force"',
    )
    run_ssh_commands(host=windows_vm.ssh_exec, commands=cmd, wait_timeout=TIMEOUT_2MIN, sleep=TIMEOUT_5SEC)
    assert_windows_directory_existence(
        expected_result=True,
        windows_vm=windows_vm,
        directory_path=directory_path,
    )

utilities/virt.py (SSH property used by the fixtures)

[L1169-L1186] ssh_exec (constructs SSH host/executor; uses User vs UserWithPKey depending on VM flavor)

def ssh_exec(self):
        # In order to use this property VM should be created with ssh=True
        self.username = self.username or self.login_params["username"]
        self.password = self.password or self.login_params["password"]

        LOGGER.info(f"SSH command: ssh -o 'ProxyCommand={self.virtctl_port_forward_cmd}' {self.username}@{self.name}")
        host = Host(hostname=self.name)
        # For SSH using a key, the public key needs to reside on the server.
        # As the tests use a given set of credentials, this cannot be done in Windows/Cirros.
        if any(flavor in self.os_flavor for flavor in FLAVORS_EXCLUDED_FROM_CLOUD_INIT):
            host_user = user.User(name=self.username, password=self.password)
        else:
            host_user = user.UserWithPKey(name=self.username, private_key=os.environ[CNV_VM_SSH_KEY_PATH])
        host.executor_user = host_user
        host.executor_factory = ssh.RemoteExecutorFactory(
            sock=self.virtctl_port_forward_cmd,
        )
        return host

🧠 Learnings used
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: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 2348
File: tests/observability/upgrade/conftest.py:1-7
Timestamp: 2026-01-26T10:11:23.629Z
Learning: In conftest.py files that define session-scoped fixtures which provision resources (e.g., VMs, namespaces) for upgrade testing, logging imports and structured INFO logs for setup are optional. Prefer quieter fixture setup to reduce log noise unless debugging is required. Apply this guideline across similar conftest.py fixtures that perform straightforward resource provisioning.

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: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 3649
File: tests/network/user_defined_network/ip_specification/conftest.py:32-48
Timestamp: 2026-01-29T15:01:46.322Z
Learning: In test fixtures (e.g., tests/network/user_defined_network/ip_specification/conftest.py and other VM-related conftest.py files), after vm.start(), prefer calling vm.wait_for_agent_connected() as the validation step. Do not add vm.wait_for_ready_status(status=True) beforehand, since wait_for_agent_connected() ensures the guest OS is actually running (not just powered on) and provides a stronger, more reliable readiness check for test initialization.

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: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 3930
File: tests/network/non_functional/ip_persistence/conftest.py:66-73
Timestamp: 2026-02-23T18:07:57.649Z
Learning: In all conftest.py files under the tests directory, do not flag or require fixes for Ruff FBT001 (Boolean-typed positional argument in function definition) in pytest fixture definitions. Pytest injects fixture parameters by name through dependency injection, so boolean positional arguments in fixture definitions are a false positive in this context. Apply this exception across all tests/* fixtures and document this behavior in review guidelines.

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: 4053
File: tests/storage/cross_cluster_live_migration/conftest.py:47-55
Timestamp: 2026-03-03T12:01:13.888Z
Learning: In test configuration files (for example tests/.../conftest.py), log the absence of optional CLI arguments or configurations at INFO level. Use WARNING only when missing configuration could cause a problem or be unusual. For parameters that may be present or absent by design, prefer INFO to reflect normality.

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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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`. 

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: dalia-frank
Repo: RedHatQE/openshift-virtualization-tests PR: 4603
File: tests/data_protection/oadp/test_velero.py:101-130
Timestamp: 2026-04-27T15:40:31.167Z
Learning: When reviewing tests in RedHatQE/openshift-virtualization-tests, do not require STD-first workflow and STP/RFE/Jira-epic module docstring/traceability for tests that are being re-enabled after previously being blocked by a product bug (e.g., after a CNV Jira bug fix). Only enforce these STD-first and STP/RFE/Jira-epic module docstring requirements for genuinely new feature tests; previously blocked tests that are now unblocked/re-enabled should not be flagged as missing traceability.

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4569
File: tests/network/user_defined_network/rhel9_rhel10_cluster/test_connectivity.py:17-51
Timestamp: 2026-05-03T14:47:13.096Z
Learning: In this repository’s pytest suite (files under `tests/`), it is acceptable to have identically named `test_*` functions in different test modules (e.g., same function name in different `.../test_*.py` files). Do not request renaming solely to disambiguate function names across modules, since pytest node IDs remain unique and unambiguous due to the module path prefix. The team accepts the trade-off that `pytest -k <name>` will match tests in all modules containing that name.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 4701
File: tests/virt/node/general/test_windows_vtpm_bitlocker.py:50-52
Timestamp: 2026-05-03T15:38:09.624Z
Learning: During review of PRs that are lint cleanups or tooling/version bumps, do not flag code-quality issues for patterns that pre-existed before the PR. Specifically, if the diff does not introduce/modify constructs such as nested `if` blocks or unnecessary list comprehensions, treat them as known/deferred and leave them for dedicated follow-up cleanup PRs. Only raise issues when the PR itself adds, changes, or refactors the problematic code.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 4725
File: utilities/console.py:54-59
Timestamp: 2026-05-04T13:45:29.122Z
Learning: During review of RedHatQE/openshift-virtualization-tests “lint-cleanup” PRs (e.g., changes targeting lint issues like stale noqa/utf-8 headers), do not flag existing `# type: ignore` directives that were already present before the PR and were not introduced or modified by the PR. Only raise findings for `# type: ignore` suppressions that the PR itself adds, changes, or otherwise makes newly effective (i.e., they appear in the diff as additions/edits).

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 4725
File: tests/virt/cluster/common_templates/centos/test_centos_os_support.py:78-83
Timestamp: 2026-05-04T13:45:33.892Z
Learning: When reviewing lint-cleanup or formatting-only pull requests in this repo (e.g., changes like removing/updating `# noqa` comments or UTF-8 headers), do not raise findings for code patterns that already existed before the PR. Specifically, if a problematic construct such as `.is_connective(tcp_timeout=120)` was present in the base branch, suppress that finding and only raise issues when the PR itself introduces or modifies that construct (i.e., the diff adds/changes the call or its arguments). Apply this rule across all Python files (`**/*.py`).

Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 4739
File: tests/virt/node/descheduler/conftest.py:2-2
Timestamp: 2026-05-05T17:01:15.294Z
Learning: In this repo’s Python code, it’s acceptable (and preferred by convention) to build `run_command` inputs using `shlex.split(f"<command> {arg}")` rather than converting to direct list literals like `['oc', 'adm', 'uncordon', name]`. During code review, generally don’t flag `shlex.split(...)` usage for `run_command` calls and don’t suggest replacing it with list literals; the string-form pattern is used to keep commands readable and consistent with how they’re typed in a terminal.

Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 4739
File: tests/virt/node/descheduler/conftest.py:145-145
Timestamp: 2026-05-05T17:27:32.109Z
Learning: In this repo’s Python tests, `pyhelper_utils.shell.run_command` defaults to `check=True` (so it raises `subprocess.CalledProcessError` on non-zero exit). Therefore, don’t flag missing return-code handling/rc checks for bare calls like `run_command(...)` (or calls where `check` is not explicitly provided). Only flag cases where `check=False` is explicitly passed and the exit code/return value is ignored or not otherwise handled.

Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 4739
File: tests/virt/node/descheduler/conftest.py:142-146
Timestamp: 2026-05-05T18:28:01.097Z
Learning: In this repository, ignore Ruff rule PT022 in Python test files under `tests/`. If PT022 is triggered in a `pytest` fixture that uses `yield` but has no teardown code, treat it as an acceptable low-value nitpick and do not suggest changing the fixture to use `return` or otherwise flag the issue during code review.

Learnt from: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 4162
File: tests/install_upgrade_operators/crypto_policy/utils.py:320-323
Timestamp: 2026-05-07T12:34:42.589Z
Learning: When parsing the output of `openssl list -tls-groups`, remember it prints TLS group names on a single colon-separated line (e.g., `secp256r1:X25519:SecP256r1MLKEM768:...`). Parse individual TLS group names by splitting on `:` (e.g., `output.strip().split(':')`) rather than assuming one group per line. In code that specifically handles this `openssl list -tls-groups` output, do not flag `split(':')` as incorrect.

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4772
File: tests/network/l2_bridge/rhel9_rhel10_cluster/test_connectivity.py:20-22
Timestamp: 2026-05-08T12:31:26.895Z
Learning: In RedHatQE/openshift-virtualization-tests, any pytest test already marked with `pytest.mark.mixed_os_nodes` must not also be marked with `pytest.mark.tier3`. The `mixed_os_nodes` marker is responsible for both environment filtering and selecting the dedicated execution lane for dual-stream (mixed RHCOS 9 + RHCOS 10) cluster scenarios. Apply this rule to all test modules under `tests/` that use the `mixed_os_nodes` marker (e.g., `tests/network/l2_bridge/rhel9_rhel10_cluster/test_connectivity.py`).

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4772
File: tests/network/l2_bridge/rhel9_rhel10_cluster/conftest.py:26-26
Timestamp: 2026-05-08T12:32:45.752Z
Learning: In this repository, pytest fixture return annotations that use `collections.abc.Generator` with a single type parameter (e.g., `Generator[NetworkAttachmentDefinition]`) are the accepted shorthand. Do not flag `Generator[X]` as incorrect, and do not require the longer three-parameter form `Generator[X, None, None]` when used as a fixture return annotation. Apply this convention across all `conftest.py` files under `tests/`.

Learnt from: geetikakay
Repo: RedHatQE/openshift-virtualization-tests PR: 4788
File: utilities/os_utils.py:257-262
Timestamp: 2026-05-08T12:49:20.694Z
Learning: In RedHatQE/openshift-virtualization-tests, the Ruff flake8-boolean-trap rules FBT001/FBT002 are intentionally not enabled (pyproject.toml does not select the FBT rules; confirmed via `ruff check --show-settings`). Therefore, do not flag boolean positional parameters as FBT001/FBT002 violations in this repository. If Ruff configuration changes and starts selecting FBT rules, this exception should be reconsidered.

Learnt from: acinko-rh
Repo: RedHatQE/openshift-virtualization-tests PR: 4780
File: tests/storage/utils.py:568-572
Timestamp: 2026-05-12T05:10:24.601Z
Learning: In this repository, Ruff rule UP043 ("unnecessary default type arguments") is enforced. When annotating `collections.abc.Generator` return types, prefer the single-parameter form `Generator[YieldType]` rather than `Generator[YieldType, None, None]`. Explicit `None, None` for the SendType and ReturnType are unnecessary defaults (per PEP 696) and will trigger UP043. Apply this consistently across all Python files.

Learnt from: Anatw
Repo: RedHatQE/openshift-virtualization-tests PR: 4833
File: tests/network/localnet/migration_stuntime/test_migration_stuntime.py:51-51
Timestamp: 2026-05-12T18:18:20.607Z
Learning: In RedHatQE/openshift-virtualization-tests, do not flag or suggest removing Python linter suppressions `# noqa: PID001` in files under `tests/`. `PID001` is a custom flake8 rule enforced by the Polarion ID checker plugin (not a standard Ruff rule). Therefore Ruff’s `RUF102` (“Invalid rule code in `# noqa`: PID001”) is a false positive in this repo. These `# noqa: PID001` comments are intentional and effective, commonly used on base-class `test_*` methods where the Polarion markers are defined on subclass overrides.

Learnt from: Anatw
Repo: RedHatQE/openshift-virtualization-tests PR: 4833
File: tests/network/localnet/migration_stuntime/libstuntime.py:25-25
Timestamp: 2026-05-13T19:23:09.603Z
Learning: In this repository, do not recommend adding `from __future__ import annotations` to fix forward-reference type annotation issues (e.g., Ruff UP037). Follow the established convention: use quoted string type annotations for forward references when the referenced class/type is defined later in the same file (e.g., `"ContinuousPing"`), and prefer `typing.Self` for self-referential return types.

Learnt from: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 4819
File: utilities/unittests/test_bitwarden.py:207-207
Timestamp: 2026-05-18T06:30:56.781Z
Learning: During Ruff/lint rule-enablement PRs in this repository (e.g., when introducing a new rule like PLC0415), it’s acceptable to keep CI green by adding per-line, targeted suppressions for pre-existing violations: add only `# noqa: <single-ruff-rule-id>` at the end of the specific violating line. In this PR context, reviewers should NOT flag these targeted `# noqa: PLC0415` comments as policy violations, assuming the suppression is for a pre-existing issue and is documented in the PR description as a candidate for follow-up cleanup. Do not allow blanket `# noqa` (without a specific rule) or `per-file-ignores`; those remain disallowed.

Learnt from: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 4819
File: utilities/unittests/test_pytest_utils.py:270-270
Timestamp: 2026-05-18T06:31:12.015Z
Learning: In RedHatQE/openshift-virtualization-tests, if a PR is a Ruff rule-enforcement PR and its “Special notes for reviewer” documents that pre-existing Ruff violations are being temporarily handled via per-line suppressions (e.g., `# noqa: PLC0415`) to keep CI green, reviewers should treat those specific `# noqa: <rule>` comments as an agreed, temporary mechanism. Do not flag them as code-quality issues and do not recommend removing, consolidating, or refactoring those suppressions within the same PR; cleanup/remediation is expected to happen in dedicated follow-up PRs instead.

Learnt from: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 4819
File: utilities/unittests/test_data_collector.py:304-304
Timestamp: 2026-05-18T06:31:15.083Z
Learning: When reviewing Python code in this repository for Ruff/linter rule rollouts, do not treat temporary suppression comments as violations in the specific migration scenario where a PR enables a new Ruff rule (e.g., PLC0415) and the PR description explicitly documents that all *pre-existing* violations are being annotated with `# noqa: <RULE>` as a short-lived measure. In that case, only flag `# noqa: <RULE>` suppressions that are newly introduced on code that did not previously violate the rule—i.e., verify via the PR diff against the prior state (and/or prior Ruff findings) that the suppressed line was already violating before the rule was enabled. Ignore suppressions that are covering violations that existed before the new rule rollout and were intentionally bulk-added for cleanup in follow-up PRs.

Learnt from: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 4819
File: utilities/unittests/test_hco.py:501-501
Timestamp: 2026-05-18T06:31:20.848Z
Learning: When reviewing Python code in RedHatQE/openshift-virtualization-tests, avoid flagging Ruff `# noqa: <RULE>` suppressions as issues if they were intentionally added as a temporary measure to keep CI green after a PR enables a new Ruff/lint rule (e.g., PLC0415) and the PR description documents this under "Special notes for reviewer". Treat these suppressions as deferred technical debt. Only flag `# noqa: PLC0415` (and similar rule-specific suppressions) when they are newly introduced without an accompanying documented intent in the PR (and thus appear to be masking a new violation rather than a pre-existing one).

Learnt from: EdDev
Repo: RedHatQE/openshift-virtualization-tests PR: 4878
File: utilities/unittests/test_pytest_utils.py:2194-2197
Timestamp: 2026-05-18T09:09:09.479Z
Learning: In this repository (RedHatQE/openshift-virtualization-tests), do not flag missing return type annotations or missing argument type annotations as Ruff “ANN” rule violations (e.g., ANN001/ANN002/ANN201/ANN202). The repo’s Ruff configuration does not enable ANN rules and only uses `extend-select = ["PLC0415"]`, so missing type annotations should not be treated as ANN lint failures during code review.

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4784
File: libs/vm/affinity.py:104-104
Timestamp: 2026-05-19T07:48:17.119Z
Learning: When using Kubernetes API models like `NodeSelectorRequirement` or `LabelSelectorRequirement` with operators `Exists` or `DoesNotExist`, the `values` field must not be non-empty. It is valid for `values` to be omitted / left as `None` (Python) / passed as `null`—Kubernetes rejects non-empty `values` for these operators, but does not require the field to be present or explicitly set to an empty list. In code reviews, do not treat missing `values=[]` for `Exists`/`DoesNotExist` as a validation issue; only flag cases where `values` is provided with actual elements.

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4784
File: libs/vm/affinity.py:104-104
Timestamp: 2026-05-19T07:48:17.119Z
Learning: When constructing Kubernetes `NodeSelectorRequirement` (or `LabelSelectorRequirement`) objects in code, do not treat `values` being omitted, `None`, or an empty list as an API-validation problem when the requirement’s operator is `Exists` or `DoesNotExist`. Per the Kubernetes API spec, these operators only require that the `values` array is not non-empty (i.e., it must be empty); they do not require the field to be explicitly present as `[]`. Therefore, reviewers should not flag `values=None`/missing `values` for `Exists`/`DoesNotExist`.

Learnt from: hmeir
Repo: RedHatQE/openshift-virtualization-tests PR: 4880
File: tests/install_upgrade_operators/deployment/conftest.py:25-28
Timestamp: 2026-05-19T08:28:08.971Z
Learning: In this repository, when reviewing targeted cherry-pick/backport PRs, do not fail the change on pytest fixture naming conventions if the fixture uses an action-verb name (e.g., `xfail_if_<condition>`) and its body calls `pytest.xfail(...)` as a side effect without returning or yielding a value. Treat this fixture pattern as acceptable for the backport until the deferred refactor to noun-based fixture names is done; for non-backport work, follow the usual fixture naming rules.

Learnt from: acinko-rh
Repo: RedHatQE/openshift-virtualization-tests PR: 4780
File: tests/storage/snapshots/test_snapshots.py:267-299
Timestamp: 2026-05-20T08:46:30.219Z
Learning: For Python tests under tests/storage/, follow the existing traceability convention: use only `pytest.mark.polarion()` for test traceability. Do not treat missing STP/RFE/Jira-epic links (e.g., absent module-docstring links) as a HIGH-severity finding.

When reviewing changes that add new tests/fixtures, only flag missing STP/RFE/Jira-epic links as LOW/informational if the target file already has the established “STD” traceability pattern (i.e., that file already includes STP/RFE/Jira-epic links in its existing traceability mechanism such as the module docstring). Otherwise, leave these omissions unflagged and rely on `pytest.mark.polarion()` as the traceability mechanism.

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 4962
File: tests/network/l2_bridge/nad_ref_change/lib_helpers.py:80-81
Timestamp: 2026-05-25T09:13:27.011Z
Learning: When reviewing Python code in this repository, do NOT flag short loop variables like `i` (or other short names) as non-descriptive when they are used as the index in a simple `enumerate()` loop where the variable’s role is immediately obvious from context and the loop body is a single straightforward statement (e.g., `for i, addresses in enumerate(ip_addresses): ethernets[f"eth{i + 1}"] = ...`). In these cases, keep the short index variable and do not recommend renaming it to a longer form like `interface_index`.

Learnt from: Anatw
Repo: RedHatQE/openshift-virtualization-tests PR: 4833
File: tests/network/localnet/migration_stuntime/test_migration_stuntime.py:57-57
Timestamp: 2026-05-25T09:57:03.042Z
Learning: In pytest test files under `tests/`, when using `pytest.mark.parametrize(..., indirect=True)`, ensure the parametrized `param_name` is present in the test function signature (pytest will fail at collection time if it’s missing). When reviewing lints such as `ARG002` (unused argument), do not flag that `param_name` as unused if it only exists to trigger indirect fixtures or to drive other fixtures via the fixture dependency chain— even if the test body never references the value directly.

Learnt from: rlobillo
Repo: RedHatQE/openshift-virtualization-tests PR: 4983
File: utilities/hco.py:376-378
Timestamp: 2026-05-26T15:52:31.613Z
Learning: For Python files in this repo, don’t raise review findings for missing type hints or missing/Google-style docstrings on an existing function when the PR’s only functional change is adding one or more new parameters to that function and the PR does not otherwise refactor or substantially rewrite its body/signature. Treat type-annotation/docstring improvements as out of scope for focused parameter-add PRs and defer them to a follow-up. Only raise missing type-hint or docstring issues when the PR introduces an entirely new function or substantially rewrites an existing one.

Learnt from: RoniKishner
Repo: RedHatQE/openshift-virtualization-tests PR: 4985
File: tests/conftest.py:2632-2634
Timestamp: 2026-05-28T08:24:43.967Z
Learning: In this repository, do not flag missing type hints (parameter/return annotations) on pytest fixture functions—i.e., functions decorated with pytest.fixture (commonly defined in tests/*/conftest.py). Type hints are expected for regular Python functions (especially under utilities/ and libs/), but pytest fixtures may omit annotations consistently to avoid review noise.

Learnt from: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 5023
File: tests/install_upgrade_operators/crypto_policy/utils.py:299-314
Timestamp: 2026-05-28T12:55:07.435Z
Learning: In this repo’s test suite, the `hco_namespace` pytest fixture (defined in `tests/conftest.py`) returns an OpenShift `Namespace` Resource object created by `utilities.hco.get_hco_namespace(...)`. When a function receives `hco_namespace` as a fixture argument, it is valid to access `hco_namespace.name` and it will be the namespace name string. Code review should not flag `hco_namespace.name` as a potential `AttributeError` when the value originates from the `hco_namespace` fixture (i.e., passed in via the fixture parameter); only warn if the value was assigned/derived from something other than the fixture.

Learnt from: josemacassan
Repo: RedHatQE/openshift-virtualization-tests PR: 5003
File: tests/storage/upgrade/constants.py:5-9
Timestamp: 2026-05-29T07:28:31.170Z
Learning: Do not require explicit type annotations for module-level string constants declared in test modules (e.g., `FOO = "bar"` in files under `tests/`). Treat this as an exception to any broader "Type hints are MANDATORY" guideline: only enforce type hints for public functions in `libs/` and `utilities/`, not for simple module-level constant assignments in `tests/`.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 4954
File: tests/network/bgp/evpn/libevpn.py:77-77
Timestamp: 2026-06-01T13:36:34.844Z
Learning: In this repository’s Python code (especially under tests/), for context-manager methods named `__enter__`, do not require `typing.Self` as the return type when the containing class name is already known/declared above the method. It is acceptable to annotate `__enter__` as returning the concrete class name (e.g., `def __enter__(self) -> EndpointTcpClient:`). `typing.Self` may be used, but it must not be mandated. Do not flag `__enter__` annotations of the form `-> ClassName` as needing to be changed to `-> Self`.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 4954
File: .flake8:4-4
Timestamp: 2026-06-01T14:00:39.271Z
Learning: When reviewing the “smoke-marked” tests in this repository (i.e., tests under the tests/ tree), don’t conclude that there is “no smoke dependency path” until you verify the full transitive import/fixture chain. Specifically, trace both direct imports and transitive imports through shared pytest fixtures like tests/storage/conftest.py, and through any modules those fixtures import, to confirm whether the smoke tests ultimately depend on utilities modules such as utilities/storage.py, utilities/hco.py (e.g., wait_for_hco_conditions), utilities/infra.py, and utilities/virt.py.

Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 5039
File: tests/network/l2_bridge/nad_ref_change/lib_helpers.py:1-1
Timestamp: 2026-06-02T21:16:58.118Z
Learning: In RedHatQE/openshift-virtualization-tests, if a PR only relocates functions into shared/helper libraries and updates the corresponding import paths in test files—without any logic/behavior change in the moved functions—do not require full re-execution of the affected caller tests. Instead, at most run `pytest --collect-only` (for the relevant test modules) to confirm the updated imports resolve. Require full re-execution of caller tests only when the moved function’s implementation changes in a way that could affect behavior (e.g., different logic, side effects, return values, error handling, or fixture interaction).

Comment thread tests/storage/test_hotplug.py
@openshift-virtualization-qe-bot-4

Copy link
Copy Markdown

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

Adjust 5 existing tier3 Windows storage tests to optionally use a
pre-built golden image DataSource instead of Artifactory. When
win_golden_image_name is passed via --tc, fixtures create VMs from
the DataSource; otherwise the existing Artifactory/registry path
is unchanged.

Tests adjusted:
- test_successful_vm_from_cloned_dv_windows (CNV-3638)
- test_windows_hotplug (CNV-6525)
- test_online_windows_vm_successful_restore (CNV-8307)
- test_write_to_file_while_snapshot (CNV-8536)
- test_windows_memory_dump (CNV-8518)

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Ahmad Hafe <ahafe@redhat.com>
@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

Clean rebase detected — no code changes compared to previous head (f2501b3).
The following labels were preserved: commented-coderabbitai[bot], commented-openshift-virtualization-qe-bot-3.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants