Skip to content

[WIP] Replace static inventory tests with dynamic subtest-based validation#5614

Draft
OhadRevah wants to merge 6 commits into
RedHatQE:mainfrom
OhadRevah:dynamic-subtests-iuo-validation
Draft

[WIP] Replace static inventory tests with dynamic subtest-based validation#5614
OhadRevah wants to merge 6 commits into
RedHatQE:mainfrom
OhadRevah:dynamic-subtests-iuo-validation

Conversation

@OhadRevah

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

Static constants (ALL_CNV_DEPLOYMENTS, ALL_CNV_PODS, etc.) drove
both "no new X" change-detection tests and parametrized validation tests.
Every new CNV component required manually updating these lists which causing
false CI failures (10 in a CNV 5.0 run, zero real bugs) and leaving new
components unvalidated until constants were updated.

In order to solve this problem and make these tests more robust, these things done in this PR:

  • Remove 4 "no new X" tests (team learns about new components from sprint planning)
  • Add session-scoped discovery fixtures that query the cluster for all
    deployments/pods/daemonsets, validate base components exist, and log extras
  • Convert validation tests (image, SCC, priority class, labels, reconciliation)
    from static matrix parametrization to dynamic subtests over discovered resources
  • Add version-aware feature gate handling for CNV 5.0 graduated gates

New components are now automatically validated without constants updates.
Missing base components trigger assertion failures.

Which issue(s) this PR fixes:

Fixes false failures from rootcoz analysis bde47d45-b3ac-4640-b273-1d0855226c13
(test-pytest-cnv-5.0-iuo-ocs-dualstream #1): test_no_new_cnv_deployments_added,
test_no_new_cnv_pods_added, test_no_new_cnv_crds, test_no_new_hco_related_objects,
test_default_featuregates_by_resource, test_managed_cr_featuregate_reconcile

Special notes for reviewer:
jira-ticket:

Remove 4 tests that compare cluster components against hardcoded lists
and fail when new items appear. These tests generate recurring maintenance
overhead every release without catching real defects — new components are
always intentional and the fix is always adding the entry to the list.

Removed tests:
- test_no_new_cnv_deployments_added (CNV-8289)
- test_no_new_cnv_pods_added (CNV-7261)
- test_no_new_cnv_crds (CNV-8508)
- test_no_new_hco_related_objects (CNV-9843)

Add pytest-subtests dependency for upcoming conversion of matrix-parametrized
validation tests to dynamic subtest-based tests.

assisted by: claude code claude-opus-4-6
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Signed-off-by: Ohad <orevah@redhat.com>
Replace matrix-parametrized validation tests with dynamic cluster discovery
using pytest-subtests. Tests now discover all CNV components from the cluster
at runtime and validate each one as a subtest.

- Add discovered_cnv_deployments, discovered_cnv_pods, discovered_cnv_daemonsets
  session-scoped fixtures that query the cluster and validate base components exist
- Convert deployment tests (priority class, container image) to subtests
- Convert pod tests (priority class, resource request, container image) to subtests
- Convert SCC annotation tests to use dynamic discovery
- Convert SNO deployment test to subtests
- Convert relationship labels tests to subtests
- Convert CRD must-gather test to subtests
- Convert HCO related objects reconciliation test to subtests
- Remove unused matrix fixtures (cnv_deployment_by_name, cnv_pods_by_type,
  cnv_deployments_excluding_hpp_pool, kubevirt_crd_by_type, etc.)

assisted by: claude code claude-opus-4-6
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Signed-off-by: Ohad <orevah@redhat.com>
Remove cnv_deployment_matrix, cnv_pod_matrix, cnv_daemonset_matrix,
cnv_crd_matrix, cnv_related_object_matrix from global_config.py and
global_config_sno_hpp.py. Remove unused matrix fixtures
(cnv_daemonset_by_name, cnv_pods_by_type, related_object_from_hco_status)
from IUO conftest. Convert SNO daemonset test to subtests.

assisted by: claude code claude-opus-4-6
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Signed-off-by: Ohad <orevah@redhat.com>
Add GRADUATED_KUBEVIRT_FEATUREGATES_CNV_5 and GRADUATED_HCO_FEATUREGATES_CNV_5
sets containing feature gates that graduated to GA or were removed in CNV 5.0.

Update the expected_value fixture to subtract graduated gates when running
on CNV 5.0+ clusters, so tests pass on both 4.22 and 5.0:
- KubeVirt: ExpandDisks, VMExport, LiveUpdateNADRef, WithHostModelCPU
- HCO: disableMDevConfiguration

assisted by: claude code claude-opus-4-6
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Signed-off-by: Ohad <orevah@redhat.com>
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Ignore keyword(s) in the title.

⛔ Ignored keywords (1)
  • WIP

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

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: de22afec-f077-4d40-a01a-4ac7deb9c03f

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ 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.

uv.lock is managed separately, revert to main.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Ohad <orevah@redhat.com>
Dependency additions are managed separately.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Ohad <orevah@redhat.com>
@OhadRevah

Copy link
Copy Markdown
Contributor Author

/build-and-push-container

@openshift-virtualization-qe-bot-4

Copy link
Copy Markdown

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

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.

4 participants