Skip to content

storage: STD for storage class migration cleanup#4340

Open
duyanyan wants to merge 1 commit intoRedHatQE:mainfrom
duyanyan:std_storage_cleanup
Open

storage: STD for storage class migration cleanup#4340
duyanyan wants to merge 1 commit intoRedHatQE:mainfrom
duyanyan:std_storage_cleanup

Conversation

@duyanyan
Copy link
Copy Markdown
Contributor

@duyanyan duyanyan commented Apr 1, 2026

Short description:

Introduce STD for storage migration cleanup feature which allows the system to optionally decommission migration plans and legacy PVCs upon successful completion

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

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

Summary by CodeRabbit

  • Tests
    • Added test suite for validating storage migration retention policies across multiple namespace configurations. Coverage includes: default behavior when policies are unspecified, namespace-level retention policy enforcement, specification-level policy configuration, and combined policy scenarios where namespace-level settings can override specification-level settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

📝 Walkthrough

Walkthrough

A new test module defining a test class for virtual machine storage migration plan retention policy behavior is added. The test class contains four methods that verify default, namespace-level, spec-level, and combined retention policy scenarios. Currently, the test methods contain only docstring documentation without executable test logic.

Changes

Cohort / File(s) Summary
VM Storage Migration Retention Policy Tests
tests/storage/test_storage_class_migration_cleanup.py
New test module with TestMultiNamespaceVirtualMachineStorageMigrationPlanRetentionPolicy class containing four Polarion-annotated Tier2 test methods. Methods verify default behavior (source DataVolumes/PVCs retention), namespace-level deleteSource policy, spec-level deleteSource policy, and combined policy override scenarios. Test bodies contain only docstrings; no executable logic implemented.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: introducing an STD (test definition) for storage class migration cleanup, which matches the PR's core objective of adding test cases for this feature.
Description check ✅ Passed The description follows the template structure with short description, Jira ticket, and other required sections. However, 'More details', 'What this PR does / why we need it', 'Which issue(s) this PR fixes', and 'Special notes for reviewer' sections are empty or incomplete.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

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

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

❤️ Share

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

@openshift-virtualization-qe-bot
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

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:

  • jpeimer

Reviewers:

  • Ahmad-Hafe
  • dalia-frank
  • duyanyan
  • josemacassan
  • jpeimer
  • kgoldbla
  • kshvaika
  • stesrn
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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/storage/test_storage_class_migration_cleanup.py`:
- Line 1: Move the new test file
tests/storage/test_storage_class_migration_cleanup.py into a feature
subdirectory (e.g.,
tests/storage/storage_migration_cleanup/test_storage_class_migration_cleanup.py)
to comply with the repository test-layout rule; after moving, update any
imports, pytest collection references, and CI/test-suite config that reference
the original module name or path (search for occurrences of
test_storage_class_migration_cleanup or the original file path) so the test
still runs under its new package location and ownership boundary.
- Line 18: Remove the module-level "__test__ = False" and instead disable each
placeholder test individually by placing "__test__ = False" immediately after
each docstring-only test function definition (i.e., for every placeholder test
function in this file, add the per-test "__test__ = False" line directly
following its def block rather than using a file-wide flag).
🪄 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: 734f2cc4-bfae-4724-8213-ed4ec6a38f52

📥 Commits

Reviewing files that changed from the base of the PR and between 4fa833a and 9f7673a.

📒 Files selected for processing (1)
  • tests/storage/test_storage_class_migration_cleanup.py

@@ -0,0 +1,118 @@
"""
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.

🛠️ Refactor suggestion | 🟠 Major

MEDIUM: Place this new feature under a dedicated storage subdirectory

Current location (tests/storage/test_storage_class_migration_cleanup.py) violates the repository test-layout rule for feature isolation. Please move it to a feature folder (example: tests/storage/storage_migration_cleanup/test_storage_class_migration_cleanup.py) to align discovery and ownership boundaries.

As per coding guidelines: “Feature subdirectories REQUIRED - each feature MUST have its own subdirectory under component …”

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/storage/test_storage_class_migration_cleanup.py` at line 1, Move the
new test file tests/storage/test_storage_class_migration_cleanup.py into a
feature subdirectory (e.g.,
tests/storage/storage_migration_cleanup/test_storage_class_migration_cleanup.py)
to comply with the repository test-layout rule; after moving, update any
imports, pytest collection references, and CI/test-suite config that reference
the original module name or path (search for occurrences of
test_storage_class_migration_cleanup or the original file path) so the test
still runs under its new package location and ownership boundary.


import pytest

__test__ = False
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

HIGH: Replace module-level __test__ = False with per-test flags

Using module-level __test__ = False disables the entire file and makes incremental activation of individual tests harder/safer in follow-up PRs. In this repository’s STD pattern, each placeholder test should be disabled explicitly right after its definition.

Proposed fix
-__test__ = False
@@
 class TestMultiNamespaceVirtualMachineStorageMigrationPlanRetentionPolicy:
@@
     def test_retention_policy_default_behavior(self):
         """
         ...
         """
+    test_retention_policy_default_behavior.__test__ = False
@@
     def test_namespace_level_retention_policy_delete_source(self):
         """
         ...
         """
+    test_namespace_level_retention_policy_delete_source.__test__ = False
@@
     def test_spec_level_retention_policy_delete_source(self):
         """
         ...
         """
+    test_spec_level_retention_policy_delete_source.__test__ = False
@@
     def test_combined_namespace_and_spec_level_retention_policy(self):
         """
         ...
         """
+    test_combined_namespace_and_spec_level_retention_policy.__test__ = False

Based on learnings: STD placeholder tests under tests/ are intentionally docstring-only and “must be marked with __test__ = False immediately after the function definition.”

📝 Committable suggestion

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

Suggested change
__test__ = False
class TestMultiNamespaceVirtualMachineStorageMigrationPlanRetentionPolicy:
def test_retention_policy_default_behavior(self):
"""
...
"""
test_retention_policy_default_behavior.__test__ = False
def test_namespace_level_retention_policy_delete_source(self):
"""
...
"""
test_namespace_level_retention_policy_delete_source.__test__ = False
def test_spec_level_retention_policy_delete_source(self):
"""
...
"""
test_spec_level_retention_policy_delete_source.__test__ = False
def test_combined_namespace_and_spec_level_retention_policy(self):
"""
...
"""
test_combined_namespace_and_spec_level_retention_policy.__test__ = False
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/storage/test_storage_class_migration_cleanup.py` at line 18, Remove the
module-level "__test__ = False" and instead disable each placeholder test
individually by placing "__test__ = False" immediately after each docstring-only
test function definition (i.e., for every placeholder test function in this
file, add the per-test "__test__ = False" line directly following its def block
rather than using a file-wide flag).

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.

5 participants