Skip to content

CherryPicked: [cnv-4.18] Fix test vm free memory bytes tests #1142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 5, 2025

Conversation

OhadRevah
Copy link
Contributor

@OhadRevah OhadRevah commented Jun 4, 2025

Short description:

The test for the metric kubevirt_vm_container_free_memory_bytes_based_on_working_set_bytes is flaky, in this PR I am fixing it by adding sampler to vm_memory_working_set_bytes in order to make sure that the value is found.

More details:
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for reviewer:
jira-ticket:

https://issues.redhat.com/browse/CNV-62980

Summary by CodeRabbit

  • New Features

    • Enhanced cluster and virtualization test environment validation, including new pre-test checks for hardware and configuration prerequisites.
    • Added new test markers for specialized infrastructure, resource requirements, and hardware features (e.g., GPU, SR-IOV, NUMA, CPU manager).
    • Expanded storage class matrix configuration options and improved documentation for storage class usage.
  • Bug Fixes

    • Improved test reliability by converting conditional test skips to explicit failures for unsupported cluster features.
    • Updated test logic to ensure accurate detection and reporting of unsupported or missing cluster capabilities.
  • Refactor

    • Standardized and clarified test fixture and parameter naming across storage and virtualization tests.
    • Consolidated and simplified permission and role binding logic for storage-related tests.
    • Replaced skip logic with expected failure (xfail) markers for unsupported scenarios.
  • Documentation

    • Updated user guides and README with clearer storage class configuration instructions and new usage examples.
  • Chores

    • Updated dependency versions, image tags, and configuration files for improved compatibility and tracking.
    • Added and updated approvers in OWNERS files for various directories.
    • Improved test utility functions and added new helpers for cluster validation and GPU information retrieval.

* Test kubevirt_vmi_migration_data_total_bytes

Test for kubevirt_vmi_migration_data_total_bytes metric.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Changed test_kubevirt_vmi_migration_metrics last_overtime

changed the last_overtime time to check the value start
of the migration until the current time to avoid failures
when there is one failure and it runs must gahter and then
and the time passed make the test seem like it's failing but its not.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix vm free_memory_bytes metric based on working set

The test for the metric kubevirt_vm_container_free_memory_bytes_based_on_working_set_bytes
is flaky, in this PR I am fixing it by adding sampler to vm_memory_working_set_bytes
in order to make sure that the value is found.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: vsibirsk <[email protected]>
Copy link

coderabbitai bot commented Jun 4, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update refactors and expands the test infrastructure for virtualization and storage, shifting from skip-based to fail/xfail-based test gating for missing cluster features. It introduces new fixtures, test markers, and configuration utilities, updates storage class matrix handling, and adds new or revised tests and helper functions for metrics, migration, and restricted namespace cloning.

Changes

Files/Paths Change Summary
Makefile, pyproject.toml, tox.ini Updated image tags, dependency versions, and test environment branches/versions.
README.md Expanded documentation for storage class matrix usage and examples.
conftest.py, tests/conftest.py, tests/network/conftest.py, tests/network/connectivity/conftest.py, tests/network/general/test_dhcp6_configurations_on_ipv4_single_stack_cluster.py, tests/virt/cluster/common_templates/conftest.py, tests/virt/conftest.py Refactored/renamed fixtures for cluster feature gating; replaced skip with fail/xfail; added/updated CLI options and sanity checks.
pytest.ini Expanded/updated pytest markers for new test requirements and features.
containers/fedora/user-data Added kernel boot parameter to disable predictable network interface names.
tests/global_config.py, tests/global_config_arm64.py, tests/global_config_lvms.py, tests/global_config_sno.py, tests/global_config_sno_hpp.py Refactored/remodeled storage class matrices, removed/replaced HPP-related constants, added new config modules.
tests/after_cluster_deploy_sanity/test_after_cluster_deploy_sanity.py Added a test for verifying common CPU models in the cluster.
tests/install_upgrade_operators/conftest.py, tests/install_upgrade_operators/daemonset/test_daemonset_params.py, tests/install_upgrade_operators/pod_validation/test_pod_spec.py, tests/install_upgrade_operators/security/scc/test_cnv_pods_scc.py Updated Jira issue references and related fixture/test names.
tests/install_upgrade_operators/must_gather/conftest.py, tests/install_upgrade_operators/must_gather/test_must_gather_vms.py Refactored network device/NAD fixture usage, synchronized node marking, updated Jira references.
tests/install_upgrade_operators/csv/csv_permissions_audit/csv-permissions.yaml Added new cluster permissions for secrets to HCO role.
tests/infrastructure/workload_availability/remediation_fencing/conftest.py, tests/infrastructure/workload_availability/remediation_fencing/test_nodehealthcheck_default_remediation.py Removed Jira-related skip fixture; updated test fixture usage.
tests/network/checkup_framework/test_checkup_dpdk.py, tests/network/checkup_framework/test_checkup_framework.py Updated/added test markers for DPDK, SR-IOV, tier3; removed skip fixture for DPDK.
tests/network/connectivity/test_ovs_linux_bridge.py, tests/network/connectivity/test_pod_network.py, tests/network/flat_overlay/test_flat_overlay.py, tests/network/jumbo_frame/test_bond.py, tests/network/jumbo_frame/test_bridge.py, tests/network/jumbo_frame/test_pod_network_ovn.py, tests/network/l2_bridge/test_bridge_nic_hot_plug.py, tests/network/migration/test_migration.py, tests/network/service_mesh/conftest.py, tests/network/service_mesh/test_service_mesh.py, tests/network/sriov/conftest.py, tests/network/sriov/test_sriov.py, tests/network/user_defined_network/test_user_defined_network.py, tests/network/utils.py Updated/removed skip fixtures; changed test markers; updated fixture dependencies; improved test readiness/wait logic.
tests/observability/metrics/conftest.py, tests/observability/metrics/test_metrics.py, tests/observability/metrics/test_migration_metrics.py Enhanced/retried metric collection, added new fixtures and test classes for allocatable nodes and migration metrics.
tests/storage/OWNERS, tests/data_protection/OWNERS, tests/virt/OWNERS, utilities/OWNERS Updated owner/approver configuration files.
tests/storage/conftest.py, tests/storage/constants.py, tests/storage/restricted_namespace_cloning/conftest.py, tests/storage/restricted_namespace_cloning/constants.py, tests/storage/restricted_namespace_cloning/test_restricted_namespace_cloning.py, tests/storage/restricted_namespace_cloning/test_restricted_namespace_cloning_vms.py, tests/storage/restricted_namespace_cloning/utils.py, tests/storage/snapshots/conftest.py, tests/storage/snapshots/test_snapshots.py, tests/storage/test_libguestfs.py, tests/storage/test_online_resize.py, tests/storage/utils.py Refactored permission/role fixtures, added/renamed constants, extracted utility functions, updated test parameterizations, improved error handling and negative test coverage.
tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py, tests/virt/cluster/common_templates/utils.py, tests/virt/cluster/common_templates/windows/test_windows_custom_options.py, tests/virt/cluster/common_templates/windows/test_windows_os_support.py, tests/virt/cluster/common_templates/windows/test_windows_tablet_device.py Shifted from skip to xfail for old guest agent/RHEL version; updated test markers for high-resource/special infra.
tests/virt/cluster/longevity_tests/test_multi_vm_multi_migration.py, tests/virt/cluster/longevity_tests/test_multi_vm_upgrade_and_reboot.py Removed skip fixtures; added special_infra marker.
tests/virt/cluster/sysprep/test_sysprep.py, tests/virt/cluster/vm_cloning/test_vm_cloning.py, tests/virt/cluster/vm_lifecycle/test_vm_data_persistency.py, tests/virt/cluster/vm_lifecycle/test_vm_run_strategy.py Updated test markers, replaced skip with xfail for specific VM run strategies.
tests/virt/node/conftest.py, tests/virt/node/general/test_disk_io_option.py, tests/virt/node/general/test_networkinterfacemultiqueue_feature.py, tests/virt/node/general/test_oom.py, tests/virt/node/general/test_windows_vtpm_bitlocker.py, tests/virt/node/general/test_wsl2.py Removed skip fixtures, updated test markers for special infra/high resource/gating.
tests/virt/node/gpu/conftest.py, tests/virt/node/gpu/gpu_pci_passthrough/conftest.py, tests/virt/node/gpu/gpu_pci_passthrough/test_rhel_vm_with_gpu_pci_passthrough.py, tests/virt/node/gpu/gpu_pci_passthrough/test_windows_vm_with_gpu_pci_passthrough.py, tests/virt/node/gpu/utils.py, tests/virt/node/gpu/vgpu/test_rhel_vm_with_vgpu.py, tests/virt/node/gpu/vgpu/test_windows_vm_with_vgpu.py Refactored/removed GPU node filtering fixtures, updated test markers and imports, moved GPU info logic to utilities.
tests/virt/node/high_performance_vm/test_high_performance_templates.py, tests/virt/node/high_performance_vm/test_iothreads_policy.py, tests/virt/node/high_performance_vm/test_isolate_emulator_thread.py, tests/virt/node/high_performance_vm/test_numa.py Updated test markers, replaced skip with fail for missing NUMA, removed helper functions.
tests/virt/node/hotplug/test_cpu_memory_hotplug.py Renamed fixture and changed behavior from skip to xfail for Windows memory hot-unplug; updated test markers.
tests/virt/node/hyperv_support/test_hyperv_features_in_vm.py Removed skip fixture for EVMCS support, updated test markers, removed gating mark.
tests/virt/node/migration_and_maintenance/test_node_maintenance.py, tests/virt/node/migration_and_maintenance/test_post_copy_migration.py, tests/virt/node/migration_and_maintenance/test_vm_memory_load_with_migration.py Updated test markers, removed skip fixtures and parameters, revised Jira IDs.
tests/virt/node/node_labeller/cpu_features/test_vm_with_cpu_features.py Renamed skip fixture to fail fixture for AMD CPUs.
tests/virt/node/readonly_disk/test_vm_with_windows_guest_tools.py Updated test markers.
tests/virt/node/workload_density/test_free_page_reporting.py Removed skip fixture for hugepages, added special_infra/hugepage markers.
tests/virt/upgrade/test_upgrade_virt.py Added high_resource_vm marker, removed skip fixture parameter.
utilities/constants.py, utilities/network.py, utilities/pytest_utils.py, utilities/virt.py Added/updated constants for storage classes, Fedora images, volume modes; added/updated utility functions for storage class matrix, bridge NAD, GPU info.

Possibly related PRs

Suggested labels

verified, size/XS, can-be-merged, branch-main, tox:verify-tc-requirement-polarion:passed, tox:verify-bugs-are-open:passed, lgtm-hmeir, lgtm-rnetser, approved-rnetser

Suggested reviewers

  • RoniKishner
  • vsibirsk
  • dshchedr
  • rnetser
  • hmeir

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@openshift-virtualization-qe-bot

Report bugs in Issues

The following are automatically added:

  • Add reviewers from OWNER file (in the root of the repository) under reviewers section.
  • Set PR size label.
  • New issue is created for the PR. (Closed when PR is merged/closed)
  • Run pre-commit if .pre-commit-config.yaml exists in the repo.

Available user actions:

  • To mark PR as WIP comment /wip to the PR, To remove it from the PR comment /wip cancel to the PR.
  • To block merging of PR comment /hold, To un-block merging of PR comment /hold cancel.
  • To mark PR as verified comment /verified to the PR, to un-verify comment /verified cancel to the PR.
    verified label removed on each new commit push.
  • To cherry pick a merged PR comment /cherry-pick <target branch to cherry-pick to> in the PR.
    • Multiple target branches can be cherry-picked, separated by spaces. (/cherry-pick branch1 branch2)
    • Cherry-pick will be started when PR is merged
  • To build and push container image command /build-and-push-container in the PR (tag will be the PR number).
    • You can add extra args to the Podman build command
      • Example: /build-and-push-container --build-arg OPENSHIFT_PYTHON_WRAPPER_COMMIT=<commit_hash>
  • To add a label by comment use /<label name>, to remove, use /<label name> cancel
  • To assign reviewers based on OWNERS file use /assign-reviewers
  • To check if PR can be merged use /check-can-merge
  • to assign reviewer to PR use /assign-reviewer @<reviewer>

PR will be approved when the following conditions are met:

  • /approve from one of the approvers.
  • Minimum number of required /lgtm (2) is met.
Approvers and Reviewers
  • Approvers:

    • EdDev
    • dshchedr
    • dshchedr
    • dshchedr
    • jpeimer
    • jpeimer
    • myakove
    • rnetser
    • rnetser
    • vsibirsk
    • vsibirsk
    • vsibirsk
  • Reviewers:

    • Ahmad-Hafe
    • Anatw
    • EdDev
    • OhadRevah
    • OhadRevah
    • RoniKishner
    • RoniKishner
    • RoniKishner
    • SiboWang1997
    • akri3i
    • dalia-frank
    • dshchedr
    • dshchedr
    • dshchedr
    • duyanyan
    • geetikakay
    • geetikakay
    • hmeir
    • hmeir
    • hmeir
    • jerry7z
    • jpeimer
    • kbidarkar
    • kgoldbla
    • rnetser
    • rnetser
    • sbahar619
    • stesrn
    • vsibirsk
    • vsibirsk
    • vsibirsk
    • yossisegev
