Skip to content

refactor(constants): split utilities/constants.py into submodule package#5188

Open
vsibirsk wants to merge 8 commits into
RedHatQE:mainfrom
vsibirsk:vk-refactor-constants
Open

refactor(constants): split utilities/constants.py into submodule package#5188
vsibirsk wants to merge 8 commits into
RedHatQE:mainfrom
vsibirsk:vk-refactor-constants

Conversation

@vsibirsk

@vsibirsk vsibirsk commented Jun 11, 2026

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

Replace the monolithic utilities/constants.py with a utilities/constants/ package of thematic submodules. A temporary __init__.py compat shim re-exports every public name so all existing from utilities.constants import X statements continue to work unchanged while per-team import migrations land in follow-up PRs.

Submodules: aaq, components, hco, images, instance_types, misc, monitoring, namespaces, networking, os_matrix, storage, timeouts, virt.

Bundled cleanup:

  • Drop 7 unused constants (TIMEOUT_35MIN, TIMEOUT_40SEC, TIMEOUT_90MIN, TIMEOUT_12HRS, NONE_STR, KUBEVIRT_VIRT_OPERATOR_UP, HOSTPATH_CSI_BASIC)
  • Fix typo BREW_REGISTERY_SOURCE -> BREW_REGISTRY_SOURCE (3 files)
  • Dedup VIRTCTL_CLIDOWNLOADS_KUBEVIRT_HYPERCONVERGED -> VIRTCTL_CLI_DOWNLOADS

Generated-by: Cursor Agent (Claude Sonnet 4.6)

Which issue(s) this PR fixes:

Part of effort to refactor/clean-up utilities modules to remove all circular imports and create a more clear structure.

Special notes for reviewer:

This is a first PR in a series.
https://redhat.atlassian.net/browse/CNV-80952
__init__.py is a temp to not break existing imports under tests/. Follow-up PRs will be updating imports to new submodules in every sig, and dropping __init__.py in the end

jira-ticket:

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

Summary by CodeRabbit

  • Chores / Refactor
    • Reorganized and consolidated configuration constants into a modular structure (including component, image, networking, storage, monitoring, and timeout constants) with a compatibility shim to preserve existing imports.
  • Bug Fixes
    • Corrected a registry constant naming mismatch and updated related source mappings.
    • Standardized namespace naming by using shared namespace constants.
    • Updated expected relationship label key naming for CLI download identifiers.
  • Tests
    • Updated unit tests and validations to align with the new constant organization and renamed values.

@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 →

@coderabbitai

coderabbitai Bot commented Jun 11, 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: aca1b810-c13e-4b6c-89ac-0e95910f4fb0

📥 Commits

Reviewing files that changed from the base of the PR and between 7f431e7 and 9b40449.

📒 Files selected for processing (2)
  • tests/global_config.py
  • utilities/constants/namespaces.py
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: can-be-merged
  • GitHub Check: verify-bugs-are-open
  • GitHub Check: tox
  • GitHub Check: build-container
  • GitHub Check: security-committer-identity
  • GitHub Check: security-suspicious-paths
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
🧰 Additional context used
📓 Path-based instructions (3)
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Never add linter suppressions like # noqa, # type: ignore, or # pylint: disable. Fix the code instead. If you believe a rule is wrong, ask the user for explicit approval.
Search the codebase for existing implementations before writing new code. Check utilities/, libs/, tests/, and pyproject.toml dependencies. Never duplicate logic—extract to shared modules. Use pyhelper_utils.shell.run_command for shell commands instead of subprocess.run, and use ocp-resources classes instead of raw YAML dicts.
Type hints are MANDATORY. Use mypy strict mode in libs/ and all new public functions under utilities. Use TYPE_CHECKING for type-only imports to avoid runtime overhead and circular imports.
Write Google-format docstrings for all public functions with non-obvious return values or side effects.
Always use uv run to execute commands. Never execute python, pip, pytest, tox, or pre-commit directly. Use uv run python, uv run pytest, uv run tox, uv run pre-commit, and uv add for package installation.
Always use absolute imports. Never use relative imports.
Prefer specific imports using from module import func for functions and constants. Use from package import module (then module.Name) when retaining the module name meaningfully improves readability. Never use bare import module without a from clause.
Always use named arguments for function calls with more than one argument.
Never use single-letter variable names. Always use descriptive, meaningful names.
No dead code. Every function, variable, and fixture must be used or removed. Code marked with # skip-unused-code is excluded from dead code analysis (enforced via custom ruff plugin).
Prefer direct attribute access using foo.attr. Save to variables only when reusing the same attribute multiple times improves readability or extracting clarifies intent.
Imports must always be at the top of the module. Do not import inside functions.
No defensive programming. Fail...

Files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
**

⚙️ CodeRabbit configuration file

**: ## PR Template Validation
Check the PR description for required sections from .github/pull_request_template.md.
Required sections (must be present, even if empty):

  • ##### What this PR does / why we need it: — MUST be present AND have meaningful content.
    Flag as HIGH if the section is missing, empty, whitespace-only, contains only HTML comments,
    or contains only placeholder tokens such as TBD, TBA, N/A, -, , none, or ..
  • ##### Which issue(s) this PR fixes: — must be present (may be empty)
  • ##### Special notes for reviewer: — must be present (may be empty)
  • ##### jira-ticket: — must be present (may be empty)
    If any required section is absent, or What this PR does / why we need it: has no content,
    flag it as HIGH severity and ask the author to restore the missing template section(s).

Approval Policy

You may approve the PR when ALL of the following are true:

  • All your review comments have been addressed with either:
    • a code/doc change that fixes the issue, or
    • a substantive author response that justifies no code change.
      Thread "resolved" state alone is not sufficient.
      OR you had no review comments.
  • If you posted a test execution plan comment requesting tests, and the PR author replied
    with a comment explaining why the requested tests are not needed or were already covered,
    treat that as an acceptable response — do not block approval on the test plan alone.
  • The author's explanation must be reasonable and specific (not just "N/A" or "not needed").
    Accept explanations like: "these tests were already run in CI", "this change is docs-only",
    "the affected tests are quarantined", or "verified manually on cluster X".

Files:

  • utilities/constants/namespaces.py
  • tests/global_config.py

⚙️ CodeRabbit configuration file

**: # AI Review and Development Standards

Assisted-by: Claude noreply@anthropic.com

Coding standards, conventions, and review guidelines for openshift-virtualization-tests.

These rules apply to ALL contributors and review tools — human and AI alike.

Strict Rules (MANDATORY)

Linter Suppressions PROHIBITED

  • NEVER add # noqa, # type: ignore, # pylint: disable
  • NEVER disable linter/mypy rules to work around issues
  • FIX THE CODE - If linter complains, the code is wrong
  • If you think a rule is wrong: ASK the user for explicit approval

Code Reuse (Search-First Development)

Before writing ANY new code:

  1. SEARCH codebase for existing implementations
  2. CHECK utilities/ for shared functions
  3. CHECK libs/ for shared libraries
  4. CHECK tests/ for shared fixtures and helper functions
  5. CHECK pyproject.toml dependencies — project packages (e.g., pyhelper-utils, ocp-resources, openshift-python-wrapper) may already provide the functionality
  6. VERIFY no similar logic exists elsewhere
  7. NEVER duplicate logic - extract to shared module
  8. REUSE existing code and patterns — only write new when nothing exists

External package examples:

  • Shell commands — use pyhelper_utils.shell.run_command, NEVER use subprocess.run directly in test/utility code
  • OpenShift resources — use ocp-resources classes, NEVER construct raw YAML dicts

Python Requirements

  • Type hints MANDATORY - mypy strict mode in libs/, all new public functions under utilities MUST be typed
  • Use TYPE_CHECKING for type-only imports - wrap imports needed solely for type hints in if TYPE_CHECKING: to avoid runtime overhead and circular imports
  • Google-format docstrings REQUIRED - for all public functions with non-obvious return values OR side effects
  • No defensive programming - fail-fast, don't hide bugs with fake defaults (see exceptions below)
  • ALWAYS use uv run -...

Files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
tests/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Use pytest assertions: assert actual == expected. Never use self.assertEqual(). Include failure messages: assert condition, 'descriptive message explaining failure'.

Files:

  • tests/global_config.py
🧠 Learnings (69)
📚 Learning: 2026-01-12T11:24:13.825Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-01-12T14:25:05.723Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-01-20T01:03:13.139Z
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).

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-01-21T21:26:41.805Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-01-25T13:18:21.675Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-02-18T06:35:39.536Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-02-23T16:33:22.070Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-03-17T01:32:02.617Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-03-17T01:32:02.617Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-04T13:45:29.122Z
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).

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-04T13:45:33.892Z
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`).

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-05T17:01:15.294Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-08T12:49:20.694Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-12T05:10:24.601Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-13T19:23:09.603Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-18T06:30:56.781Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-18T06:31:12.015Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-18T06:31:15.083Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-18T06:31:20.848Z
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).

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-18T09:09:09.479Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-19T07:48:17.119Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-19T07:48:17.119Z
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`.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-26T15:52:31.613Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-02-18T06:34:38.042Z
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 3847
File: tests/virt/cluster/common_templates/utils.py:58-58
Timestamp: 2026-02-18T06:34:38.042Z
Learning: In RedHatQE/openshift-virtualization-tests, treat 'public' functions as those defined in any Python files under libs/ or utilities/ (any depth). Functions inside nested test directories (e.g., tests/virt/cluster/common_templates/, tests/virt/node/, etc.) are test helpers and do not require Google-format docstrings unless explicitly requested. Use this rule during reviews to decide whether to enforce docstrings on public API functions in libs/utilities.

Applied to files:

  • utilities/constants/namespaces.py
📚 Learning: 2026-05-03T15:38:09.624Z
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.

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2026-05-15T18:42:02.504Z
Learnt from: geetikakay
Repo: RedHatQE/openshift-virtualization-tests PR: 4860
File: utilities/hco.py:385-389
Timestamp: 2026-05-15T18:42:02.504Z
Learning: In this repository, under the Python `utilities/` directory (utility/helper modules, not tests), do not flag bare `assert` statements as correctness or style issues. The codebase conventionally uses `assert` in these utilities (e.g., `utilities/virt.py`, `utilities/infra.py`, etc.) and does not enforce running Python with `-O`/`PYTHONOPTIMIZE`, so the usual “asserts may be stripped” concern should not be treated as a review blocker here.

Applied to files:

  • utilities/constants/namespaces.py
📚 Learning: 2026-06-15T10:56:21.758Z
Learnt from: vsibirsk
Repo: RedHatQE/openshift-virtualization-tests PR: 4994
File: tests/network/user_defined_network/ip_specification/test_ip_specification.py:123-127
Timestamp: 2026-06-15T10:56:21.758Z
Learning: In this repository, do not require or flag missing `-> None` return type annotations on pytest test functions/methods (i.e., functions named `test_*`) located under `tests/**`. Return type annotations for `-> None` on these test functions are optional and should not be treated as inconsistent. Separately, in `utilities/**` and `libs/**`, enforce return type annotations for non-test public functions (e.g., functions that are not internal/private such as those not starting with `_`).

Applied to files:

  • utilities/constants/namespaces.py
  • tests/global_config.py
📚 Learning: 2025-12-15T12:33:06.686Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-01-14T04:08:23.032Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-01-18T09:44:17.044Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-01-27T17:18:49.973Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-02-23T16:31:34.505Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-02-25T10:52:09.679Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-03-19T10:36:59.023Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-03-25T11:24:07.687Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-03-31T08:35:22.802Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-03-31T10:39:33.409Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-04-02T09:03:57.004Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-04-14T13:00:57.514Z
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`).

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-04-14T16:15:31.065Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-04-14T16:15:33.012Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-04-21T19:08:39.771Z
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`. 

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-04-26T11:44:20.150Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-04-27T15:40:31.167Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-05-03T14:47:13.096Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-05-05T17:27:32.109Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-05-05T18:28:01.097Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-05-07T12:34:42.589Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-05-08T12:31:26.895Z
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`).

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-05-12T18:18:20.607Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-05-25T09:13:27.011Z
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`.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-05-25T09:57:03.042Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-05-28T12:55:07.435Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-05-29T07:28:31.170Z
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/`.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-06-01T13:36:34.844Z
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`.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-06-01T14:00:39.271Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-06-02T21:16:58.118Z
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).

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-06-11T11:56:02.760Z
Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 5090
File: tests/observability/metrics/conftest.py:0-0
Timestamp: 2026-06-11T11:56:02.760Z
Learning: When reviewing NAD swap tests (and any other test code) that calls `libs.net.vmspec.update_nad_references`, ensure the VM argument matches the helper’s intended type: it’s a module-level helper typed for `libs.vm.vm.BaseVirtualMachine`, not `utilities.virt.VirtualMachineForTests`. `BaseVirtualMachine` and `VirtualMachineForTests` are sibling subclasses of `ocp_resources.virtual_machine.VirtualMachine`, so don’t pass `VirtualMachineForTests` to `update_nad_references` unless the helper’s signature/API is intentionally widened. For NAD swap tests using this helper, prefer creating the VM via `libs.vm.factory.fedora_vm` so the returned object is a `BaseVirtualMachine`.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-06-15T11:26:05.202Z
Learnt from: vsibirsk
Repo: RedHatQE/openshift-virtualization-tests PR: 4994
File: tests/storage/test_hotplug.py:209-209
Timestamp: 2026-06-15T11:26:05.202Z
Learning: In pytest test classes, if a fixture-like name is referenced via `pytest.mark.usefixtures("<name>")` on a method, don’t flag a “fixture not found” issue when `<name>` is also included as a parameter in the class-level `pytest.mark.parametrize(...)` for that same test class. In this case, pytest will resolve `<name>` via the parametrize parameter namespace (even without `indirect`). Treat this pattern as acceptable when the test needs the parametrize-driven side effects/order but doesn’t directly use the parameter value in the test body. If `<name>` is not present in that class-level `parametrize`, then `usefixtures` should correspond to a real fixture.

Applied to files:

  • tests/global_config.py
📚 Learning: 2025-12-22T16:27:40.244Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-01-07T09:52:12.342Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-01-18T13:18:48.808Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-01-18T14:51:50.846Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-01-29T05:30:13.982Z
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).

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-02-02T17:41:12.759Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-02-03T07:34:34.184Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-02-10T15:04:14.799Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-02-25T11:00:02.013Z
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.

Applied to files:

  • tests/global_config.py
📚 Learning: 2026-03-29T13:51:25.599Z
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.

Applied to files:

  • tests/global_config.py
🔇 Additional comments (2)
tests/global_config.py (1)

72-76: LGTM!

utilities/constants/namespaces.py (1)

9-20: LGTM!


📝 Walkthrough

Walkthrough

Converts monolithic utilities/constants.py (1095 lines) into utilities/constants/ package with 14 domain-specific submodules. Adds backward-compatible __init__.py shim. Fixes BREW_REGISTERY_SOURCE spelling and VIRTCTL_CLIDOWNLOADS_KUBEVIRT_HYPERCONVERGED naming in test files. Updates OADP namespace references to use NamespacesNames class constant.

Changes

Constants Package Refactoring

