Skip to content

Commit a6b8e4b

Browse files
rlobilloclaude
andauthored
[IUO]Remove obsolete installation overhead tests and utilities (#3752)
##### Short description: Remove the following tests that caused excessive false failures due to their brittle design based on resource comparison before/after installation: - test_cnv_resources_installed_cluster_scoped: Compared cluster-scoped resources before/after CNV installation. This test was unreliable because cluster resources change dynamically from other operators. - test_cnv_resources_installed_namespace_scoped: Compared namespaced resources before/after CNV installation. This test repeatedly failed due to ephemeral resources (Pods, ReplicaSets, PodMetrics, Jobs) created by the cluster that were not expected. The allowlist approach could never account for all dynamic resource variations across different cluster configurations. - test_install_hpp: Validated HostPathProvisioner installation. This functionality is better validated through other mechanisms. ##### More details: Also removed: - validate_hpp_installation() utility function (only used by test_install_hpp) - get_all_resources() utility function and related constants (only used by the removed tests) - Resource comparison allowlists that were specific to these tests - Unused fixtures: installation_data_dir, before_installation_all_resources, after_installation_all_resources, installed_hpp The remaining tests (test_cnv_installation, test_cnv_installation_alert_cleanup, test_cnv_installation_without_hco_cr_alert, test_cnv_installation_without_hco_cr_metrics, test_default_storage_class_set) provide sufficient coverage for CNV installation validation without the brittleness of resource comparison tests. ##### What this PR does / why we need it: Stabalize CI ##### Which issue(s) this PR fixes: N/A ##### Special notes for reviewer: N/A ##### jira-ticket: https://issues.redhat.com/browse/CNV-75791 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Removed resource validation test cases for cluster- and namespace-scoped installations. * Eliminated deprecated test configuration and large ignore/allowlist data previously used by tests. * Simplified test infrastructure by removing unused fixtures and utility utilities. * Cleaned up obsolete test scenarios and dependencies to streamline and speed up test runs. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent a945538 commit a6b8e4b

File tree

4 files changed

+0
-359
lines changed

4 files changed

+0
-359
lines changed

tests/install_upgrade_operators/product_install/conftest.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import logging
2-
import os
32

43
import bitmath
54
import pytest
@@ -16,7 +15,6 @@
1615
HCO_NOT_INSTALLED_ALERT,
1716
OPENSHIFT_VIRTUALIZATION,
1817
)
19-
from tests.install_upgrade_operators.product_install.utils import get_all_resources
2018
from utilities.constants import (
2119
BREW_REGISTERY_SOURCE,
2220
CRITICAL_STR,
@@ -32,9 +30,6 @@
3230
TIMEOUT_10MIN,
3331
StorageClassNames,
3432
)
35-
from utilities.data_collector import (
36-
get_data_collector_base_directory,
37-
)
3833
from utilities.infra import (
3934
create_ns,
4035
get_cluster_platform,
@@ -69,21 +64,6 @@
6964
LOGGER = logging.getLogger(__name__)
7065

7166

72-
@pytest.fixture(scope="session")
73-
def installation_data_dir():
74-
return os.path.join(get_data_collector_base_directory(), "resource_information")
75-
76-
77-
@pytest.fixture(scope="session")
78-
def before_installation_all_resources(installation_data_dir):
79-
return get_all_resources(file_name="before_installation", base_directory=installation_data_dir)
80-
81-
82-
@pytest.fixture(scope="module")
83-
def after_installation_all_resources(installation_data_dir):
84-
return get_all_resources(file_name="after_installation", base_directory=installation_data_dir)
85-
86-
8767
@pytest.fixture(scope="module")
8868
def hyperconverged_directory(tmpdir_factory, is_production_source):
8969
if is_production_source:
Lines changed: 0 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -1,189 +1,2 @@
1-
from utilities.constants import WIN_2K22, WIN_2K25, WIN_10, WIN_11
2-
3-
IGNORE_KIND = [
4-
"StorageProfile",
5-
"ConsoleCLIDownload",
6-
"ImageContentSourcePolicy",
7-
"VirtualMachineClusterInstancetype",
8-
"VirtualMachineClusterPreference",
9-
"Event",
10-
]
11-
IGNORE_NAMESPACE = [
12-
"openshift-marketplace",
13-
"openshift-cnv",
14-
"openshift-operator-lifecycle-manager",
15-
"openshift-virtualization-os-images",
16-
]
17-
CLUSTER_RESOURCE_ALLOWLIST = {
18-
"ClusterRole": [
19-
"openshift-cnv-group-view",
20-
"prometheus-k8s-ssp",
21-
"cdi-cronjob",
22-
"bridge-marker-cr",
23-
"kubevirt-hyperconverged-operator",
24-
"cdi-uploadproxy",
25-
"cdi-apiserver",
26-
"kubemacpool-manager-role",
27-
"kubevirt-controller",
28-
"kubevirt-hyperconverged-operator",
29-
"kubevirt-handler",
30-
"openshift-cnv-group-edit",
31-
"openshift-cnv-group-admin",
32-
"cdi",
33-
"kubevirt-exportproxy",
34-
"kubevirt-apiserver",
35-
"template:view",
36-
"kubevirt-hyperconverged-",
37-
"olm.og.openshift-cnv-",
38-
"kubevirt-ipam-controller-manager-role",
39-
"kubevirt-synchronization-controller",
40-
"kubevirt-migration-controller",
41-
],
42-
"ClusterRoleBinding": [
43-
"hostpath-provisioner-operator-service-system:auth-delegator",
44-
"prometheus-k8s-ssp",
45-
"cdi-cronjob",
46-
"kubemacpool-manager-rolebinding",
47-
"cdi-sa",
48-
"kubevirt-hyperconverged-operator",
49-
"bridge-marker-crb",
50-
"ssp-operator-service-system:auth-delegator",
51-
"cdi-uploadproxy",
52-
"cdi-apiserver",
53-
"hco-webhook-service-system:auth-delegator",
54-
"kubevirt-controller",
55-
"kubevirt-apiserver-auth-delegator",
56-
"kubevirt-handler",
57-
"kubevirt-exportproxy",
58-
"kubevirt-apiserver",
59-
"template-validator",
60-
"kubevirt-hyperconverged-",
61-
"olm.og.openshift-cnv-kubevirt-ipam-controller-manager-rolebinding",
62-
"kubevirt-synchronization-controller",
63-
"kubevirt-ipam-controller-manager-rolebinding",
64-
"kubevirt-migration-sa",
65-
],
66-
"Namespace": ["openshift-cnv", "openshift-virtualization-os-images"],
67-
"Project": ["openshift-cnv", "openshift-virtualization-os-images"],
68-
"ConsoleQuickStart": ["creating-virtual-machine", "upload-boot-source", "windows-bootsource-pipeline"],
69-
"MachineConfig": ["rendered-worker", "rendered-master"],
70-
"ValidatingWebhookConfiguration": [
71-
"cdi-api-dataimportcron-validate",
72-
"virt-template-validator",
73-
"cdi-api-datavolume-validate",
74-
"cdi-api-validate",
75-
"virt-api-validator",
76-
"virt-operator-validator",
77-
"objecttransfer-api-validate",
78-
"cdi-api-populator-validate",
79-
],
80-
"Operator": ["kubevirt-hyperconverged.openshift-cnv"],
81-
"MutatingWebhookConfiguration": [
82-
"virt-api-mutator",
83-
"kubemacpool-mutator",
84-
"cdi-api-datavolume-mutate",
85-
"cdi-api-pvc-mutate",
86-
"kubevirt-ipam-controller-mutating-webhook-configuration",
87-
],
88-
"SecurityContextConstraints": [
89-
"linux-bridge",
90-
"containerized-data-importer",
91-
"kubevirt-controller",
92-
"bridge-marker",
93-
"kubevirt-handler",
94-
],
95-
"NetworkAddonsConfig": ["cluster"],
96-
"ConsoleCLIDownload": ["virtctl-clidownloads-kubevirt-hyperconverged"],
97-
"PriorityClass": ["kubevirt-cluster-critical"],
98-
"ConsolePlugin": ["kubevirt-plugin"],
99-
"CDI": ["cdi-kubevirt-hyperconverged"],
100-
"CDIConfig": ["config"],
101-
}
102-
NAMESPACED_IGNORE_KINDS = ["Event", "Template"]
103-
NAMESPACED_RESOURCE_ALLOWLIST = {
104-
"openshift-kube-apiserver": {
105-
"Pod": ["installer-", "revision-pruner-"],
106-
"PodMetrics": ["installer-", "revision-pruner-"],
107-
},
108-
"openshift-monitoring": {
109-
"Pod": ["metrics-server", "prometheus-k8s", "alertmanager-main"],
110-
"PodMetrics": ["metrics-server", "prometheus-k8s", "alertmanager-main"],
111-
},
112-
"kube-system": {
113-
"RoleBinding": [
114-
"hostpath-provisioner-operator-service-auth-reader",
115-
"hco-webhook-service-auth-reader",
116-
"ssp-operator-service-auth-reader",
117-
]
118-
},
119-
"openshift-config-managed": {"ConfigMap": ["grafana-dashboard-kubevirt-top-consumers"]},
120-
"openshift-storage": {
121-
"Pod": ["csi-addons", "storageclient"],
122-
"EndpointSlice": ["csi-addons"],
123-
"PodMetrics": ["csi-addons"],
124-
"ReplicaSet": ["csi-addons"],
125-
"Job": ["storageclient"],
126-
},
127-
"openshift-console": {
128-
"ReplicaSet": ["console"],
129-
"Pod": ["console"],
130-
"PodMetrics": ["console"],
131-
},
132-
"openshift-virtualization-os-images": {
133-
"ServiceAccount": ["builder", "default", "deployer"],
134-
"RoleBinding": [
135-
"system:image-builders",
136-
"system:image-pullers",
137-
"system:deployers",
138-
],
139-
"ConfigMap": ["openshift-service-ca.crt", "kube-root-ca.crt"],
140-
"Role": ["os-images.kubevirt.io:view"],
141-
"DataImportCron": [
142-
"centos-stream10-image-cron",
143-
"centos-stream9-image-cron",
144-
"rhel9-image-cron",
145-
"rhel10-image-cron",
146-
"rhel8-image-cron",
147-
"fedora-image-cron",
148-
],
149-
"ImageTag": ["rhel8-guest:latest", "rhel9-guest:latest"],
150-
"ImageStreamTag": ["rhel8-guest:latest", "rhel9-guest:latest"],
151-
"DataSource": [
152-
"centos-stream10",
153-
"centos-stream8",
154-
"centos-stream9",
155-
"centos7",
156-
"fedora",
157-
"rhel10",
158-
"rhel9",
159-
"rhel8",
160-
"rhel7",
161-
WIN_10,
162-
WIN_11,
163-
"win2k16",
164-
"win2k19",
165-
WIN_2K22,
166-
WIN_2K25,
167-
],
168-
"ImageStream": ["rhel9-guest", "rhel8-guest"],
169-
"Secret": [
170-
"builder-token",
171-
"deployer-token",
172-
"default-dockercfg",
173-
"builder-dockercfg",
174-
"default-token",
175-
"deployer-dockercfg",
176-
],
177-
"ClusterServiceVersion": ["openshift-pipelines-operator"],
178-
"DataVolume": [
179-
"rhel8",
180-
"rhel9",
181-
"rhel10",
182-
"fedora",
183-
"centos-stream9",
184-
"centos-stream10",
185-
],
186-
},
187-
}
1881
OPENSHIFT_VIRTUALIZATION = "openshift-virtualization"
1892
HCO_NOT_INSTALLED_ALERT = "HCOInstallationIncomplete"

tests/install_upgrade_operators/product_install/test_install_openshift_virtualization.py

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
import pytest
44

55
from tests.install_upgrade_operators.product_install.constants import (
6-
CLUSTER_RESOURCE_ALLOWLIST,
76
HCO_NOT_INSTALLED_ALERT,
8-
IGNORE_KIND,
9-
IGNORE_NAMESPACE,
10-
NAMESPACED_IGNORE_KINDS,
11-
NAMESPACED_RESOURCE_ALLOWLIST,
127
)
138
from tests.install_upgrade_operators.product_install.utils import (
149
validate_hpp_installation,
@@ -18,7 +13,6 @@
1813
PENDING_STR,
1914
TIMEOUT_10MIN,
2015
)
21-
from utilities.exceptions import ResourceMismatch
2216
from utilities.hco import wait_for_hco_conditions
2317
from utilities.infra import wait_for_pods_running
2418
from utilities.monitoring import (
@@ -42,7 +36,6 @@
4236
def test_cnv_installation_without_hco_cr_alert(
4337
prometheus,
4438
cnv_version_to_install_info,
45-
before_installation_all_resources,
4639
installed_openshift_virtualization,
4740
alert_dictionary_hco_not_installed,
4841
):
@@ -85,96 +78,6 @@ def test_cnv_installation_alert_cleanup(prometheus):
8578
wait_for_firing_alert_clean_up(prometheus=prometheus, alert_name=HCO_NOT_INSTALLED_ALERT)
8679

8780

88-
# TODO: check if this test is still required
89-
@pytest.mark.polarion("CNV-10076")
90-
@pytest.mark.order(after=CNV_ALERT_CLEANUP_TEST)
91-
@pytest.mark.dependency(
92-
name="test_cnv_resources_installed_cluster_scoped",
93-
depends=[CNV_INSTALLATION_TEST],
94-
)
95-
def test_cnv_resources_installed_cluster_scoped(
96-
before_installation_all_resources,
97-
after_installation_all_resources,
98-
):
99-
mismatch_cluster_scoped = []
100-
for kind in after_installation_all_resources["cluster-scoped"]:
101-
if kind in IGNORE_KIND:
102-
continue
103-
104-
diff_values = [
105-
value
106-
for value in list(
107-
set(after_installation_all_resources["cluster-scoped"][kind])
108-
- (set(before_installation_all_resources["cluster-scoped"].get(kind, [])))
109-
)
110-
if "kubevirt.io" not in value
111-
]
112-
allowlisted_values = CLUSTER_RESOURCE_ALLOWLIST.get(kind, [])
113-
if allowlisted_values and diff_values:
114-
LOGGER.info(f"Expected allowlisted values for kind: {kind}: {allowlisted_values}")
115-
LOGGER.warning(
116-
f"Current difference in resources between before and after installation of cnv: {diff_values}"
117-
)
118-
diff_values = [value for value in diff_values if not value.startswith(tuple(allowlisted_values))]
119-
if diff_values:
120-
LOGGER.warning(f"After removing allowlisted resources, the diff is: {diff_values}")
121-
mismatch_cluster_scoped.append({kind: diff_values})
122-
if mismatch_cluster_scoped:
123-
LOGGER.error(f"Mismatched cluster resources: {mismatch_cluster_scoped}")
124-
raise ResourceMismatch(f"Unexpected cluster resources found post cnv installation: {mismatch_cluster_scoped}")
125-
126-
127-
# TODO: check if this test is still required
128-
@pytest.mark.order(after=CNV_ALERT_CLEANUP_TEST)
129-
@pytest.mark.dependency(
130-
depends=[CNV_INSTALLATION_TEST],
131-
)
132-
@pytest.mark.polarion("CNV-10075")
133-
def test_cnv_resources_installed_namespace_scoped(
134-
before_installation_all_resources,
135-
after_installation_all_resources,
136-
):
137-
namespaced_resource_before = before_installation_all_resources["namespaced"]
138-
namespaced_resource_after = after_installation_all_resources["namespaced"]
139-
mismatch_namespaced = {}
140-
for namespace in namespaced_resource_after:
141-
if namespace in IGNORE_NAMESPACE:
142-
continue
143-
LOGGER.info(f"Checking resources in {namespace}")
144-
mismatch_namespaced[namespace] = {}
145-
allowlisted_kinds = NAMESPACED_RESOURCE_ALLOWLIST.get(namespace, [])
146-
147-
for kind in after_installation_all_resources["namespaced"][namespace]:
148-
if kind in NAMESPACED_IGNORE_KINDS:
149-
continue
150-
allowlisted_values = []
151-
if allowlisted_kinds:
152-
LOGGER.info(f"Currently allowlisted resources: {allowlisted_kinds}")
153-
allowlisted_values = allowlisted_kinds.get(kind, [])
154-
diff_value_ns = [
155-
value
156-
for value in list(
157-
set(namespaced_resource_after[namespace].get(kind, []))
158-
- (set(namespaced_resource_before.get(namespace, {}).get(kind, [])))
159-
)
160-
if "kubevirt.io" not in value
161-
]
162-
163-
if allowlisted_values and diff_value_ns:
164-
LOGGER.warning(
165-
f"For namespace: {namespace}, kind: {kind} difference in before and after installation "
166-
f"resource(s): {diff_value_ns}"
167-
)
168-
diff_value_ns = [value for value in diff_value_ns if not value.startswith(tuple(allowlisted_values))]
169-
if diff_value_ns:
170-
LOGGER.warning(f"After removing allowlisted elements from the difference, mismatch is: {diff_value_ns}")
171-
mismatch_namespaced[namespace][kind] = diff_value_ns
172-
mismatch_namespaced = {key: value for key, value in mismatch_namespaced.items() if value}
173-
if mismatch_namespaced:
174-
LOGGER.error(f"Mismatched namespaced resources: {mismatch_namespaced}")
175-
raise ResourceMismatch(f"Unexpected namespaced resources found post cnv installation: {mismatch_namespaced}")
176-
177-
17881
@pytest.mark.polarion("CNV-12453")
17982
@pytest.mark.order(after=CNV_INSTALLATION_TEST)
18083
# Dependency: CNV must be installed before storage class configuration can be verified

0 commit comments

Comments
 (0)