Supported /retest check runs
  • /retest tox: Retest tox
  • /retest build-container: Retest build-container
  • /retest all: Retest all
Supported labels
  • hold
  • verified
  • wip
  • lgtm
  • approve

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

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

🛑 Comments failed to post (22)
utilities/network.py (1)

1119-1133: 🛠️ Refactor suggestion

Add docstring and fix code quality issues.

The function logic is correct, but there are several code quality improvements needed based on static analysis:

+def wait_for_node_marked_by_bridge(
+    bridge_nad: LinuxBridgeNetworkAttachmentDefinition, 
+    node: Node
+) -> None:
+    """
+    Wait for a node to be marked by a bridge network attachment definition.
+    
+    Args:
+        bridge_nad: The bridge network attachment definition
+        node: The node to check for bridge marking
+        
+    Raises:
+        TimeoutExpiredError: If the node is not marked within the timeout period
+    """
-def wait_for_node_marked_by_bridge(bridge_nad: LinuxBridgeNetworkAttachmentDefinition, node: Node) -> None:
    bridge_annotation = bridge_nad.resource_name
    sampler = TimeoutSampler(
        wait_timeout=TIMEOUT_3MIN,
        sleep=5,
        func=lambda: bridge_annotation in node.instance.status.capacity.keys()
        and bridge_annotation in node.instance.status.allocatable.keys(),
    )
    try:
        for sample in sampler:
            if sample:
                return
    except TimeoutExpiredError:
-        LOGGER.error(f"Node {node.hostname} is not marked by {bridge_nad.bridge_name} bridge")
+        LOGGER.error("Node %s is not marked by %s bridge", node.hostname, bridge_nad.bridge_name)
        raise
📝 Committable suggestion

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

def wait_for_node_marked_by_bridge(
    bridge_nad: LinuxBridgeNetworkAttachmentDefinition,
    node: Node
) -> None:
    """
    Wait for a node to be marked by a bridge network attachment definition.

    Args:
        bridge_nad: The bridge network attachment definition
        node: The node to check for bridge marking

    Raises:
        TimeoutExpiredError: If the node is not marked within the timeout period
    """
    bridge_annotation = bridge_nad.resource_name
    sampler = TimeoutSampler(
        wait_timeout=TIMEOUT_3MIN,
        sleep=5,
        func=lambda: bridge_annotation in node.instance.status.capacity.keys()
        and bridge_annotation in node.instance.status.allocatable.keys(),
    )
    try:
        for sample in sampler:
            if sample:
                return
    except TimeoutExpiredError:
        LOGGER.error("Node %s is not marked by %s bridge", node.hostname, bridge_nad.bridge_name)
        raise
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 1119-1119: Line too long (107/100)

(C0301)


[convention] 1119-1119: Missing function or method docstring

(C0116)


[warning] 1132-1132: Use lazy % formatting in logging functions

(W1203)

🤖 Prompt for AI Agents
In utilities/network.py around lines 1119 to 1133, add a clear docstring to the
function wait_for_node_marked_by_bridge explaining its purpose, parameters, and
behavior. Also, improve code quality by replacing the for loop over sampler with
a more idiomatic usage if possible, handle exceptions more precisely, and ensure
consistent formatting and naming conventions according to project style
guidelines.
tests/virt/cluster/common_templates/utils.py (1)

36-39: 💡 Verification agent

🧩 Analysis chain

Function behavior changed from skip to expected failure.

The rename from skip_on_guest_agent_version to xfail_old_guest_agent_version reflects a significant behavioral change from skipping tests to marking them as expected failures. This aligns with the broader shift from skip-based to xfail-based test gating mentioned in the AI summary.

Add a docstring to document the function's purpose and behavior:

 def xfail_old_guest_agent_version(vm, ga_version):
+    """
+    Mark test as expected failure if guest agent version is older than specified version.
+    
+    Args:
+        vm: Virtual machine instance with ssh_exec capability
+        ga_version: Minimum required guest agent version string
+    """
     qemu_guest_agent_version = get_linux_guest_agent_version(ssh_exec=vm.ssh_exec)

🏁 Script executed:

#!/bin/bash
# Verify all callers have been updated to use the new function name
echo "Checking for any remaining references to the old function name:"
rg "skip_on_guest_agent_version" --type py

echo "Checking usage of the new function name:"
rg "xfail_old_guest_agent_version" --type py -A 2 -B 2

Length of output: 1720


xfail_old_guest_agent_version callers updated; add missing docstring

All references to the old skip_on_guest_agent_version helper have been removed and replaced with xfail_old_guest_agent_version in:

  • tests/virt/cluster/common_templates/utils.py
  • tests/virt/cluster/common_templates/conftest.py

Please add a docstring to explain the function’s purpose and parameters:

 def xfail_old_guest_agent_version(vm, ga_version):
+    """
+    Mark the test as an expected failure if the guest agent version is older than the specified minimum.
+
+    Args:
+        vm: Virtual machine instance with an ssh_exec attribute for command execution.
+        ga_version: Minimum required guest agent version (string).
+    """
     qemu_guest_agent_version = get_linux_guest_agent_version(ssh_exec=vm.ssh_exec)
     if version.parse(qemu_guest_agent_version.split()[0]) < version.parse(ga_version):
         pytest.xfail(reason=f"Bug in old guest agent version {qemu_guest_agent_version}")
📝 Committable suggestion

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

def xfail_old_guest_agent_version(vm, ga_version):
    """
    Mark the test as an expected failure if the guest agent version is older than the specified minimum.

    Args:
        vm: Virtual machine instance with an ssh_exec attribute for command execution.
        ga_version: Minimum required guest agent version (string).
    """
    qemu_guest_agent_version = get_linux_guest_agent_version(ssh_exec=vm.ssh_exec)
    if version.parse(qemu_guest_agent_version.split()[0]) < version.parse(ga_version):
        pytest.xfail(reason=f"Bug in old guest agent version {qemu_guest_agent_version}")
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 36-36: Missing function or method docstring

(C0116)

🤖 Prompt for AI Agents
In tests/virt/cluster/common_templates/utils.py around lines 36 to 39, the
function xfail_old_guest_agent_version lacks a docstring. Add a clear docstring
that explains the function's purpose, which is to mark tests as expected
failures if the guest agent version is older than a specified version, and
describe its parameters, including the vm object and the ga_version string.
tests/virt/node/node_labeller/cpu_features/test_vm_with_cpu_features.py (1)

15-18: ⚠️ Potential issue

Fix inconsistency: fixture name suggests fail but implementation skips.

The fixture is renamed to fail_if_amd_cpu_nodes but still calls pytest.skip(). This creates confusion and inconsistency with the naming convention used elsewhere in the codebase.

 @pytest.fixture()
 def fail_if_amd_cpu_nodes(nodes_cpu_vendor):
