Skip to content

Add STD for vnic_info metric NAD swap test#4601

Open
OhadRevah wants to merge 2 commits intoRedHatQE:mainfrom
OhadRevah:add-vnic-info-nad-swap-std
Open

Add STD for vnic_info metric NAD swap test#4601
OhadRevah wants to merge 2 commits intoRedHatQE:mainfrom
OhadRevah:add-vnic-info-nad-swap-std

Conversation

@OhadRevah
Copy link
Copy Markdown
Contributor

@OhadRevah OhadRevah commented Apr 27, 2026

Short description:

Add test stub with STD for verifying that
kubevirt_vm_vnic_info and kubevirt_vmi_vnic_info Prometheus metrics update their network label after swapping a VM's secondary NAD reference. Parametrized for both metric variants.

assisted by: claude code claude-opus-4-6

More details:

As part of NAD reference live-update STP

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-85546

Summary by CodeRabbit

  • Tests
    • Added test coverage for validating KubeVirt virtual machine metrics accurately reflect network configuration changes. Test currently disabled pending further development.

Add test stub with STD for verifying that
kubevirt_vm_vnic_info and kubevirt_vmi_vnic_info Prometheus metrics
update their network label after swapping a VM's secondary NAD
reference. Parametrized for both metric variants.

assisted by: claude code claude-opus-4-6
Signed-off-by: Ohad <orevah@redhat.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

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: 7cb1bfd8-9db4-4386-bd38-c2ee92b5ee6a

📥 Commits

Reviewing files that changed from the base of the PR and between b675fe1 and 920fb44.

📒 Files selected for processing (1)
  • tests/observability/metrics/test_vms_metrics.py

📝 Walkthrough

Walkthrough

A new parametrized test method is introduced to validate that vnic_info metrics accurately reflect VM specifications after swapping secondary network references between network attachment definitions. The test is disabled from pytest discovery.

Changes

Cohort / File(s) Summary
Test Addition
tests/observability/metrics/test_vms_metrics.py
New parametrized test test_metric_kubevirt_vm_vnic_info_after_nad_swap() added to TestVmVnicInfo class to validate kubevirt_vm_vnic_info and kubevirt_vmi_vnic_info metrics for secondary vNICs. Includes Polarion references CNV-12225 and CNV-12226. Test is explicitly disabled from collection via __test__ = False.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add STD for vnic_info metric NAD swap test' accurately reflects the main change: introducing a test stub with an STD for validating vnic_info metrics after NAD swapping.
Description check ✅ Passed The PR description covers most required sections with substantive content: short description explains the test's purpose, more details provides design-doc context, and jira-ticket includes the full URL (CNV-85546). Only 'What this PR does/why we need it' and 'Special notes for reviewer' are incomplete, which are non-critical.
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.

✏️ 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-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

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

@openshift-virtualization-qe-bot-5
Copy link
Copy Markdown

Clean rebase detected — no code changes compared to previous head (920fb44).
The following labels were preserved: lgtm-coderabbitai[bot].

@openshift-virtualization-qe-bot
Copy link
Copy Markdown

D/S test tox -e verify-tc-requirement-polarion failed: cnv-tests-tox-executor/27239

@openshift-virtualization-qe-bot
Copy link
Copy Markdown

D/S test tox -e verify-tc-requirement-polarion failed: cnv-tests-tox-executor/27240


Steps:
1. Swap the VM secondary network reference from NAD-A to NAD-B
2. Wait for the live migration triggered by the swap to complete
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.

In network tests we probably won't wait for this condition since the migration is not exposed to the user
Do you usually wait for seamless migration to complete in metrics tests?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants