Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
"""
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 | ⚡ Quick win

HIGH: PR template is missing meaningful “What this PR does / why we need it” content.

This PR is currently non-compliant with repository merge requirements and should be updated before merge.

As per coding guidelines, ##### What this PR does / why we need it: must be present and meaningful (not empty/placeholder).

🤖 Prompt for 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.

In
`@tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_images_support.py`
at line 1, The top-of-file module docstring in
test_multiarch_golden_images_support.py is only a placeholder; update the
module-level comment (the triple-quoted docstring at the top of the file) to
include a meaningful "##### What this PR does / why we need it:" section
describing the change and rationale so the PR meets repository merge
requirements; ensure the new text clearly states the purpose of this test file
and why the golden-image multiarch support change is required.

Multi-Architecture Golden Image Tests

STP Reference:
https://github.com/RedHatQE/openshift-virtualization-tests-design-docs/blob/main/stps/sig-iuo/multiarch_arm_support.md

Preconditions:
- Multi-architecture cluster with AMD64 and ARM64 worker nodes
- "enableMultiArchBootImageImport" feature gate enabled in HCO CR
- Prometheus is installed and running
Comment on lines +7 to +10
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 | 🟡 Minor | ⚡ Quick win

MEDIUM: Preconditions are internally inconsistent for feature-gate state.

Line 9 says the feature gate is enabled at module scope, while Line 29 defines disabled-state tests. This creates ambiguous setup guidance and can lead to implementing tests against the wrong baseline.

Suggested doc fix
 Preconditions:
     - Multi-architecture cluster with AMD64 and ARM64 worker nodes
-    - "enableMultiArchBootImageImport" feature gate enabled in HCO CR
     - Prometheus is installed and running

Also applies to: 28-30, 102-104, 147-149

🤖 Prompt for 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.

In
`@tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_images_support.py`
around lines 7 - 10, The precondition text in
test_multiarch_golden_images_support.py is inconsistent about the
"enableMultiArchBootImageImport" feature gate (module-level preamble says
enabled while later tests expect it disabled); update the module preamble and
any repeated precondition blocks (occurrences around lines 28-30, 102-104,
147-149) to match the actual baseline the tests implement (either change the
preamble to state the feature gate is disabled, or modify the disabled-state
tests to expect enabled), and ensure the string "enableMultiArchBootImageImport"
is corrected consistently across the file so all tests and descriptions reflect
the same feature-gate state.


Markers:
- multiarch
- post_upgrade
"""

import pytest

__test__ = False


class TestDisabledMultiarchGoldenImagesSupport:
"""
Tests for boot source state and misconfiguration metrics when
multi-architecture golden images support is disabled on a
heterogeneous cluster.

Preconditions:
- "enableMultiArchBootImageImport" feature gate disabled in HCO CR
"""

@pytest.mark.polarion("CNV-15977")
def test_only_architecture_agnostic_golden_image_resources_exist(self):
"""
Test that only architecture-agnostic golden image resources exist
after disabling multi-architecture golden images support.

Parametrize:
- resource_type:
- DataImportCron
- DataSource

Steps:
1. List resources of the parametrized type in the golden images namespace.
2. Verify arch-suffix resources are not present.

Expected:
- No resources exist with architecture suffix.
"""

@pytest.mark.polarion("CNV-15978")
def test_architecture_agnostic_data_sources_rollback(self):
"""
Test that architecture-agnostic (pointer) DataSources remain available after
disabling multi-architecture golden images support, and pointing to a pvc/snapshot source.

Steps:
1. Get architecture-agnostic DataSources from golden images namespace.
2. Wait for them to be in ready condition.

Expected:
- Architecture-agnostic DataSources reference a pvc/snapshot source.
"""

@pytest.mark.polarion("CNV-15979")
def test_kubevirt_hco_multi_arch_boot_images_enabled_metric(self):
"""
Test that the metric is indicating that multi-arch
golden images support is disabled on a multiarch cluster.

Steps:
1. Query the metric.

Expected:
- Metric value is 0.
"""
Comment thread
coderabbitai[bot] marked this conversation as resolved.