Layer / File(s) Summary
Spelling and naming corrections in test files
tests/global_config.py, tests/install_upgrade_operators/relationship_labels/constants.py
Corrects BREW_REGISTERY_SOURCEBREW_REGISTRY_SOURCE in utilities/constants import and both cnv_registry_sources entries; renames VIRTCTL_CLIDOWNLOADS_KUBEVIRT_HYPERCONVERGEDVIRTCTL_CLI_DOWNLOADS in import and EXPECTED_RELATED_OBJECTS_LABELS_DICT_MAP key.
Foundational submodules: architecture, cluster, namespaces
utilities/constants/architecture.py, utilities/constants/cluster.py, utilities/constants/namespaces.py
Adds CPU arch identifier strings (AMD_64, ARM_64, S390X) and multi-arch sets; Kubernetes node label keys, API verb strings (GET_STR, CREATE_STR), CNV test markers, and BASE_EXCEPTIONS_DICT; NamespacesNames class with OpenShift/CNV namespace constants including ADP_NAMESPACE = "openshift-adp".
Storage constants submodule
utilities/constants/storage.py
Defines StorageClassNames class with backend identifiers (CEPH_RBD, NFS, etc.), CDI label/upload/secret/configmap constants, BREW_REGISTRY_SOURCE, HPP_CAPABILITIES dict from DataVolume enums, hotplug disk identifiers (serial, VIRTIO bus, SCSI bus), cron marker strings, and storage metric field names (CAPACITY, USED).
HCO and components submodules
utilities/constants/hco.py, utilities/constants/components.py
hco.py adds DEFAULT_HCO_CONDITIONS, DEFAULT_KUBEVIRT_CONDITIONS status maps, UpgradeStreams class (x/y/z-stream), TLS/security policy strings, feature-gate keys, datasource/template annotation keys, and ALL_CNV_CRDS list. components.py adds operator/resource name constants (50+), Kubernetes kind strings, ALL_HCO_RELATED_OBJECTS mapping, CNV_PODS, CNV_DEPLOYMENTS, CNV_DAEMONSETS lists, CNV_PROMETHEUS_RULES, and VM console proxy resource classifications.
Images submodule with per-architecture configurations
utilities/constants/images.py
Defines OS flavor string constants (OS_FLAVOR_CIRROS, OS_FLAVOR_RHEL, etc.), demo disk identifiers, Alpine/Fedora version/registry URL constants, and ArchImages class with AMD64/ARM64/S390X nested classes; each architecture initializes per-vendor image constructors (Cirros, Alpine, Rhel, Windows, Fedora, Centos, Cdi) with versioned filenames, demo-disk settings, and S390X-specific workaround parameters for Cirros and Cdi.
Virt, networking, and monitoring submodules
utilities/constants/virt.py, utilities/constants/networking.py, utilities/constants/monitoring.py
virt.py adds VM migration labeling constants, disk/cloud-init key names, eviction strategies, Hyper-V feature label lists (DOM/XML and derived VM-YAML lists), CPU topology sizing constants (cores, threads, sockets), and memory sizing constants. networking.py adds SR-IOV/bridge/IP-family/port constants (SSH_PORT_22, PORT_80), and test pod security context spec dicts (POD_SECURITY_CONTEXT_SPEC, POD_CONTAINER_SPEC). monitoring.py adds severity/status strings, operator health impact mapping, alert state strings, kubelet readiness condition dict, Prometheus VMI metric name constants (20+), and MONITORING_METRICS list.
Utility submodules: AAQ, instance types, OS matrix, timeouts, pytest, OADP, CPU models, Tekton
utilities/constants/aaq.py, utilities/constants/instance_types.py, utilities/constants/os_matrix.py, utilities/constants/timeouts.py, utilities/constants/pytest.py, utilities/constants/oadp.py, utilities/constants/cpu_models.py, utilities/constants/tekton.py
Eight focused submodules: AAQ quota spec dicts (QUOTA_FOR_POD, QUOTA_FOR_ONE_VMI, ARQ_QUOTA_HARD_SPEC); KubeVirt instance type/preference label constants and EXPECTED_CLUSTER_INSTANCE_TYPE_LABELS; OS test parameter field-name keys (IMAGE_NAME_STR, OS_VERSION_STR, etc.); TIMEOUT_* integer and TCP_TIMEOUT_30SEC float constants (28 total); pytest runner/marker constants (QUARANTINED, SETUP_ERROR, test user credentials); OADP backup filename/storage location constants; CPU model exclusion lists (EXCLUDED_CPU_MODELS_S390X, EXCLUDED_CPU_MODELS, EXCLUDED_OLD_CPU_MODELS); Tekton Windows pipeline refs and task names.
Compatibility re-export shim and dynamic Images computation
utilities/constants/__init__.py
Temporary backward-compatibility shim re-exporting all submodule symbols with explicit __all__ list (80+ names); imports BASE_IMAGES_DIR and aliases get_cluster_architecture as _get_cluster_architecture; defers Images computation to after all submodule imports using getattr(ArchImages, _get_cluster_architecture()[0].upper()) to avoid circular dependency with KUBERNETES_ARCH_LABEL.
OADP namespace constant migration to NamespacesNames
utilities/oadp.py, utilities/unittests/test_oadp.py
Replaces bare ADP_NAMESPACE references with NamespacesNames.ADP_NAMESPACE in Velero pod lookup and default namespace parameters for VeleroBackup/VeleroRestore constructors; updates corresponding mock expectation in test file.
Unit test updates for new constant structure
utilities/unittests/test_constants.py
Replaces class/attribute existence checks with exact string assertions for OS_FLAVOR_* constants, WIN_10/WIN_11 string values, and DATA_IMPORT_CRON_ENABLE prefix validation; removes deleted TIMEOUT_12HRS assertion; adds test_instance_type_constants and test_os_matrix_constants methods to verify new submodule constants.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

new-tests

Suggested reviewers

  • dshchedr
  • rnetser
  • geetikakay
  • mijankow
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

@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
  • myakove
  • rnetser
  • vsibirsk

Reviewers:

  • OhadRevah
  • RoniKishner
  • albarker-rh
  • dshchedr
  • geetikakay
  • hmeir
  • rlobillo
  • rnetser
  • vsibirsk
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
AI Features
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6[1m])

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is removed on new commits unless the push is detected as a clean rebase
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Container Builds: Container images are automatically tagged with the PR number
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5188      +/-   ##
==========================================
- Coverage   98.67%   98.65%   -0.02%     
==========================================
  Files          25       42      +17     
  Lines        2487     2451      -36     
==========================================
- Hits         2454     2418      -36     
  Misses         33       33              
Flag Coverage Δ
utilities 98.65% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@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 `@utilities/constants/aaq.py`:
- Around line 20-26: Replace the incorrect memory request value in the
QUOTA_FOR_POD mapping: currently REQUESTS_MEMORY_STR is set to
POD_LIMITS_MEMORY; change it to POD_REQUESTS_MEMORY so requests reflect the
intended 2.5Gi value (update the QUOTA_FOR_POD dict where REQUESTS_MEMORY_STR is
defined to use POD_REQUESTS_MEMORY instead of POD_LIMITS_MEMORY).

In `@utilities/constants/components.py`:
- Line 202: Replace the list concatenation for ALL_CNV_PODS with iterable
unpacking: instead of using CNV_PODS_NO_HPP_CSI_HPP_POOL +
[HOSTPATH_PROVISIONER_CSI, HPP_POOL], construct ALL_CNV_PODS by expanding
CNV_PODS_NO_HPP_CSI_HPP_POOL with the two items (HOSTPATH_PROVISIONER_CSI,
HPP_POOL) using [*CNV_PODS_NO_HPP_CSI_HPP_POOL, HOSTPATH_PROVISIONER_CSI,
HPP_POOL] to improve readability and follow the suggested style.

In `@utilities/constants/monitoring.py`:
- Around line 1-4: Add a module-level docstring to this constants module
explaining its purpose and boundaries (what kinds of monitoring level constants
it contains) to match other files in utilities/constants; update the top of the
file where CRITICAL_STR, INFO_STR, WARNING_STR, and NONE_STRING are defined by
inserting a clear one- or two-sentence docstring that states this module holds
monitoring level string constants and any conventions (e.g., allowed values or
usage scope).
🪄 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: 46829ede-9043-4711-8ea1-d1ed0e21b096

📥 Commits

Reviewing files that changed from the base of the PR and between 2631fad and 1cb86f7.