+    """Fail test if cluster has AMD CPU nodes (PCID feature unsupported)."""
     if nodes_cpu_vendor == AMD:
-        pytest.skip("PCID CPU feature is not supported on AMD CPU")
+        pytest.fail("PCID CPU feature is not supported on AMD CPU")
📝 Committable suggestion

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

 @pytest.fixture()
 def fail_if_amd_cpu_nodes(nodes_cpu_vendor):
     """Fail test if cluster has AMD CPU nodes (PCID feature unsupported)."""
     if nodes_cpu_vendor == AMD:
-        pytest.skip("PCID CPU feature is not supported on AMD CPU")
+        pytest.fail("PCID CPU feature is not supported on AMD CPU")
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 15-15: Missing function or method docstring

(C0116)

🤖 Prompt for AI Agents
In tests/virt/node/node_labeller/cpu_features/test_vm_with_cpu_features.py
around lines 15 to 18, the function named fail_if_amd_cpu_nodes calls
pytest.skip(), which is inconsistent with its name suggesting a failure. To fix
this, either rename the function to reflect that it skips the test when AMD CPU
nodes are detected or change the implementation to raise an error or fail the
test instead of skipping, aligning the behavior with the 'fail' naming
convention.
utilities/pytest_utils.py (1)

243-265: 🛠️ Refactor suggestion

Address code quality issues in the new function.

The function logic is correct, but there are several code quality improvements needed:

  1. Typo on line 247: invald_sc should be invalid_sc
  2. Missing docstring: The function needs documentation explaining its purpose, parameters, and return value
  3. Line length: Line 250-253 exceeds 100 characters
  4. Dictionary iteration: Line 257 can iterate the dictionary directly

Apply this diff to address the issues:

+def update_storage_class_matrix_config(session, pytest_config_matrix):
+    """
+    Update storage class matrix configuration based on command line options.
+    
+    Args:
+        session: pytest session object
+        pytest_config_matrix: existing storage class matrix from config
+        
+    Returns:
+        list: updated storage class matrix
+        
+    Raises:
+        ValueError: if incompatible storage classes are requested
+        AssertionError: if invalid storage classes are requested
+    """
     cmdline_storage_class = session.config.getoption(name="storage_class_matrix")
     matrix_list = pytest_config_matrix
     matrix_names = [[*sc][0] for sc in pytest_config_matrix]
-    invald_sc = []
+    invalid_sc = []
     if cmdline_storage_class:
         cmdline_storage_class_matrix = cmdline_storage_class.split(",")
-        if HOSTPATH_CSI in cmdline_storage_class and StorageClassNames.TOPOLVM in cmdline_storage_class:
+        if (HOSTPATH_CSI in cmdline_storage_class and 
+            StorageClassNames.TOPOLVM in cmdline_storage_class):
             raise ValueError(
-                f"{HOSTPATH_CSI} storage classes can't be used with {StorageClassNames.TOPOLVM} "
-                f": {cmdline_storage_class}"
+                f"{HOSTPATH_CSI} storage classes can't be used with "
+                f"{StorageClassNames.TOPOLVM}: {cmdline_storage_class}"
             )
         for sc in cmdline_storage_class_matrix:
             if sc not in matrix_names:
-                if sc in HPP_STORAGE_CLASSES.keys():
+                if sc in HPP_STORAGE_CLASSES:
                     matrix_list.append({sc: HPP_STORAGE_CLASSES[sc]})
                 else:
