Skip to content

refactor(constants): migrate chaos and utilities imports to submodules#5323

Merged
vsibirsk merged 3 commits into
RedHatQE:mainfrom
vsibirsk:vk-migrate-remaining-imports
Jun 30, 2026
Merged

refactor(constants): migrate chaos and utilities imports to submodules#5323
vsibirsk merged 3 commits into
RedHatQE:mainfrom
vsibirsk:vk-migrate-remaining-imports

Conversation

@vsibirsk

@vsibirsk vsibirsk commented Jun 23, 2026

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

Replace from utilities.constants import X with direct submodule imports in tests/chaos/ and utilities/*.py. Images stays on the package shim until the compat shim is dropped.

Generated-by: Claude Sonnet 4.6

Which issue(s) this PR fixes:
Special notes for reviewer:

This is a next PR in a series.
https://redhat.atlassian.net/browse/CNV-80952 and a follow up of #5188

jira-ticket:

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

Summary by CodeRabbit

  • Refactor

    • Reorganized shared constant imports across utilities and test helpers to use more specific sources.
    • Reduced reliance on broad grouped imports while keeping behavior unchanged.
    • Improved consistency in how timeout, networking, storage, monitoring, and VM-related values are referenced.
  • Tests

    • Updated test and chaos fixtures to match the new import structure without changing test logic.

@coderabbitai

coderabbitai Bot commented Jun 23, 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: 0d0f70c6-17a5-4153-acf3-1444b1a7e1b3

📥 Commits

Reviewing files that changed from the base of the PR and between be382b2 and 64e1160.

📒 Files selected for processing (32)
  • tests/chaos/conftest.py
  • tests/chaos/migration/conftest.py
  • tests/chaos/migration/test_migration.py
  • tests/chaos/oadp/conftest.py
  • tests/chaos/oadp/test_oadp.py
  • tests/chaos/snapshot/conftest.py
  • tests/chaos/snapshot/test_snapshot.py
  • tests/chaos/snapshot/utils.py
  • tests/chaos/standard/test_standard.py
  • tests/chaos/utils.py
  • utilities/artifactory.py
  • utilities/console.py
  • utilities/cpu.py
  • utilities/data_collector.py
  • utilities/guest_support.py
  • utilities/hco.py
  • utilities/infra.py
  • utilities/monitoring.py
  • utilities/must_gather.py
  • utilities/network.py
  • utilities/oadp.py
  • utilities/operator.py
  • utilities/os_utils.py
  • utilities/pytest_utils.py
  • utilities/sanity.py
  • utilities/ssp.py
  • utilities/storage.py
  • utilities/unittests/test_oadp.py
  • utilities/unittests/test_os_utils.py
  • utilities/unittests/test_pytest_utils.py
  • utilities/virt.py
  • utilities/vnc_utils.py

📝 Walkthrough

<stack_title>Constants submodule import refactor</stack_title>
<stack_summary>All constant imports across utilities modules and tests/chaos are redirected from the monolithic utilities.constants to granular submodules; no runtime logic changes.</stack_summary>

Every changed file replaces bulk imports from utilities.constants with targeted imports from utilities.constants.* submodules across utilities and tests/chaos. Utility modules (virt, hco, infra, monitoring, network, oadp, operator, os_utils, pytest_utils, sanity, ssp, storage, console, cpu, data_collector, guest_support, must_gather, artifactory, vnc_utils) updated to import from specific submodules. range_8e3209776114 range_49e8f9c4ef12 range_c0e750e4c9a4 range_24d6f2a4659a range_16333d20db1b range_ebc961bfa74d range_67c624fa8e0a range_e21d55000e4d range_4a6677a27db8 range_122bbb84b573 range_eae76ee719c4 range_9a0e76879c9f range_e3477add16dc range_6b3a36986496 range_903b69d9db9d range_683ca64a247b range_68032d9875fb range_be14bf8a832b range_62c5dad07c02 range_90684cdcf9d3 range_38934757f9ef range_c3ae72ed829a range_21762be28048 range_e247506c419b range_2f22b2657bcf range_3bb43693d91f tests/chaos modules (conftest, migration, oadp, snapshot, standard, utils) updated to import constants from specific submodules. range_5ed2b59be3d6 range_4530e68202b5 range_20ef33c57972 range_ec5d9a2b4527 range_de47561c96ca range_0728cf94a051 range_4feb4d5d5d40 range_6d203519c87f range_1345bc0aa9ff range_515be7120cd9 range_790f604a598c

Walkthrough

All constant imports across utilities/ modules and tests/chaos/ test files are redirected from the monolithic utilities.constants to granular submodules (utilities.constants.timeouts, .virt, .hco, .networking, .images, etc.). No runtime logic, public APIs, or fixture behavior is changed.

Changes

Constants Submodule Import Refactor

Layer / File(s) Summary
Utilities modules import refactor
utilities/virt.py, utilities/hco.py, utilities/infra.py, utilities/monitoring.py, utilities/network.py, utilities/oadp.py, utilities/operator.py, utilities/os_utils.py, utilities/pytest_utils.py, utilities/sanity.py, utilities/ssp.py, utilities/storage.py, utilities/console.py, utilities/cpu.py, utilities/data_collector.py, utilities/guest_support.py, utilities/must_gather.py, utilities/artifactory.py, utilities/vnc_utils.py, utilities/unittests/test_*.py
Bulk from utilities.constants import (...) blocks replaced with targeted imports from submodules such as .timeouts, .virt, .hco, .networking, .components, .images, .cluster, .architecture, .instance_types, .storage, .monitoring, .cpu_models, .os_matrix, .oadp, and .pytest. Images remains imported from utilities.constants directly.
tests/chaos import refactor
tests/chaos/conftest.py, tests/chaos/utils.py, tests/chaos/migration/conftest.py, tests/chaos/migration/test_migration.py, tests/chaos/oadp/conftest.py, tests/chaos/oadp/test_oadp.py, tests/chaos/snapshot/conftest.py, tests/chaos/snapshot/test_snapshot.py, tests/chaos/snapshot/utils.py, tests/chaos/standard/test_standard.py
Same pattern applied: all aggregated utilities.constants imports split into targeted submodule imports aligned with the new package layout.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • rlobillo
  • dshchedr
  • OhadRevah
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is under 120 characters and clearly describes the import refactor across chaos and utilities modules.
Description check ✅ Passed The description matches the template and includes purpose, reviewer notes, and a Jira ticket; only the issue section is left blank.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stp Link Required ✅ Passed No new test files or added def test_* blocks appear in main..HEAD; this PR only refactors imports.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

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


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

❤️ Share

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

@openshift-virtualization-qe-bot-5

Copy link
Copy Markdown

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: A tracking issue is created for this PR and will be closed when the PR is merged or closed
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: Enabled categories: branch, can-be-merged, cherry-pick, has-conflicts, hold, needs-rebase, size, verified, wip

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (approvers only)
  • /hold cancel - Unblock PR merging
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)
  • /regenerate-welcome - Regenerate this welcome message
  • /security-override - Set security check runs to pass (maintainers only)
  • /security-override cancel - Re-run security checks

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
  • /cherry-pick-retry <branch> - Retry a failed cherry-pick (merged PRs only)

Branch Management

  • /rebase - Rebase this PR branch onto its base branch

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:

  • RoniKishner
  • dshchedr
  • geetikakay
  • rnetser
  • sarahbx
  • vsibirsk
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
AI Features
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6[1m])
Security Checks
  • Suspicious Path Detection: Monitors paths: .claude/, .vscode/, .cursor/, .devcontainer/, .pi/, .github/workflows/, .github/actions/
  • Committer Identity Check: Verifies last committer matches PR author
  • Mandatory: Security checks block merge (use /security-override to bypass — maintainers only)

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

Replace `from utilities.constants import X` with direct submodule imports
in tests/chaos/ and utilities/*.py. Images stays on the package shim
until the compat shim is dropped.

Generated-by: Claude Sonnet 4.6
Signed-off-by: vsibirsk <vsibirsk@redhat.com>
@vsibirsk
vsibirsk force-pushed the vk-migrate-remaining-imports branch from f81c816 to 64e1160 Compare June 28, 2026 10:59
@vsibirsk

Copy link
Copy Markdown
Collaborator Author

/verified

collect only since it's only import path updates (no logic change)

uv run pytest -rA -s -o log_cli=true --tc-file=tests/global_config_amd64.py --tc-format=python --cluster-sanity-skip-check --storage-class-matrix=ocs-storagecluster-ceph-rbd-virtualization --skip-deprecated-api-test tests/ --collect-only
...
================================================================================ 2145/2223 tests collected (78 deselected) in 3.54s ================================================================================

================================================================================ 2145/2223 tests collected (78 deselected) in 3.54s ================================================================================

@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.67%. Comparing base (a2dc143) to head (80f5779).
⚠️ Report is 179 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5323   +/-   ##
=======================================
  Coverage   98.67%   98.67%           
=======================================
  Files          25       42   +17     
  Lines        2487     2492    +5     
=======================================
+ Hits         2454     2459    +5     
  Misses         33       33           
Flag Coverage Δ
utilities 98.67% <100.00%> (+<0.01%) ⬆️

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.

@openshift-virtualization-qe-bot-5

Copy link
Copy Markdown

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

@vsibirsk

Copy link
Copy Markdown
Collaborator Author

/retest tox

@openshift-virtualization-qe-bot

Copy link
Copy Markdown

Clean rebase detected — no code changes compared to previous head (43f81ae).
The following labels were preserved: verified, lgtm-hmeir, lgtm-jpeimer, lgtm-coderabbitai[bot].

@vsibirsk

Copy link
Copy Markdown
Collaborator Author

/rerun-smoke

@rnetser

rnetser commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

/approve

@rnetser

rnetser commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

/lgtm

@geetikakay

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

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

@vsibirsk
vsibirsk deleted the vk-migrate-remaining-imports branch June 30, 2026 19:13
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.