📒 Files selected for processing (19)
  • tests/global_config.py
  • tests/install_upgrade_operators/product_upgrade/utils.py
  • tests/install_upgrade_operators/relationship_labels/constants.py
  • utilities/constants.py
  • utilities/constants/__init__.py
  • utilities/constants/aaq.py
  • utilities/constants/components.py
  • utilities/constants/hco.py
  • utilities/constants/images.py
  • utilities/constants/instance_types.py
  • utilities/constants/misc.py
  • utilities/constants/monitoring.py
  • utilities/constants/namespaces.py
  • utilities/constants/networking.py
  • utilities/constants/os_matrix.py
  • utilities/constants/storage.py
  • utilities/constants/timeouts.py
  • utilities/constants/virt.py
  • utilities/unittests/test_constants.py
💤 Files with no reviewable changes (1)
  • utilities/constants.py

Comment thread utilities/constants/aaq.py
Comment thread utilities/constants/components.py Outdated
Comment thread utilities/constants/monitoring.py
Comment thread utilities/constants/namespaces.py Outdated
Comment thread utilities/constants/os_matrix.py
Comment thread utilities/constants/misc.py Outdated
Comment thread utilities/constants/components.py Outdated
Comment thread utilities/constants/storage.py Outdated
Comment thread utilities/constants/components.py Outdated
Comment thread utilities/constants/misc.py Outdated
Comment thread utilities/constants/misc.py Outdated
Comment thread utilities/constants/misc.py Outdated
Comment thread utilities/constants/timeouts.py
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

COMMIT_SHA=$(gh pr view 5188 --repo RedHatQE/openshift-virtualization-tests --json headRefOid --jq '.headRefOid')
echo "HEAD SHA: $COMMIT_SHA"

# Get the first changed file and first changed line in the diff
gh pr diff 5188 --repo RedHatQE/openshift-virtualization-tests | head -30

Length of output: 1563


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - << 'PYEOF'
import json, os, urllib.request, sys

token = os.popen("gh auth token").read().strip()
commit_sha = "f00b38fd8a7f90fbc27f1fdc199323a77d3f61da"

body = (
    "## Test Execution Plan\n\n"
    "**Run smoke tests: True**\n"
    "Dependency path: every smoke test (e.g. `tests/virt/node/general/test_container_disk_vm.py`) "
    "-> `tests/conftest.py` (line 79: `from utilities.constants import ...`) "
    "-> `utilities/constants/__init__.py` (restructured package). "
    "`tests/conftest.py` is in the conftest hierarchy of **all** tests in the repo; "
    "any import-time failure in `utilities/constants` would break collection for all smoke tests.\n\n"
    "**Run gating tests: True**\n"
    "Concrete dependency paths:\n"
    "- `tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py` (gating) "
    "-> `tests/install_upgrade_operators/relationship_labels/constants.py` imports `VIRTCTL_CLI_DOWNLOADS` "
    "from `utilities.constants` (renamed from `VIRTCTL_CLIDOWNLOADS_KUBEVIRT_HYPERCONVERGED`)\n"
    "- `tests/install_upgrade_operators/product_upgrade/test_upgrade.py` (gating + cnv_upgrade) "
    "-> `tests/install_upgrade_operators/product_upgrade/utils.py` imports `BREW_REGISTRY_SOURCE` "
    "(typo fix from `BREW_REGISTERY_SOURCE`)\n"
    "- All remaining gating tests are transitively affected via `tests/conftest.py`\n\n"
    "---\n\n"
    "**Affected tests to run**\n\n"
    "| Path | Marker |\n"
    "|------|--------|\n"
    "| `utilities/unittests/test_constants.py` | unit |\n"
    "| `utilities/unittests/test_oadp.py` | unit |\n"
    "| `tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py` | gating |\n"
    "| `tests/install_upgrade_operators/product_upgrade/test_upgrade.py` | gating, cnv_upgrade |\n"
    "| `tests/install_upgrade_operators/deployment/test_hco_deployment_params.py` | gating, smoke |\n"
    "| `tests/install_upgrade_operators/hco_enablement_golden_image_updates/test_custom_golden_images_namespace.py` | gating, smoke |\n"
    "| `tests/infrastructure/instance_types/supported_os/test_rhel_os.py` | smoke, gating |\n"
    "| `tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py` | smoke |\n"
    "| `tests/storage/cdi_upload/test_upload_virtctl.py` | smoke |\n"
    "| `tests/storage/cdi_clone/test_clone.py` | smoke, gating |\n\n"
    "---\n\n"
    "**Real tests (cluster required)**\n\n"
    "`utilities/constants/__init__.py` calls `_get_cluster_architecture()` at **module load time** "
    "to compute `Images`. Every test session triggers this at collection time. "
    "Verify before running full suites:\n\n"
    "Collection startup check (confirms no `ImportError`/`AttributeError`):\n"
    "```\n"
    "pytest tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py --collect-only\n"
    "pytest tests/install_upgrade_operators/product_upgrade/test_upgrade.py --collect-only\n"
    "```\n\n"
    "Renamed constant regression (`VIRTCTL_CLI_DOWNLOADS`):\n"
    "```\n"
    "pytest tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py -m gating\n"
    "```\n\n"
    "Typo-fix regression (`BREW_REGISTRY_SOURCE`):\n"
    "```\n"
    "pytest tests/install_upgrade_operators/product_upgrade/test_upgrade.py -m 'gating and cnv_upgrade'\n"
    "```\n"
)

payload = {
    "commit_id": commit_sha,
    "event": "COMMENT",
    "body": "",
    "comments": [
        {
            "path": "tests/global_config.py",
            "line": 18,
            "side": "RIGHT",
            "body": body
        }
    ]
}

with open("/tmp/review_payload.json", "w") as f:
    json.dump(payload, f)

data = json.dumps(payload).encode("utf-8")
req = urllib.request.Request(
    "https://api.github.com/repos/RedHatQE/openshift-virtualization-tests/pulls/5188/reviews",
    data=data,
    headers={
        "Authorization": "Bearer " + token,
        "Accept": "application/vnd.github+json",
        "Content-Type": "application/json",
        "X-GitHub-Api-Version": "2022-11-28",
    },
    method="POST"
)

try:
    with urllib.request.urlopen(req) as resp:
        result = json.loads(resp.read())
        print("SUCCESS: review id=" + str(result.get("id")) + ", url=" + str(result.get("html_url")))
except urllib.error.HTTPError as e:
    body_err = e.read().decode()
    print("HTTP ERROR " + str(e.code) + ": " + body_err)
    sys.exit(1)
PYEOF

Length of output: 7292


🏁 Script executed:

#!/bin/bash
set -euo pipefail

COMMIT_SHA="f00b38fd8a7f90fbc27f1fdc199323a77d3f61da"

python3 -c "
import json