-                    invald_sc.append(sc)
-    assert not invald_sc, (
-        f"Invalid sc requested via --storage-class-matix: {invald_sc}. Valid options: "
+                    invalid_sc.append(sc)
+    assert not invalid_sc, (
+        f"Invalid sc requested via --storage-class-matrix: {invalid_sc}. Valid options: "
         f"{matrix_names} and {[*HPP_STORAGE_CLASSES]}"
     )
     return matrix_list
📝 Committable suggestion

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

def update_storage_class_matrix_config(session, pytest_config_matrix):
    """
    Update storage class matrix configuration based on command line options.
    
    Args:
        session: pytest session object
        pytest_config_matrix: existing storage class matrix from config
        
    Returns:
        list: updated storage class matrix
        
    Raises:
        ValueError: if incompatible storage classes are requested
        AssertionError: if invalid storage classes are requested
    """
    cmdline_storage_class = session.config.getoption(name="storage_class_matrix")
    matrix_list = pytest_config_matrix
    matrix_names = [[*sc][0] for sc in pytest_config_matrix]
    invalid_sc = []
    if cmdline_storage_class:
        cmdline_storage_class_matrix = cmdline_storage_class.split(",")
        if (HOSTPATH_CSI in cmdline_storage_class and 
            StorageClassNames.TOPOLVM in cmdline_storage_class):
            raise ValueError(
                f"{HOSTPATH_CSI} storage classes can't be used with "
                f"{StorageClassNames.TOPOLVM}: {cmdline_storage_class}"
            )
        for sc in cmdline_storage_class_matrix:
            if sc not in matrix_names:
                if sc in HPP_STORAGE_CLASSES:
                    matrix_list.append({sc: HPP_STORAGE_CLASSES[sc]})
                else:
                    invalid_sc.append(sc)
    assert not invalid_sc, (
        f"Invalid sc requested via --storage-class-matrix: {invalid_sc}. Valid options: "
        f"{matrix_names} and {[*HPP_STORAGE_CLASSES]}"
    )
    return matrix_list
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 250-250: Line too long (104/100)

(C0301)


[convention] 243-243: Missing function or method docstring

(C0116)


[convention] 257-257: Consider iterating the dictionary directly instead of calling .keys()

(C0201)

🤖 Prompt for AI Agents
In utilities/pytest_utils.py from lines 243 to 265, fix the typo by renaming the
variable 'invald_sc' to 'invalid_sc' throughout the function. Add a clear
docstring at the start of the function describing its purpose, parameters, and
return value. Break the long error message lines (250-253) into shorter lines to
keep them under 100 characters. Finally, simplify the dictionary key check on
line 257 by iterating directly over the dictionary keys instead of calling
.keys().
tests/global_config_sno_hpp.py (2)

23-33: 🛠️ Refactor suggestion

Simplify the dynamic configuration building logic.

The current logic has issues with undefined variable checking and could be cleaner.

Apply this diff to improve the logic:

 for _dir in dir():
-    if not config:  # noqa: F821
-        config: dict[str, Any] = {}
     val = locals()[_dir]
     if type(val) not in [bool, list, dict, str, int]:
         continue

     if _dir in ["encoding", "py_file"]:
         continue

-    config[_dir] = locals()[_dir]  # noqa: F821
+    config[_dir] = val

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 Pylint (3.3.7)

[error] 24-24: Using variable 'config' before assignment

(E0601)

🤖 Prompt for AI Agents
In tests/global_config_sno_hpp.py around lines 23 to 33, the current code
attempts to build a config dictionary dynamically but has issues with checking
if the config variable is defined and uses redundant lookups. Initialize the
config dictionary explicitly before the loop. Then iterate over the keys in
dir(), filter out unwanted types and keys, and assign the values directly to
config without repeated locals() calls or undefined variable checks.

1-10: 🛠️ Refactor suggestion

Add module docstring and fix line length.

The module is missing a docstring and line 5 exceeds the character limit.

Apply this diff to address the issues:

+"""
+Global configuration for Single Node OpenShift (SNO) with HostPath Provisioner (HPP).
+
+This module defines test matrices and configuration parameters specifically for
+SNO environments using HPP storage classes.
+"""
 from typing import Any

 import pytest_testconfig

-from utilities.constants import ALL_CNV_DAEMONSETS, ALL_CNV_DEPLOYMENTS, ALL_CNV_PODS, HPP_VOLUME_MODE_ACCESS_MODE
+from utilities.constants import (
+    ALL_CNV_DAEMONSETS,
+    ALL_CNV_DEPLOYMENTS, 
+    ALL_CNV_PODS,
+    HPP_VOLUME_MODE_ACCESS_MODE,
+)
 from utilities.storage import HppCsiStorageClass
📝 Committable suggestion

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

"""
Global configuration for Single Node OpenShift (SNO) with HostPath Provisioner (HPP).

This module defines test matrices and configuration parameters specifically for
SNO environments using HPP storage classes.
"""
from typing import Any

import pytest_testconfig

from utilities.constants import (
    ALL_CNV_DAEMONSETS,
    ALL_CNV_DEPLOYMENTS,
    ALL_CNV_PODS,
    HPP_VOLUME_MODE_ACCESS_MODE,
)
from utilities.storage import HppCsiStorageClass

global config
global_config = pytest_testconfig.load_python(
    py_file="tests/global_config.py", encoding="utf-8"
)
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 5-5: Line too long (114/100)

(C0301)


[convention] 1-1: Missing module docstring

(C0114)


[error] 3-3: Unable to import 'pytest_testconfig'

(E0401)


[warning] 8-8: Using the global statement at the module level

(W0604)

🤖 Prompt for AI Agents
In tests/global_config_sno_hpp.py at lines 1 to 10, add a module-level docstring
at the top to describe the purpose of the module. Also, break line 5 into
multiple lines or refactor it to ensure it does not exceed the maximum allowed
line length, improving readability and compliance with style guidelines.
tests/global_config_lvms.py (1)

37-47: ⚠️ Potential issue

Fix potential NameError in config building loop.

The variable config is referenced before being defined, which will cause a NameError at runtime.

+config: dict[str, Any] = {}
+
 for _dir in dir():
-    if not config:  # noqa: F821
-        config: dict[str, Any] = {}
     val = locals()[_dir]
     if type(val) not in [bool, list, dict, str, int]:
         continue
 
     if _dir in ["encoding", "py_file"]:
         continue
 
-    config[_dir] = locals()[_dir]  # noqa: F821
+    config[_dir] = locals()[_dir]
🧰 Tools
🪛 Pylint (3.3.7)

[error] 38-38: Using variable 'config' before assignment

(E0601)

🤖 Prompt for AI Agents
In tests/global_config_lvms.py around lines 37 to 47, the variable config is
used before it is defined, causing a potential NameError. Initialize config as
an empty dictionary before the loop starts to ensure it is defined when
referenced inside the loop.
tests/virt/node/hyperv_support/test_hyperv_features_in_vm.py (1)

157-157: 💡 Verification agent

🧩 Analysis chain

Verify removal of skip fixture is intentional.

The removal of the skip_if_no_evmcs_support fixture parameter means these tests will now run unconditionally. Ensure this aligns with the new centralized validation in the virt_special_infra_sanity fixture mentioned in the AI summary.

Also applies to: 190-190


🏁 Script executed:

#!/bin/bash
# Description: Verify the virt_special_infra_sanity fixture exists and handles evmcs support validation
# Expected: Find the new centralized fixture that replaces the removed skip logic

rg -A 10 "virt_special_infra_sanity" tests/virt/conftest.py

Length of output: 816


🏁 Script executed:

#!/bin/bash
# Examine virt_special_infra_sanity body for evmcs support check
rg -n "def virt_special_infra_sanity" -A200 tests/virt/conftest.py

# Search for any evmcs-related validation in the conftest
rg -n "evmcs" -A5 tests/virt/conftest.py

# Verify removal of skip_if_no_evmcs_support references across tests
rg -n "skip_if_no_evmcs_support" -R tests

Length of output: 7062


🏁 Script executed:

#!/bin/bash
# Search for any remaining references to skip_if_no_evmcs_support across the repo
rg -n skip_if_no_evmcs_support .

# Show context around the test signature to confirm fixture removal
sed -n '140,180p' tests/virt/node/hyperv_support/test_hyperv_features_in_vm.py

Length of output: 1412


🏁 Script executed:

#!/bin/bash
# Check if virt_special_infra_sanity is applied to tests via usefixtures or autouse
rg -n "usefixtures.*virt_special_infra_sanity" -R tests
rg -n "autouse.*virt_special_infra_sanity" -R tests

Length of output: 921


Ensure EVMCS tests trigger the centralized VMX support check

The virt_special_infra_sanity fixture only invokes _verify_evmcs_support for tests marked with high_resource_vm. However, test_windows_vm_with_evmcs_feature no longer uses skip_if_no_evmcs_support and isn’t annotated with high_resource_vm, so on clusters without VMX support it will now run (and likely fail) instead of being skipped.

Please update the test to opt into the central check or restore explicit skipping:

File: tests/virt/node/hyperv_support/test_hyperv_features_in_vm.py
Line: ~157
Change: Add @pytest.mark.high_resource_vm above def test_windows_vm_with_evmcs_feature…

Alternatively, if this test shouldn’t rely on the global fixture, re-add skip_if_no_evmcs_support to its hyperv_vm parametrization.

🧰 Tools
🪛 Pylint (3.3.7)

[convention] 157-157: Missing function or method docstring

(C0116)


[warning] 157-157: Redefining name 'hyperv_vm' from outer scope (line 21)

(W0621)

🤖 Prompt for AI Agents
In tests/virt/node/hyperv_support/test_hyperv_features_in_vm.py at line 157, the
test_windows_vm_with_evmcs_feature no longer uses the skip_if_no_evmcs_support
fixture and is not marked with @pytest.mark.high_resource_vm, causing it to run
unconditionally and potentially fail on clusters without VMX support. To fix
this, add the decorator @pytest.mark.high_resource_vm above the
test_windows_vm_with_evmcs_feature definition to ensure it triggers the
centralized VMX support check in the virt_special_infra_sanity fixture.
tests/virt/conftest.py (5)

34-34: 🛠️ Refactor suggestion

Use generator expression instead of list comprehension

Using a list comprehension inside any() creates an unnecessary intermediate list.

-if not any([node.labels.cpumanager == "true" for node in _schedulable_nodes]):
+if not any(node.labels.cpumanager == "true" for node in _schedulable_nodes):
📝 Committable suggestion

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

        if not any(node.labels.cpumanager == "true" for node in _schedulable_nodes):
🧰 Tools
🪛 Pylint (3.3.7)

[refactor] 34-34: Use a generator instead 'any(node.labels.cpumanager == 'true' for node in _schedulable_nodes)'

(R1729)

🤖 Prompt for AI Agents
In tests/virt/conftest.py at line 34, replace the list comprehension inside the
any() function with a generator expression by removing the square brackets. This
avoids creating an unnecessary intermediate list and improves performance.

59-61: 🛠️ Refactor suggestion

Use generator expression for better performance

-if not any([
-    label == "cpu-feature.node.kubevirt.io/vmx" and value == "true" for label, value in node.labels.items()
-]):
+if not any(
+    label == "cpu-feature.node.kubevirt.io/vmx" and value == "true" for label, value in node.labels.items()
+):
📝 Committable suggestion

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

            if not any(
                label == "cpu-feature.node.kubevirt.io/vmx" and value == "true" for label, value in node.labels.items()
            ):
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 60-60: Line too long (119/100)

(C0301)


[refactor] 59-61: Use a generator instead 'any(label == 'cpu-feature.node.kubevirt.io/vmx' and value == 'true' for (label, value) in node.labels.items())'

(R1729)

🤖 Prompt for AI Agents
In tests/virt/conftest.py around lines 59 to 61, replace the list comprehension
inside the any() function with a generator expression by removing the square
brackets. This change improves performance by avoiding the creation of an
intermediate list and instead generates items on the fly for the any() check.

66-69: 🛠️ Refactor suggestion

Use generator expression instead of list comprehension

-if not any([
-    parse_string_unsafe(worker.instance.status.allocatable["hugepages-1Gi"]) >= parse_string_unsafe("1Gi")
-    for worker in _workers
-]):
+if not any(
+    parse_string_unsafe(worker.instance.status.allocatable["hugepages-1Gi"]) >= parse_string_unsafe("1Gi")
+    for worker in _workers
+):
📝 Committable suggestion

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

        if not any(
            parse_string_unsafe(worker.instance.status.allocatable["hugepages-1Gi"]) >= parse_string_unsafe("1Gi")
            for worker in _workers
        ):
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 67-67: Line too long (114/100)

(C0301)


[refactor] 66-69: Use a generator instead 'any(parse_string_unsafe(worker.instance.status.allocatable['hugepages-1Gi']) >= parse_string_unsafe('1Gi') for worker in _workers)'

(R1729)

🤖 Prompt for AI Agents
In tests/virt/conftest.py around lines 66 to 69, replace the list comprehension
inside the any() function with a generator expression by removing the square
brackets. This change improves performance by avoiding the creation of an
intermediate list.

46-49: ⚠️ Potential issue

Fix typos in function name and error message

The function name has a typo and the error message contains a spelling error.

-def _verfify_no_dpdk():
+def _verify_no_dpdk():
    LOGGER.info("Verify cluster doesn't have DPDK enabled")
    if PerformanceProfile(name="dpdk").exists:
-        failed_verifications_list.append("Cluster has DPDK enabled (DPDK is incomatible with NVIDIA GPU)")
+        failed_verifications_list.append("Cluster has DPDK enabled (DPDK is incompatible with NVIDIA GPU)")
📝 Committable suggestion

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

    def _verify_no_dpdk():
        LOGGER.info("Verify cluster doesn't have DPDK enabled")
        if PerformanceProfile(name="dpdk").exists:
            failed_verifications_list.append("Cluster has DPDK enabled (DPDK is incompatible with NVIDIA GPU)")
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 49-49: Line too long (110/100)

(C0301)

🤖 Prompt for AI Agents
In tests/virt/conftest.py around lines 46 to 49, correct the typo in the
function name from _verfify_no_dpdk to _verify_no_dpdk and fix the spelling
error in the error message by changing "incomatible" to "incompatible".

56-62: 🛠️ Refactor suggestion

Function name doesn't match its purpose

The function is named _verify_evmcs_support but it's actually checking for VMX CPU feature support. Consider renaming for clarity.

-def _verify_evmcs_support(_schedulable_nodes):
-    LOGGER.info("Verify cluster nodes support VMX cpu fixture")
+def _verify_vmx_support(_schedulable_nodes):
+    LOGGER.info("Verify cluster nodes support VMX CPU feature")

Also update the function call on line 79:

-_verify_evmcs_support(_schedulable_nodes=schedulable_nodes)
+_verify_vmx_support(_schedulable_nodes=schedulable_nodes)
📝 Committable suggestion

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

    def _verify_vmx_support(_schedulable_nodes):
        LOGGER.info("Verify cluster nodes support VMX CPU feature")
        for node in _schedulable_nodes:
            if not any([
                label == "cpu-feature.node.kubevirt.io/vmx" and value == "true" for label, value in node.labels.items()
            ]):
                failed_verifications_list.append("Cluster does not have any node that supports VMX cpu feature")

    # ... later in the file ...
    _verify_vmx_support(_schedulable_nodes=schedulable_nodes)
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 60-60: Line too long (119/100)

(C0301)


[convention] 62-62: Line too long (112/100)

(C0301)


[refactor] 59-61: Use a generator instead 'any(label == 'cpu-feature.node.kubevirt.io/vmx' and value == 'true' for (label, value) in node.labels.items())'

(R1729)

🤖 Prompt for AI Agents
In tests/virt/conftest.py around lines 56 to 62, the function named
_verify_evmcs_support is misleading because it checks for VMX CPU feature
support, not EVMCS. Rename the function to _verify_vmx_support to accurately
reflect its purpose. Also, update the corresponding function call on line 79 to
use the new name _verify_vmx_support.
tests/storage/utils.py (1)

250-256: 🛠️ Refactor suggestion

Add docstring to document the function's purpose

The function is missing documentation that explains what it verifies.

def verify_vm_disk_image_permission(vm: VirtualMachine) -> None:
+    """Verify that the VM's disk image has correct permissions and ownership.
+    
+    Args:
+        vm: The VirtualMachine instance to verify
+        
+    Raises:
+        AssertionError: If disk image is missing or has incorrect permissions/ownership
+    """
    v_pod = vm.vmi.virt_launcher_pod
📝 Committable suggestion

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

def verify_vm_disk_image_permission(vm: VirtualMachine) -> None:
    """Verify that the VM's disk image has correct permissions and ownership.
    
    Args:
        vm: The VirtualMachine instance to verify
        
    Raises:
        AssertionError: If the disk image is missing or has incorrect permissions/ownership
    """
    v_pod = vm.vmi.virt_launcher_pod
    LOGGER.debug("Check image exist, permission and ownership")
    output = v_pod.execute(command=["ls", "-l", "/var/run/kubevirt-private/vmi-disks/dv-disk"])
    assert "disk.img" in output
    assert "-rw-rw----." in output
    assert "qemu qemu" in output
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 250-250: Missing function or method docstring

(C0116)

🤖 Prompt for AI Agents
In tests/storage/utils.py around lines 250 to 256, the function
verify_vm_disk_image_permission lacks a docstring. Add a concise docstring at
the beginning of the function that explains its purpose, specifically that it
verifies the existence, permissions, and ownership of the VM disk image file.
tests/network/conftest.py (1)

63-68: 🛠️ Refactor suggestion

Add docstrings to document fixture purpose

Both fixtures are missing documentation.

@pytest.fixture()
def fail_if_not_ipv4_supported_cluster_from_mtx(
    request,
    ipv4_supported_cluster,
):
+    """Fail the test if IPv4 is required by the test matrix but not supported by the cluster."""
    if ip_version_data_from_matrix(request=request) == IPV4_STR and not ipv4_supported_cluster:
        pytest.fail(reason="IPv4 is not supported in this cluster")


@pytest.fixture()
def fail_if_not_ipv6_supported_cluster_from_mtx(
    request,
    ipv6_supported_cluster,
):
+    """Fail the test if IPv6 is required by the test matrix but not supported by the cluster."""
    if ip_version_data_from_matrix(request=request) == IPV6_STR and not ipv6_supported_cluster:
        pytest.fail(reason="IPv6 is not supported in this cluster")

Also applies to: 72-77

🧰 Tools
🪛 Pylint (3.3.7)

[convention] 63-63: Missing function or method docstring

(C0116)

🤖 Prompt for AI Agents
In tests/network/conftest.py at lines 63 to 68 and 72 to 77, the fixture
functions lack docstrings explaining their purpose. Add clear and concise
docstrings to each fixture describing what they do, their parameters, and any
important behavior or usage notes to improve code readability and
maintainability.
tests/observability/metrics/test_migration_metrics.py (3)

283-289: 🛠️ Refactor suggestion

Remove unused parameter.

The parameter vm_migration_metrics_vmim_scope_class is not used in the test.

 def test_metric_kubevirt_vmi_migration_start_time_seconds(
     self,
     prometheus,
     vm_for_migration_metrics_test,
-    vm_migration_metrics_vmim_scope_class,
     vm_migration_state,
 ):
📝 Committable suggestion

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

    def test_metric_kubevirt_vmi_migration_start_time_seconds(
        self,
        prometheus,
        vm_for_migration_metrics_test,
        vm_migration_state,
    ):
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 283-283: Missing function or method docstring

(C0116)


[warning] 286-286: Redefining name 'vm_for_migration_metrics_test' from outer scope (line 110)

(W0621)


[warning] 287-287: Redefining name 'vm_migration_metrics_vmim_scope_class' from outer scope (line 135)

(W0621)


[warning] 287-287: Unused argument 'vm_migration_metrics_vmim_scope_class'

(W0613)

🤖 Prompt for AI Agents
In tests/observability/metrics/test_migration_metrics.py around lines 283 to
289, the parameter vm_migration_metrics_vmim_scope_class is declared in the test
function but never used. Remove this unused parameter from the function
signature to clean up the code and avoid confusion.

299-305: 🛠️ Refactor suggestion

Remove unused parameters.

The parameters vm_migration_metrics_vmim_scope_class and migration_succeeded_scope_class are not used in the test.

 def test_metric_kubevirt_vmi_migration_end_time_seconds(
     self,
     prometheus,
     vm_for_migration_metrics_test,
-    vm_migration_metrics_vmim_scope_class,
-    migration_succeeded_scope_class,
     vm_migration_state,
 ):
📝 Committable suggestion

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

    def test_metric_kubevirt_vmi_migration_end_time_seconds(
        self,
        prometheus,
        vm_for_migration_metrics_test,
        vm_migration_state,
    ):
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 299-299: Missing function or method docstring

(C0116)


[refactor] 299-299: Too many arguments (6/5)

(R0913)


[refactor] 299-299: Too many positional arguments (6/5)

(R0917)


[warning] 302-302: Redefining name 'vm_for_migration_metrics_test' from outer scope (line 110)

(W0621)


[warning] 303-303: Redefining name 'vm_migration_metrics_vmim_scope_class' from outer scope (line 135)

(W0621)


[warning] 304-304: Redefining name 'migration_succeeded_scope_class' from outer scope (line 175)

(W0621)


[warning] 303-303: Unused argument 'vm_migration_metrics_vmim_scope_class'

(W0613)


[warning] 304-304: Unused argument 'migration_succeeded_scope_class'

(W0613)

🤖 Prompt for AI Agents
In tests/observability/metrics/test_migration_metrics.py around lines 299 to
305, the parameters vm_migration_metrics_vmim_scope_class and
migration_succeeded_scope_class are declared in the test function signature but
never used. Remove these two parameters from the function definition to clean up
the code and avoid confusion.

265-273: 🛠️ Refactor suggestion

Remove unused parameters from test method.

The parameters namespace, admin_client, migration_policy_with_bandwidth_scope_class, and vm_migration_metrics_vmim_scope_class are not used in the test.

 def test_kubevirt_vmi_migration_metrics(
     self,
     prometheus,
-    namespace,
-    admin_client,
-    migration_policy_with_bandwidth_scope_class,
     vm_for_migration_metrics_test,
-    vm_migration_metrics_vmim_scope_class,
     query,
 ):
📝 Committable suggestion

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

    def test_kubevirt_vmi_migration_metrics(
        self,
        prometheus,
        vm_for_migration_metrics_test,
        query,
    ):
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 265-265: Missing function or method docstring

(C0116)


[refactor] 265-265: Too many arguments (8/5)

(R0913)


[refactor] 265-265: Too many positional arguments (8/5)

(R0917)


[warning] 271-271: Redefining name 'vm_for_migration_metrics_test' from outer scope (line 110)

(W0621)


[warning] 272-272: Redefining name 'vm_migration_metrics_vmim_scope_class' from outer scope (line 135)

(W0621)


[warning] 268-268: Unused argument 'namespace'

(W0613)


[warning] 269-269: Unused argument 'admin_client'

(W0613)


[warning] 270-270: Unused argument 'migration_policy_with_bandwidth_scope_class'

(W0613)


[warning] 272-272: Unused argument 'vm_migration_metrics_vmim_scope_class'

(W0613)

🤖 Prompt for AI Agents
In tests/observability/metrics/test_migration_metrics.py around lines 265 to
273, the test method test_kubevirt_vmi_migration_metrics includes unused
parameters: namespace, admin_client,
migration_policy_with_bandwidth_scope_class, and
vm_migration_metrics_vmim_scope_class. Remove these unused parameters from the
method signature to clean up the code and avoid confusion.
tests/storage/restricted_namespace_cloning/test_restricted_namespace_cloning.py (4)

190-196: 🛠️ Refactor suggestion

Remove unused parameter.

The parameter permissions_datavolume_destination is not used in the test function.

 def test_user_permissions_only_for_dst_ns_negative(
     storage_class_name_scope_module,
     data_volume_multi_storage_scope_module,
     destination_namespace,
     unprivileged_client,
-    permissions_datavolume_destination,
 ):
📝 Committable suggestion

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

def test_user_permissions_only_for_dst_ns_negative(
    storage_class_name_scope_module,
    data_volume_multi_storage_scope_module,
    destination_namespace,
    unprivileged_client,
):
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 190-190: Missing function or method docstring

(C0116)


[warning] 195-195: Unused argument 'permissions_datavolume_destination'

(W0613)

🤖 Prompt for AI Agents
In
tests/storage/restricted_namespace_cloning/test_restricted_namespace_cloning.py
around lines 190 to 196, the parameter permissions_datavolume_destination is
declared but not used in the test_user_permissions_only_for_dst_ns_negative
function. Remove this unused parameter from the function signature to clean up
the code and avoid confusion.

128-137: 🛠️ Refactor suggestion

Remove unused parameters.

Several parameters are not used in the test function: namespace, permissions_datavolume_source, permissions_datavolume_destination, and user_has_get_permissions_in_source_namespace.

 def test_user_permissions_negative(
     storage_class_name_scope_module,
-    namespace,
     data_volume_multi_storage_scope_module,
     destination_namespace,
     unprivileged_client,
-    permissions_datavolume_source,
-    permissions_datavolume_destination,
-    user_has_get_permissions_in_source_namespace,
 ):
📝 Committable suggestion

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

def test_user_permissions_negative(
    storage_class_name_scope_module,
    data_volume_multi_storage_scope_module,
    destination_namespace,
    unprivileged_client,
):
    ...
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 128-128: Missing function or method docstring

(C0116)


[refactor] 128-128: Too many arguments (8/5)

(R0913)


[refactor] 128-128: Too many positional arguments (8/5)

(R0917)


[warning] 130-130: Unused argument 'namespace'

(W0613)


[warning] 134-134: Unused argument 'permissions_datavolume_source'

(W0613)


[warning] 135-135: Unused argument 'permissions_datavolume_destination'

(W0613)


[warning] 136-136: Unused argument 'user_has_get_permissions_in_source_namespace'

(W0613)

🤖 Prompt for AI Agents
In
tests/storage/restricted_namespace_cloning/test_restricted_namespace_cloning.py
around lines 128 to 137, the test_user_permissions_negative function includes
unused parameters: namespace, permissions_datavolume_source,
permissions_datavolume_destination, and
user_has_get_permissions_in_source_namespace. Remove these unused parameters
from the function signature to clean up the code and avoid confusion.

86-93: 🛠️ Refactor suggestion

Remove unused parameter.

The parameter permissions_pvc_destination is not used in the test function.

 def test_user_permissions_positive(
     unprivileged_client,
     storage_class_matrix__module__,
     storage_class_name_scope_module,
-    permissions_pvc_destination,
     dv_destination_cloned_from_pvc,
     requested_verify_image_permissions,
 ):
📝 Committable suggestion

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

def test_user_permissions_positive(
    unprivileged_client,
    storage_class_matrix__module__,
    storage_class_name_scope_module,
    dv_destination_cloned_from_pvc,
    requested_verify_image_permissions,
):
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 86-86: Missing function or method docstring

(C0116)


[refactor] 86-86: Too many arguments (6/5)

(R0913)


[refactor] 86-86: Too many positional arguments (6/5)

(R0917)


[warning] 90-90: Unused argument 'permissions_pvc_destination'

(W0613)

🤖 Prompt for AI Agents
In
tests/storage/restricted_namespace_cloning/test_restricted_namespace_cloning.py
around lines 86 to 93, the parameter permissions_pvc_destination is declared but
not used in the test_user_permissions_positive function. Remove
permissions_pvc_destination from the function's parameter list to clean up the
code and avoid confusion.

50-54: 🛠️ Refactor suggestion

Remove unused parameter.

The parameter permissions_pvc_source is not used in the test function.

 def test_unprivileged_user_clone_dv_same_namespace_positive(
-    permissions_pvc_source,
     dv_cloned_by_unprivileged_user_in_the_same_namespace,
 ):
📝 Committable suggestion

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

def test_unprivileged_user_clone_dv_same_namespace_positive(
    dv_cloned_by_unprivileged_user_in_the_same_namespace,
):
    dv_cloned_by_unprivileged_user_in_the_same_namespace.wait_for_dv_success()
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 50-50: Missing function or method docstring

(C0116)


[warning] 51-51: Unused argument 'permissions_pvc_source'

(W0613)

🤖 Prompt for AI Agents
In
tests/storage/restricted_namespace_cloning/test_restricted_namespace_cloning.py
around lines 50 to 54, the parameter permissions_pvc_source is declared but not
used in the test_unprivileged_user_clone_dv_same_namespace_positive function.
Remove the unused permissions_pvc_source parameter from the function signature
to clean up the code.

@OhadRevah
Copy link
Contributor Author

/build-and-push-container

@openshift-virtualization-qe-bot-3

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

@rnetser
Copy link
Collaborator

rnetser commented Jun 4, 2025

/lgtm
/approve

@OhadRevah
Copy link
Contributor Author

/verified

@OhadRevah
Copy link
Contributor Author

/retest build-container

@rnetser rnetser merged commit 3fcdb3b into RedHatQE:cnv-4.18 Jun 5, 2025
8 checks passed
@openshift-virtualization-qe-bot

Successfully removed PR tag: quay.io/openshift-cnv/openshift-virtualization-tests:pr-1142.

@openshift-virtualization-qe-bot

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

@OhadRevah OhadRevah deleted the fixTestVmFreeMemoryBytesTests branch June 8, 2025 10:35
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.

7 participants