From ab17ffa03bf4cef5f8775e7666287b988a8938c8 Mon Sep 17 00:00:00 2001 From: Harel Meir Date: Sun, 26 Apr 2026 13:56:26 +0300 Subject: [PATCH 1/2] IUO: Multiarch STD Signed-off-by: Harel Meir --- .../multiarch/__init__.py | 0 .../multiarch/test_multiarch_boot_sources.py | 64 ++++++++ .../test_multiarch_golden_image_metrics.py | 140 ++++++++++++++++++ 3 files changed, 204 insertions(+) create mode 100644 tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/__init__.py create mode 100644 tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_boot_sources.py create mode 100644 tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_image_metrics.py diff --git a/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/__init__.py b/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_boot_sources.py b/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_boot_sources.py new file mode 100644 index 0000000000..6213e55484 --- /dev/null +++ b/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_boot_sources.py @@ -0,0 +1,64 @@ +""" +Multi-Architecture Golden Image Boot Sources 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 + +Markers: + - multiarch + - post_upgrade +""" + +import pytest + +__test__ = False + + +class TestMultiarchBootSources: + """ + Tests for architecture-specific golden image boot sources availability + and correctness on a heterogeneous cluster. + + """ + + @pytest.mark.polarion("CNV-XXXXX") + def test_architecture_specific_boot_source_resources(self): + """ + Test that architecture-specific boot source resources are created + for each common boot source and each supported cluster architecture. + + Parametrize: + - resource_type: + - DataImportCron + - DataSource + + Steps: + 1. Get expected common boot sources from SSP CR common templates + 2. List resources of the parametrized type in the golden images + namespace + + Expected: + - Architecture-specific resources exist for each supported + architecture, correctly named, labeled, and in ready condition + """ + + @pytest.mark.polarion("CNV-XXXXX") + def test_pointer_datasources(self): + """ + Test that architecture-agnostic pointer DataSources are created with + the original boot source name and reference the default + architecture-specific DataSource. + + Steps: + 1. Get expected common boot sources from SSP CR common templates + 2. List DataSources in the golden images namespace + + Expected: + - Architecture-agnostic pointer DataSources exist with the + original name, referencing the control-plane architecture + DataSource, and in Ready condition + """ diff --git a/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_image_metrics.py b/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_image_metrics.py new file mode 100644 index 0000000000..f38bc8467e --- /dev/null +++ b/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_image_metrics.py @@ -0,0 +1,140 @@ +""" +Multi-Architecture Golden Image Metrics 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 + - Prometheus is installed and running + +Markers: + - multiarch + - post_upgrade +""" + +import pytest + +__test__ = False + + +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-XXXXX") + def test_kubevirt_hco_dataimportcrontemplate_with_supported_architectures(self): + """ + Test that a misconfiguration metric is reported when a golden + image is annotated with an architecture not supported by the cluster. + + Steps: + 1. Add a custom golden image boot source with + ssp.kubevirt.io/dict.architectures annotation set to an + architecture not supported by the cluster + 2. Wait for metric evaluation + + Expected: + - Metric should return 0. + """ + + @pytest.mark.polarion("CNV-XXXXX") + def test_kubevirt_hco_dataimportcrontemplate_with_architecture_annotation(self): + """ + Test that a misconfiguration metric is reported when a golden + image lacks an architecture annotation on a multi-architecture cluster. + + Steps: + 1. Add a custom golden image boot source without an + ssp.kubevirt.io/dict.architectures annotation + 2. Wait for metric evaluation + + Expected: + - Metric should return 0. + """ + + +@pytest.mark.incremental +class TestMultiarchDisabledGoldenImages: + """ + 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-XXXXX") + def test_base_boot_source_resources_without_architecture_suffix(self): + """ + Test that base boot source resources remain available after + disabling multi-architecture golden images support. + + Parametrize: + - resource_type: + - DataImportCron + - DataSource + + Steps: + 1. Get expected common boot sources from SSP CR common templates + 2. List resources of the parametrized type in the golden images + namespace + + Expected: + - Base resources exist with original names (no architecture + suffix) and in ready condition + """ + + @pytest.mark.polarion("CNV-XXXXX") + def test_no_architecture_specific_resources(self): + """ + Test that architecture-specific boot source resources are removed + after disabling multi-architecture golden images support. + + Steps: + 1. List DataImportCrons and DataSources in the golden images + namespace + + Expected: + - No resources exist with architecture suffix + """ + + @pytest.mark.polarion("CNV-XXXXX") + def test_kubevirt_hco_multi_arch_boot_images_enabled(self): + """ + Test that the disabled multi-architecture misconfiguration metric + is active when multi-arch golden images support is disabled on a + heterogeneous cluster. + + Steps: + 1. Query the multi-architecture misconfiguration metric + + Expected: + - Misconfiguration metric value indicates multi-architecture + golden images support is disabled on a multi-architecture + cluster + """ + + @pytest.mark.polarion("CNV-XXXXX") + def test_kubevirt_hco_multi_arch_boot_images_enabled_netgative(self): + """ + Test that the misconfiguration metric clears when + nodePlacement restricts workloads to a single architecture. + + Preconditions: + - Misconfiguration metric is currently active + + Steps: + 1. Configure nodePlacement to restrict workloads to a single + architecture + 2. Wait for metric evaluation + + Expected: + - Misconfiguration metric is no longer active + """ From 62abdfd5bcb148c2ca8b549cc7f865c9da9665f2 Mon Sep 17 00:00:00 2001 From: Harel Meir Date: Mon, 11 May 2026 14:26:08 +0300 Subject: [PATCH 2/2] Edit into single file Signed-off-by: Harel Meir --- .../multiarch/test_multiarch_boot_sources.py | 64 ------- .../test_multiarch_golden_image_metrics.py | 140 -------------- .../test_multiarch_golden_images_support.py | 181 ++++++++++++++++++ 3 files changed, 181 insertions(+), 204 deletions(-) delete mode 100644 tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_boot_sources.py delete mode 100644 tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_image_metrics.py create mode 100644 tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_images_support.py diff --git a/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_boot_sources.py b/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_boot_sources.py deleted file mode 100644 index 6213e55484..0000000000 --- a/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_boot_sources.py +++ /dev/null @@ -1,64 +0,0 @@ -""" -Multi-Architecture Golden Image Boot Sources 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 - -Markers: - - multiarch - - post_upgrade -""" - -import pytest - -__test__ = False - - -class TestMultiarchBootSources: - """ - Tests for architecture-specific golden image boot sources availability - and correctness on a heterogeneous cluster. - - """ - - @pytest.mark.polarion("CNV-XXXXX") - def test_architecture_specific_boot_source_resources(self): - """ - Test that architecture-specific boot source resources are created - for each common boot source and each supported cluster architecture. - - Parametrize: - - resource_type: - - DataImportCron - - DataSource - - Steps: - 1. Get expected common boot sources from SSP CR common templates - 2. List resources of the parametrized type in the golden images - namespace - - Expected: - - Architecture-specific resources exist for each supported - architecture, correctly named, labeled, and in ready condition - """ - - @pytest.mark.polarion("CNV-XXXXX") - def test_pointer_datasources(self): - """ - Test that architecture-agnostic pointer DataSources are created with - the original boot source name and reference the default - architecture-specific DataSource. - - Steps: - 1. Get expected common boot sources from SSP CR common templates - 2. List DataSources in the golden images namespace - - Expected: - - Architecture-agnostic pointer DataSources exist with the - original name, referencing the control-plane architecture - DataSource, and in Ready condition - """ diff --git a/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_image_metrics.py b/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_image_metrics.py deleted file mode 100644 index f38bc8467e..0000000000 --- a/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_image_metrics.py +++ /dev/null @@ -1,140 +0,0 @@ -""" -Multi-Architecture Golden Image Metrics 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 - - Prometheus is installed and running - -Markers: - - multiarch - - post_upgrade -""" - -import pytest - -__test__ = False - - -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-XXXXX") - def test_kubevirt_hco_dataimportcrontemplate_with_supported_architectures(self): - """ - Test that a misconfiguration metric is reported when a golden - image is annotated with an architecture not supported by the cluster. - - Steps: - 1. Add a custom golden image boot source with - ssp.kubevirt.io/dict.architectures annotation set to an - architecture not supported by the cluster - 2. Wait for metric evaluation - - Expected: - - Metric should return 0. - """ - - @pytest.mark.polarion("CNV-XXXXX") - def test_kubevirt_hco_dataimportcrontemplate_with_architecture_annotation(self): - """ - Test that a misconfiguration metric is reported when a golden - image lacks an architecture annotation on a multi-architecture cluster. - - Steps: - 1. Add a custom golden image boot source without an - ssp.kubevirt.io/dict.architectures annotation - 2. Wait for metric evaluation - - Expected: - - Metric should return 0. - """ - - -@pytest.mark.incremental -class TestMultiarchDisabledGoldenImages: - """ - 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-XXXXX") - def test_base_boot_source_resources_without_architecture_suffix(self): - """ - Test that base boot source resources remain available after - disabling multi-architecture golden images support. - - Parametrize: - - resource_type: - - DataImportCron - - DataSource - - Steps: - 1. Get expected common boot sources from SSP CR common templates - 2. List resources of the parametrized type in the golden images - namespace - - Expected: - - Base resources exist with original names (no architecture - suffix) and in ready condition - """ - - @pytest.mark.polarion("CNV-XXXXX") - def test_no_architecture_specific_resources(self): - """ - Test that architecture-specific boot source resources are removed - after disabling multi-architecture golden images support. - - Steps: - 1. List DataImportCrons and DataSources in the golden images - namespace - - Expected: - - No resources exist with architecture suffix - """ - - @pytest.mark.polarion("CNV-XXXXX") - def test_kubevirt_hco_multi_arch_boot_images_enabled(self): - """ - Test that the disabled multi-architecture misconfiguration metric - is active when multi-arch golden images support is disabled on a - heterogeneous cluster. - - Steps: - 1. Query the multi-architecture misconfiguration metric - - Expected: - - Misconfiguration metric value indicates multi-architecture - golden images support is disabled on a multi-architecture - cluster - """ - - @pytest.mark.polarion("CNV-XXXXX") - def test_kubevirt_hco_multi_arch_boot_images_enabled_netgative(self): - """ - Test that the misconfiguration metric clears when - nodePlacement restricts workloads to a single architecture. - - Preconditions: - - Misconfiguration metric is currently active - - Steps: - 1. Configure nodePlacement to restrict workloads to a single - architecture - 2. Wait for metric evaluation - - Expected: - - Misconfiguration metric is no longer active - """ diff --git a/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_images_support.py b/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_images_support.py new file mode 100644 index 0000000000..a57008b2e7 --- /dev/null +++ b/tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_images_support.py @@ -0,0 +1,181 @@ +""" +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 + +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. + """ + + @pytest.mark.polarion("CNV-15980") + def test_kubevirt_hco_multi_arch_boot_images_enabled_metric_single_arch_node_placement(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): + """ + [NEGATIVE] 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): + """ + [NEGATIVE] 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. + """