body = '''## Test Execution Plan

**Run smoke tests: True**
Dependency path: every smoke test (e.g. \`tests/virt/node/general/test_container_disk_vm.py\`) -> \`tests/conftest.py\` (line 79: \`from utilities.constants import ...\`) -> \`utilities/constants/__init__.py\` (restructured package). \`tests/conftest.py\` is in the conftest hierarchy of **all** tests in the repo; any import-time failure in \`utilities/constants\` would break collection for all smoke tests.

**Run gating tests: True**
Concrete dependency paths:
- \`tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py\` (gating) -> \`tests/install_upgrade_operators/relationship_labels/constants.py\` imports \`VIRTCTL_CLI_DOWNLOADS\` from \`utilities.constants\` (renamed from \`VIRTCTL_CLIDOWNLOADS_KUBEVIRT_HYPERCONVERGED\`)
- \`tests/install_upgrade_operators/product_upgrade/test_upgrade.py\` (gating + cnv_upgrade) -> \`tests/install_upgrade_operators/product_upgrade/utils.py\` imports \`BREW_REGISTRY_SOURCE\` (typo fix from \`BREW_REGISTERY_SOURCE\`)
- All remaining gating tests are transitively affected via \`tests/conftest.py\`

---

**Affected tests to run**

| Path | Marker |
|------|--------|
| \`utilities/unittests/test_constants.py\` | unit |
| \`utilities/unittests/test_oadp.py\` | unit |
| \`tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py\` | gating |
| \`tests/install_upgrade_operators/product_upgrade/test_upgrade.py\` | gating, cnv_upgrade |
| \`tests/install_upgrade_operators/deployment/test_hco_deployment_params.py\` | gating, smoke |
| \`tests/install_upgrade_operators/hco_enablement_golden_image_updates/test_custom_golden_images_namespace.py\` | gating, smoke |
| \`tests/infrastructure/instance_types/supported_os/test_rhel_os.py\` | smoke, gating |
| \`tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py\` | smoke |
| \`tests/storage/cdi_upload/test_upload_virtctl.py\` | smoke |
| \`tests/storage/cdi_clone/test_clone.py\` | smoke, gating |

---

**Real tests (cluster required)**

\`utilities/constants/__init__.py\` calls \`_get_cluster_architecture()\` at **module load time** to compute \`Images\`. Every test session triggers this at collection time. Verify before running full suites:

Collection startup check (confirms no \`ImportError\`/\`AttributeError\`):
\`\`\`
pytest tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py --collect-only
pytest tests/install_upgrade_operators/product_upgrade/test_upgrade.py --collect-only
\`\`\`

Renamed constant regression (\`VIRTCTL_CLI_DOWNLOADS\`):
\`\`\`
pytest tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py -m gating
\`\`\`

Typo-fix regression (\`BREW_REGISTRY_SOURCE\`):
\`\`\`
pytest tests/install_upgrade_operators/product_upgrade/test_upgrade.py -m 'gating and cnv_upgrade'
\`\`\`'''

payload = {
    'commit_id': 'f00b38fd8a7f90fbc27f1fdc199323a77d3f61da',
    'event': 'COMMENT',
    'body': '',
    'comments': [
        {
            'path': 'tests/global_config.py',
            'line': 18,
            'side': 'RIGHT',
            'body': body
        }
    ]
}

with open('/tmp/review_payload.json', 'w') as f:
    json.dump(payload, f)
print('payload written')
"

gh api \
  --method POST \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  /repos/RedHatQE/openshift-virtualization-tests/pulls/5188/reviews \
  --input /tmp/review_payload.json \
  --jq '"Review posted: id=\(.id) url=\(.html_url)"'

Length of output: 3844



@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

/retest all

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

Overlapping files

utilities/oadp.py
utilities/unittests/test_oadp.py

@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

/retest all

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

Overlapping files

tests/install_upgrade_operators/product_upgrade/utils.py

vsibirsk added 7 commits June 17, 2026 12:12
Replace the monolithic utilities/constants.py (1095 lines) with a
utilities/constants/ package of 13 thematic submodules. A temporary
__init__.py compat shim re-exports every public name so all existing
`from utilities.constants import X` statements continue to work
unchanged while per-team import migrations land in follow-up PRs.

Submodules: aaq, components, hco, images, instance_types, misc,
monitoring, namespaces, networking, os_matrix, storage, timeouts, virt.

Bundled cleanup:
- Drop 7 unused constants (TIMEOUT_35MIN, TIMEOUT_40SEC, TIMEOUT_90MIN,
  TIMEOUT_12HRS, NONE_STR, KUBEVIRT_VIRT_OPERATOR_UP, HOSTPATH_CSI_BASIC)
- Fix typo BREW_REGISTERY_SOURCE -> BREW_REGISTRY_SOURCE (3 files)
- Dedup VIRTCTL_CLIDOWNLOADS_KUBEVIRT_HYPERCONVERGED -> VIRTCTL_CLI_DOWNLOADS

Generated-by: Cursor Agent (Claude Sonnet 4.6)
Signed-off-by: vsibirsk <vsibirsk@redhat.com>
Assisted-by: Cursor Agent (Claude Sonnet 4.6)
Signed-off-by: vsibirsk <vsibirsk@redhat.com>
Update all callers (utilities/oadp.py, utilities/unittests/test_oadp.py)
to use NamespacesNames.ADP_NAMESPACE directly. Remove the module-level
name entirely — no compat alias needed.

Assisted-by: Cursor Agent (Claude Sonnet 4.6)
Signed-off-by: vsibirsk <vsibirsk@redhat.com>
Signed-off-by: vsibirsk <vsibirsk@redhat.com>
- Split misc.py into 4 new themed modules: architecture, cluster, oadp, pytest
- Distribute remaining misc constants to virt, networking, monitoring, storage, images
- Move node labels (CPU_MODEL_LABEL_PREFIX, TSC_FREQUENCY, NODE_TYPE_WORKER_LABEL) from
  components.py to cluster.py; group components.py by type with section headers
- Update __init__.py shim accordingly

Generated-by: Cursor Agent (Claude Sonnet 4.6)
Signed-off-by: vsibirsk <vsibirsk@redhat.com>
Split virt.py further: KUBERNETES_ARCH_LABEL → cluster.py,
Tekton constants → tekton.py, CPU model exclusion lists → cpu_models.py,
WINDOWS_*_PREFERENCE → instance_types.py. Update __init__.py and all
module docstrings to reflect the final layout.

Generated-by: Claude Sonnet 4.6
Signed-off-by: vsibirsk <vsibirsk@redhat.com>
Signed-off-by: vsibirsk <vsibirsk@redhat.com>
@vsibirsk

Copy link
Copy Markdown
Collaborator Author

/verified

change: rebase to resolve merge conflict

@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

@coderabbitai

Test execution plan request details

CRITICAL: You MUST post an inline review comment on the first changed line of the first file.
The inline comment should contain the full Test Execution Plan (smoke decision, gating decision, and specific affected tests).
Do NOT submit a blocking review event (REQUEST_CHANGES/APPROVE).
Post a single inline PR comment on Files Changed (non-blocking COMMENT flow).

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

Analysis Requirements:

  1. Examine code changes in each modified file

  2. Identify affected code paths, functions, and classes

  3. Analyze pytest-specific elements: fixtures (scope, dependencies), parametrization, markers, conftest changes

  4. Trace test dependencies through imports, shared utilities, fixture inheritance, fixture teardown, and yield from cleanup in conftest

  5. Detect new tests introduced in the PR

  6. Utilities and libs impact (when utilities/ or libs/ changes):
    You MUST use shell scripts (rg, git diff) to trace the full impact.
    Follow these sub-steps in order:

    6a. Identify modified symbols: For each changed file under utilities/ or libs/,
    list every modified function or method.
    Example: git diff HEAD~1 --unified=0 -- utilities/hco.py | grep '^[+-]def '

    6b. Find direct callers: Search tests and conftest for each symbol from 6a.
    Example: rg -l 'get_hco_version' tests/

    6c. Trace fixture teardown and cleanup: Find fixtures that reach
    the modified symbol through yield from or context-manager wrappers.
    Example: rg -l 'yield from.*enable_common_boot|def.*enable_common_boot' tests/

    6d. Trace same-file callers: In each changed file, find other functions
    whose body calls a modified symbol (including code after yield
    in @contextmanager helpers).
    Example: rg 'get_hco_version|enable_common_boot' utilities/hco.py

    6e. Expand transitively: If function A calls modified B, then
    tests/fixtures that call A are affected — even when the test body
    never imports B directly.

    Do NOT limit impact to tests that import the modified symbol only.

  7. Smoke test impact: Intersect the affected set from step 6 with smoke-marked tests.
    Run: rg -l '@pytest.mark.smoke' tests/
    VERIFY the above command returned actual file paths before concluding False.
    Set True if either condition is met:

    • a smoke-marked file appears in the affected set from 6b-6e, OR
    • any conftest.py in the smoke test's parent-directory hierarchy (up to repo root)
      imports or calls a modified utilities/libs symbol — including autouse fixtures
      that depend on modified functions. ALL tests in that directory and below are affected.
      Example check: for each smoke_file, scan dirname(smoke_file)/conftest.py,
      dirname(dirname(smoke_file))/conftest.py, etc. for modified symbol imports
      and autouse fixtures that depend on modified symbols.
  8. Gating test impact: Intersect the affected set from step 6 with gating-marked tests.
    Run: rg -l '@pytest.mark.gating' tests/
    Set True if a gating-marked file also appears in the affected set from 6b-6e.
    Utilities/libs changes often affect gating tests without affecting smoke tests.
    Do NOT stop analysis after concluding Run smoke tests: False.