@pytest.mark.polarion("CNV-15980")
def test_kubevirt_hco_multi_arch_boot_images_enabled_metric_cleared(self):
"""
Test that the metric is indicating that multi-arch support is enabled
when nodePlacement restricts workloads to a single architecture.

Preconditions:
- nodePlacement restricts workloads to a single architecture in HCO CR.

Steps:
1. Query the metric.

Expected:
- Metric value is 1.
"""


class TestEnabledMultiarchGoldenImagesSupport:
"""
Tests for architecture-specific golden image boot sources availability
and correctness on a heterogeneous cluster.

Preconditions:
- "enableMultiArchBootImageImport" feature gate enabled in HCO CR
"""

@pytest.mark.polarion("CNV-15981")
def test_architecture_specific_golden_image_resources(self):
"""
Test that architecture-specific golden image resources are created
for each common DataImportCronTemplate and each supported cluster architecture.

Parametrize:
- resource_type, expected_condition:
- DataImportCron, UpToDate
- DataSource, Ready

Steps:
1. Get supported architectures from cluster worker nodes.
2. List parametrized resources in the golden images namespace.

Expected:
- Architecture-specific golden image resources exist for each supported
architecture matching the workers architectures and in expected condition.
"""

@pytest.mark.polarion("CNV-15982")
def test_architecture_agnostic_data_sources(self):
"""
Test that architecture-agnostic (pointer) DataSources are referencing
the default architecture-specific DataSource.

Steps:
1. Get architecture-agnostic DataSources from golden images namespace.
2. Get control-plane architecture.

Expected:
- DataSources in ready condition and referencing the control-plane
architecture-specific DataSource.
"""


class TestMultiarchGoldenImageAnnotationMetrics:
"""
Tests for misconfiguration metrics on golden image annotation issues
when "enableMultiArchBootImageImport" feature gate is enabled in HCO CR.

Preconditions:
- "enableMultiArchBootImageImport" feature gate enabled in HCO CR
"""

@pytest.mark.polarion("CNV-15983")
def test_kubevirt_hco_dataimportcrontemplate_with_supported_architectures_metric(self):
"""
Test that a misconfiguration metric is reported when a golden
image is annotated with an architecture not supported by the cluster.

Preconditions:
- HCO CR is patched with a custom DataImportCronTemplate annotated
with architecture not supported by the cluster.

Steps:
1. Query the metric.

Expected:
- Metric value is 0.
"""

@pytest.mark.polarion("CNV-15984")
def test_kubevirt_hco_dataimportcrontemplate_with_architecture_annotation_metric(self):
"""
Test that a misconfiguration metric is reported when a golden
image lacks an architecture annotation on a multi-architecture cluster.

Preconditions:
- HCO CR is patched with a custom DataImportCronTemplate annotated without
architecture annotation.

Steps:
1. Query the metric.

Expected:
- Metric value is 0.
"""
Comment on lines +149 to +181
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 | 🟡 Minor | ⚡ Quick win

MEDIUM: Failure-scenario STD cases should include [NEGATIVE] in the description.

Both annotation-misconfiguration tests validate failure paths but the STD descriptions do not mark them as negative scenarios.

As per coding guidelines, tests verifying failure scenarios must include a [NEGATIVE] indicator in the description.

🤖 Prompt for 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.

In
`@tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_images_support.py`
around lines 151 - 182, The test docstrings for the failure-scenario tests
test_kubevirt_hco_dataimportcrontemplate_with_supported_architectures_metric and
test_kubevirt_hco_dataimportcrontemplate_with_architecture_annotation_metric do
not include the required "[NEGATIVE]" tag; update each test's triple-quoted
description to prepend or include "[NEGATIVE]" (e.g., "[NEGATIVE] Test that a
misconfiguration metric...") so the STD clearly marks these as negative/failure
scenario tests.