Output rules:
Do NOT include analysis step numbers (1-8) in your visible output.

Your deliverable:
Your inline informational comment will be based on the following requirements:

Test Execution Plan

  • Run smoke tests: True / False — If True, state the dependency path (test → fixture → changed symbol). True ONLY with a verified path.
  • Run gating tests: True / False — If True, state the dependency path. True if any gating-marked test is in the affected set.
  • Affected tests to run (required when utilities/, libs/, or shared conftest changes — list concrete paths even when smoke is False)

Use these formats:

  • path/to/test_file.py - When the entire test file needs verification
  • path/to/test_file.py::TestClass::test_method - When specific test(s) needed
  • path/to/test_file.py::test_function - When specific test(s) needed
  • -m marker - When a marker covers multiple affected tests (e.g. -m gating only if ALL gating tests in scope need run)
  • Tag each listed test or group with its marker when not obvious, e.g. (gating) or (smoke)

Real test commands (MANDATORY when changes affect session/runtime code):

When the affected code runs at session/collection time (conftest fixtures, pytest plugins,
config hooks, session-scoped setup) or modifies runtime behavior that unit tests mock away,
you MUST include concrete pytest commands the PR author must run on a real cluster
to verify the change works end-to-end. Include:

  • A command for the error/fix path (the scenario the PR fixes)
  • A command for the happy path (regression: the normal case still works)
  • Use lightweight tests (e.g., --collect-only for startup failures,
    a single small test for runtime behavior)
    If the PR only changes test logic (not utilities/libs/conftest), the affected test
    paths themselves serve as the real test commands — no separate section needed.

Example output for a session-startup fix:

**Real tests (cluster required)**
Error path (the fix):
`pytest tests/storage/.../test_foo.py --storage-class-matrix=nonexistent-sc --collect-only`
Expected: ValueError with clear message, not IndexError

Happy path (regression):
`pytest tests/storage/.../test_foo.py --storage-class-matrix=<valid-sc> -k test_bar`
Expected: session starts normally

Guidelines:

  • Include tests affected directly OR via fixture setup/teardown, yield from cleanup, or transitive utility call chains (caller calls modified helper)
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name when only specific tests use an affected fixture or utility wrapper (preferred for partial file impact)
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal
  • Example: if leaf helper foo() changes, include tests whose fixture teardown calls wrapper bar() where bar() calls foo(), even when the test body only imports an unrelated symbol from the same utilities module

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

When PR modifies fixtures for hardware-specific resources:

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

CRITICAL WORKFLOW COMPLETION RULES:

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

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

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

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

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

CRITICAL — Verification rules for smoke and gating decisions:
- For each True decision, you must have traced a concrete path: test file → fixture → utility function → modified symbol.
- Do NOT assume impact based on scope, file proximity, or infrastructure-sounding names.
Only set True when you trace a concrete path through steps 6a-6e, then 7 or 8.
WRONG: "utilities/hco.py changed → run smoke" (no traced dependency path)
WRONG: "Run smoke tests: False" with no affected-test list when gating tests use the changed utility
RIGHT: "Run smoke tests: False, Run gating tests: True" plus tests/.../test_foo.py::TestBar::test_baz (gating)
RIGHT: "Smoke test X uses fixture Y → wrapper Z → changed function W in utilities/hco.py"

@dshchedr

Copy link
Copy Markdown
Collaborator

/retest verify-bugs-are-open

@dshchedr

Copy link
Copy Markdown
Collaborator

/approve
/lgtm

@rnetser

rnetser commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai
full review

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

@rnetser Sure, I'll perform a full review of the PR!

✅ Action performed

Full review finished.

@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: 1

🤖 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 `@utilities/constants/namespaces.py`:
- Line 17: The MACHINE_API_NAMESPACE constant in the namespaces module has an
incorrect value of "machine-api-namespace" and is currently unused throughout
the codebase. Either remove the MACHINE_API_NAMESPACE constant entirely if it is
not needed, or update its value to the correct OpenShift namespace
"openshift-machine-api" and add usages in the code where the machine API
namespace is actually required, such as in Kubernetes API calls or resource
references that interact with the machine API.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 12d12c2a-9833-4609-90c0-716a1621121e

📥 Commits

Reviewing files that changed from the base of the PR and between 6cdf39b and 7f431e7.

📒 Files selected for processing (25)
  • tests/global_config.py
  • tests/install_upgrade_operators/relationship_labels/constants.py
  • utilities/constants.py
  • utilities/constants/__init__.py
  • utilities/constants/aaq.py
  • utilities/constants/architecture.py
  • utilities/constants/cluster.py
  • utilities/constants/components.py
  • utilities/constants/cpu_models.py
  • utilities/constants/hco.py
  • utilities/constants/images.py
  • utilities/constants/instance_types.py
  • utilities/constants/monitoring.py
  • utilities/constants/namespaces.py
  • utilities/constants/networking.py
  • utilities/constants/oadp.py
  • utilities/constants/os_matrix.py
  • utilities/constants/pytest.py
  • utilities/constants/storage.py
  • utilities/constants/tekton.py
  • utilities/constants/timeouts.py
  • utilities/constants/virt.py
  • utilities/oadp.py
  • utilities/unittests/test_constants.py
  • utilities/unittests/test_oadp.py
💤 Files with no reviewable changes (1)
  • utilities/constants.py

Comment thread utilities/constants/namespaces.py Outdated
Add OPENSHIFT_CNV, OPENSHIFT_MARKETPLACE, OPENSHIFT_SRIOV_NETWORK_OPERATOR,
fix MACHINE_API_NAMESPACE value, replace five hardcoded strings in global_config.py.

Generated-by: Claude Sonnet 4.6
Signed-off-by: vsibirsk <vsibirsk@redhat.com>
@vsibirsk

Copy link
Copy Markdown
Collaborator Author

/verified

#5188 (comment)

+ --collect-only on all tests/ folder

@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

@coderabbitai

Test execution plan request details

CRITICAL: You MUST post an inline review comment on the first changed line of the first file.
The inline comment should contain the full Test Execution Plan (smoke decision, gating decision, and specific affected tests).
Do NOT submit a blocking review event (REQUEST_CHANGES/APPROVE).
Post a single inline PR comment on Files Changed (non-blocking COMMENT flow).

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

Analysis Requirements:

  1. Examine code changes in each modified file

  2. Identify affected code paths, functions, and classes

  3. Analyze pytest-specific elements: fixtures (scope, dependencies), parametrization, markers, conftest changes

  4. Trace test dependencies through imports, shared utilities, fixture inheritance, fixture teardown, and yield from cleanup in conftest

  5. Detect new tests introduced in the PR

  6. Utilities and libs impact (when utilities/ or libs/ changes):
    You MUST use shell scripts (rg, git diff) to trace the full impact.
    Follow these sub-steps in order:

    6a. Identify modified symbols: For each changed file under utilities/ or libs/,
    list every modified function or method.
    Example: git diff HEAD~1 --unified=0 -- utilities/hco.py | grep '^[+-]def '

    6b. Find direct callers: Search tests and conftest for each symbol from 6a.
    Example: rg -l 'get_hco_version' tests/

    6c. Trace fixture teardown and cleanup: Find fixtures that reach
    the modified symbol through yield from or context-manager wrappers.
    Example: rg -l 'yield from.*enable_common_boot|def.*enable_common_boot' tests/

    6d. Trace same-file callers: In each changed file, find other functions
    whose body calls a modified symbol (including code after yield
    in @contextmanager helpers).
    Example: rg 'get_hco_version|enable_common_boot' utilities/hco.py

    6e. Expand transitively: If function A calls modified B, then
    tests/fixtures that call A are affected — even when the test body
    never imports B directly.

    Do NOT limit impact to tests that import the modified symbol only.

  7. Smoke test impact: Intersect the affected set from step 6 with smoke-marked tests.
    Run: rg -l '@pytest.mark.smoke' tests/
    VERIFY the above command returned actual file paths before concluding False.
    Set True if either condition is met:

    • a smoke-marked file appears in the affected set from 6b-6e, OR
    • any conftest.py in the smoke test's parent-directory hierarchy (up to repo root)
      imports or calls a modified utilities/libs symbol — including autouse fixtures
      that depend on modified functions. ALL tests in that directory and below are affected.
      Example check: for each smoke_file, scan dirname(smoke_file)/conftest.py,
      dirname(dirname(smoke_file))/conftest.py, etc. for modified symbol imports
      and autouse fixtures that depend on modified symbols.
  8. Gating test impact: Intersect the affected set from step 6 with gating-marked tests.
    Run: rg -l '@pytest.mark.gating' tests/
    Set True if a gating-marked file also appears in the affected set from 6b-6e.
    Utilities/libs changes often affect gating tests without affecting smoke tests.
    Do NOT stop analysis after concluding Run smoke tests: False.

Output rules:
Do NOT include analysis step numbers (1-8) in your visible output.

Your deliverable:
Your inline informational comment will be based on the following requirements:

Test Execution Plan

  • Run smoke tests: True / False — If True, state the dependency path (test → fixture → changed symbol). True ONLY with a verified path.
  • Run gating tests: True / False — If True, state the dependency path. True if any gating-marked test is in the affected set.
  • Affected tests to run (required when utilities/, libs/, or shared conftest changes — list concrete paths even when smoke is False)

Use these formats:

  • path/to/test_file.py - When the entire test file needs verification
  • path/to/test_file.py::TestClass::test_method - When specific test(s) needed
  • path/to/test_file.py::test_function - When specific test(s) needed
  • -m marker - When a marker covers multiple affected tests (e.g. -m gating only if ALL gating tests in scope need run)
  • Tag each listed test or group with its marker when not obvious, e.g. (gating) or (smoke)

Real test commands (MANDATORY when changes affect session/runtime code):

When the affected code runs at session/collection time (conftest fixtures, pytest plugins,
config hooks, session-scoped setup) or modifies runtime behavior that unit tests mock away,
you MUST include concrete pytest commands the PR author must run on a real cluster
to verify the change works end-to-end. Include:

  • A command for the error/fix path (the scenario the PR fixes)
  • A command for the happy path (regression: the normal case still works)
  • Use lightweight tests (e.g., --collect-only for startup failures,
    a single small test for runtime behavior)
    If the PR only changes test logic (not utilities/libs/conftest), the affected test
    paths themselves serve as the real test commands — no separate section needed.

Example output for a session-startup fix:

**Real tests (cluster required)**
Error path (the fix):
`pytest tests/storage/.../test_foo.py --storage-class-matrix=nonexistent-sc --collect-only`
Expected: ValueError with clear message, not IndexError

Happy path (regression):
`pytest tests/storage/.../test_foo.py --storage-class-matrix=<valid-sc> -k test_bar`
Expected: session starts normally

Guidelines:

  • Include tests affected directly OR via fixture setup/teardown, yield from cleanup, or transitive utility call chains (caller calls modified helper)
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name when only specific tests use an affected fixture or utility wrapper (preferred for partial file impact)
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal
  • Example: if leaf helper foo() changes, include tests whose fixture teardown calls wrapper bar() where bar() calls foo(), even when the test body only imports an unrelated symbol from the same utilities module

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

When PR modifies fixtures for hardware-specific resources:

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

CRITICAL WORKFLOW COMPLETION RULES:

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

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

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

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

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

CRITICAL — Verification rules for smoke and gating decisions:
- For each True decision, you must have traced a concrete path: test file → fixture → utility function → modified symbol.
- Do NOT assume impact based on scope, file proximity, or infrastructure-sounding names.
Only set True when you trace a concrete path through steps 6a-6e, then 7 or 8.
WRONG: "utilities/hco.py changed → run smoke" (no traced dependency path)
WRONG: "Run smoke tests: False" with no affected-test list when gating tests use the changed utility
RIGHT: "Run smoke tests: False, Run gating tests: True" plus tests/.../test_foo.py::TestBar::test_baz (gating)
RIGHT: "Smoke test X uses fixture Y → wrapper Z → changed function W in utilities/hco.py"

Comment thread tests/global_config.py
ALL_CNV_PODS,
ALL_HCO_RELATED_OBJECTS,
BREW_REGISTERY_SOURCE,
BREW_REGISTRY_SOURCE,

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.

Test Execution Plan

Run smoke tests: True
Dependency path: every smoke test (e.g. tests/virt/node/general/test_container_disk_vm.py) -> tests/conftest.py (from utilities.constants import ...) -> utilities/constants/__init__.py (restructured package, calls _get_cluster_architecture() at import time). tests/conftest.py is in the conftest hierarchy of all tests in the repo; any import-time failure in utilities/constants breaks collection for all smoke tests.

Run gating tests: True
Concrete dependency paths:

  • tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py (gating) -> tests/install_upgrade_operators/relationship_labels/constants.py imports VIRTCTL_CLI_DOWNLOADS from utilities.constants (renamed from VIRTCTL_CLIDOWNLOADS_KUBEVIRT_HYPERCONVERGED)
  • tests/install_upgrade_operators/product_upgrade/test_upgrade.py (gating, cnv_upgrade) -> tests/install_upgrade_operators/product_upgrade/utils.py imports BREW_REGISTRY_SOURCE (typo fix from BREW_REGISTERY_SOURCE)
  • All remaining gating tests transitively affected via tests/conftest.py

Affected tests to run

Path Marker
utilities/unittests/test_constants.py unit
utilities/unittests/test_oadp.py unit
tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py gating
tests/install_upgrade_operators/product_upgrade/test_upgrade.py gating, cnv_upgrade
tests/install_upgrade_operators/deployment/test_hco_deployment_params.py gating, smoke
tests/install_upgrade_operators/hco_enablement_golden_image_updates/test_custom_golden_images_namespace.py gating, smoke
tests/infrastructure/instance_types/supported_os/test_rhel_os.py smoke, gating
tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py smoke
tests/storage/cdi_upload/test_upload_virtctl.py smoke
tests/storage/cdi_clone/test_clone.py smoke, gating

Real tests (cluster required)

utilities/constants/__init__.py calls _get_cluster_architecture() at module load time to compute Images. Every test session triggers this at collection time.

Collection startup check (confirms no ImportError/AttributeError):

pytest tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py --collect-only
pytest tests/install_upgrade_operators/product_upgrade/test_upgrade.py --collect-only

Renamed constant regression (VIRTCTL_CLI_DOWNLOADS):

pytest tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py -m gating

Typo-fix regression (BREW_REGISTRY_SOURCE):

pytest tests/install_upgrade_operators/product_upgrade/test_upgrade.py -m 'gating and cnv_upgrade'

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

COMMIT_SHA=$(gh pr view 5188 --repo RedHatQE/openshift-virtualization-tests --json headRefOid --jq '.headRefOid')
echo "HEAD SHA: $COMMIT_SHA"

# Confirm first changed file and first diff line
gh pr diff 5188 --repo RedHatQE/openshift-virtualization-tests | head -20

Length of output: 1257


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - << 'PYEOF'
import json, os, urllib.request, sys

token = os.popen("gh auth token").read().strip()
commit_sha = "9b40449ffdadef0c18f601e9fe536d2dff988459"

body = (
    "## Test Execution Plan\n\n"
    "**Run smoke tests: True**\n"
    "Dependency path: every smoke test (e.g. `tests/virt/node/general/test_container_disk_vm.py`) "
    "-> `tests/conftest.py` (`from utilities.constants import ...`) "
    "-> `utilities/constants/__init__.py` (restructured package, calls `_get_cluster_architecture()` at import time). "
    "`tests/conftest.py` is in the conftest hierarchy of **all** tests in the repo; "
    "any import-time failure in `utilities/constants` breaks collection for all smoke tests.\n\n"
    "**Run gating tests: True**\n"
    "Concrete dependency paths:\n"
    "- `tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py` (gating) "
    "-> `tests/install_upgrade_operators/relationship_labels/constants.py` imports `VIRTCTL_CLI_DOWNLOADS` "
    "from `utilities.constants` (renamed from `VIRTCTL_CLIDOWNLOADS_KUBEVIRT_HYPERCONVERGED`)\n"
    "- `tests/install_upgrade_operators/product_upgrade/test_upgrade.py` (gating, cnv_upgrade) "
    "-> `tests/install_upgrade_operators/product_upgrade/utils.py` imports `BREW_REGISTRY_SOURCE` "
    "(typo fix from `BREW_REGISTERY_SOURCE`)\n"
    "- All remaining gating tests transitively affected via `tests/conftest.py`\n\n"
    "---\n\n"
    "**Affected tests to run**\n\n"
    "| Path | Marker |\n"
    "|------|--------|\n"
    "| `utilities/unittests/test_constants.py` | unit |\n"
    "| `utilities/unittests/test_oadp.py` | unit |\n"
    "| `tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py` | gating |\n"
    "| `tests/install_upgrade_operators/product_upgrade/test_upgrade.py` | gating, cnv_upgrade |\n"
    "| `tests/install_upgrade_operators/deployment/test_hco_deployment_params.py` | gating, smoke |\n"
    "| `tests/install_upgrade_operators/hco_enablement_golden_image_updates/test_custom_golden_images_namespace.py` | gating, smoke |\n"
    "| `tests/infrastructure/instance_types/supported_os/test_rhel_os.py` | smoke, gating |\n"
    "| `tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py` | smoke |\n"
    "| `tests/storage/cdi_upload/test_upload_virtctl.py` | smoke |\n"
    "| `tests/storage/cdi_clone/test_clone.py` | smoke, gating |\n\n"
    "---\n\n"
    "**Real tests (cluster required)**\n\n"
    "`utilities/constants/__init__.py` calls `_get_cluster_architecture()` at **module load time** "
    "to compute `Images`. Every test session triggers this at collection time.\n\n"
    "Collection startup check (confirms no `ImportError`/`AttributeError`):\n"
    "```\n"
    "pytest tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py --collect-only\n"
    "pytest tests/install_upgrade_operators/product_upgrade/test_upgrade.py --collect-only\n"
    "```\n\n"
    "Renamed constant regression (`VIRTCTL_CLI_DOWNLOADS`):\n"
    "```\n"
    "pytest tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py -m gating\n"
    "```\n\n"
    "Typo-fix regression (`BREW_REGISTRY_SOURCE`):\n"
    "```\n"
    "pytest tests/install_upgrade_operators/product_upgrade/test_upgrade.py -m 'gating and cnv_upgrade'\n"
    "```\n"
)

payload = {
    "commit_id": commit_sha,
    "event": "COMMENT",
    "body": "",
    "comments": [
        {
            "path": "tests/global_config.py",
            "line": 18,
            "side": "RIGHT",
            "body": body
        }
    ]
}

data = json.dumps(payload).encode("utf-8")
req = urllib.request.Request(
    "https://api.github.com/repos/RedHatQE/openshift-virtualization-tests/pulls/5188/reviews",
    data=data,
    headers={
        "Authorization": "Bearer " + token,
        "Accept": "application/vnd.github+json",
        "Content-Type": "application/json",
        "X-GitHub-Api-Version": "2022-11-28",
    },
    method="POST"
)

try:
    with urllib.request.urlopen(req) as resp:
        result = json.loads(resp.read())
        print("SUCCESS: review id=" + str(result.get("id")) + ", url=" + str(result.get("html_url")))
except urllib.error.HTTPError as e:
    body_err = e.read().decode()
    print("HTTP ERROR " + str(e.code) + ": " + body_err)
    sys.exit(1)
PYEOF

Length of output: 7207


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 -c "
import json

body = '''## Test Execution Plan

**Run smoke tests: True**
Dependency path: every smoke test (e.g. \`tests/virt/node/general/test_container_disk_vm.py\`) -> \`tests/conftest.py\` (\`from utilities.constants import ...\`) -> \`utilities/constants/__init__.py\` (restructured package, calls \`_get_cluster_architecture()\` at import time). \`tests/conftest.py\` is in the conftest hierarchy of **all** tests in the repo; any import-time failure in \`utilities/constants\` breaks collection for all smoke tests.

**Run gating tests: True**
Concrete dependency paths:
- \`tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py\` (gating) -> \`tests/install_upgrade_operators/relationship_labels/constants.py\` imports \`VIRTCTL_CLI_DOWNLOADS\` from \`utilities.constants\` (renamed from \`VIRTCTL_CLIDOWNLOADS_KUBEVIRT_HYPERCONVERGED\`)
- \`tests/install_upgrade_operators/product_upgrade/test_upgrade.py\` (gating, cnv_upgrade) -> \`tests/install_upgrade_operators/product_upgrade/utils.py\` imports \`BREW_REGISTRY_SOURCE\` (typo fix from \`BREW_REGISTERY_SOURCE\`)
- All remaining gating tests transitively affected via \`tests/conftest.py\`

---

**Affected tests to run**

| Path | Marker |
|------|--------|
| \`utilities/unittests/test_constants.py\` | unit |
| \`utilities/unittests/test_oadp.py\` | unit |
| \`tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py\` | gating |
| \`tests/install_upgrade_operators/product_upgrade/test_upgrade.py\` | gating, cnv_upgrade |
| \`tests/install_upgrade_operators/deployment/test_hco_deployment_params.py\` | gating, smoke |
| \`tests/install_upgrade_operators/hco_enablement_golden_image_updates/test_custom_golden_images_namespace.py\` | gating, smoke |
| \`tests/infrastructure/instance_types/supported_os/test_rhel_os.py\` | smoke, gating |
| \`tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py\` | smoke |
| \`tests/storage/cdi_upload/test_upload_virtctl.py\` | smoke |
| \`tests/storage/cdi_clone/test_clone.py\` | smoke, gating |

---

**Real tests (cluster required)**

\`utilities/constants/__init__.py\` calls \`_get_cluster_architecture()\` at **module load time** to compute \`Images\`. Every test session triggers this at collection time.

Collection startup check (confirms no \`ImportError\`/\`AttributeError\`):
\`\`\`
pytest tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py --collect-only
pytest tests/install_upgrade_operators/product_upgrade/test_upgrade.py --collect-only
\`\`\`

Renamed constant regression (\`VIRTCTL_CLI_DOWNLOADS\`):
\`\`\`
pytest tests/install_upgrade_operators/relationship_labels/test_relationship_labels.py -m gating
\`\`\`

Typo-fix regression (\`BREW_REGISTRY_SOURCE\`):
\`\`\`
pytest tests/install_upgrade_operators/product_upgrade/test_upgrade.py -m 'gating and cnv_upgrade'
\`\`\`'''

payload = {
    'commit_id': '9b40449ffdadef0c18f601e9fe536d2dff988459',
    'event': 'COMMENT',
    'body': '',
    'comments': [
        {
            'path': 'tests/global_config.py',
            'line': 18,
            'side': 'RIGHT',
            'body': body
        }
    ]
}

with open('/tmp/review_payload.json', 'w') as f:
    json.dump(payload, f)
print('payload written')
"

gh api \
  --method POST \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  /repos/RedHatQE/openshift-virtualization-tests/pulls/5188/reviews \
  --input /tmp/review_payload.json \
  --jq '"Review posted: id=\(.id) url=\(.html_url)"'

Length of output: 3789



The Test Execution Plan has been posted as a non-blocking inline review comment on tests/global_config.py line 18 (review #4524715848).

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.