@@ -49,12 +49,30 @@ def setup_content_for_iop(module_target_sat_insights, rhcloud_manifest_org):
4949 assert satellite .execute ('systemctl start iop-service-vuln-vmaas-sync' ).status == 0
5050
5151
52+ @pytest .fixture
53+ def vulnerable_rhel_host (rhel_insights_vm ):
54+ """Fixture to prepare a RHEL host with a vulnerable package"""
55+ GLIBC_RPM = 'glibc-2.39-43.el10_0.x86_64'
56+ client = rhel_insights_vm
57+ # Remove any static repos and update to the latest packages available from the Satellite
58+ assert (
59+ client .execute (
60+ "find /etc/yum.repos.d/ -type f | grep -vF redhat.repo | xargs -I '{}' rm '{}'"
61+ ).status
62+ == 0
63+ )
64+ assert client .execute ('dnf -y update' ).status == 0
65+ # Downgrade to vulnerable glibc version
66+ assert client .execute (f'dnf downgrade -y { GLIBC_RPM } ' ).status == 0
67+ return client
68+
69+
5270@pytest .mark .e2e
5371@pytest .mark .no_containers
5472@pytest .mark .rhel_ver_list ([10 ])
5573@pytest .mark .parametrize ('module_target_sat_insights' , [False ], ids = ['local' ], indirect = True )
5674def test_rhcloud_insights_vulnerabilities_e2e (
57- rhel_insights_vm ,
75+ vulnerable_rhel_host ,
5876 rhcloud_manifest_org ,
5977 module_target_sat_insights ,
6078 setup_content_for_iop ,
@@ -79,24 +97,11 @@ def test_rhcloud_insights_vulnerabilities_e2e(
7997 :verifies: SAT-30762
8098 """
8199 CVE_ID = 'CVE-2025-8058'
82- GLIBC_RPM = 'glibc-2.39-43.el10_0.x86_64'
83100
84101 satellite = module_target_sat_insights
85- client = rhel_insights_vm
102+ client = vulnerable_rhel_host
86103 hostname = client .hostname
87104
88- # Remove any static repos and update to the latest packages available from the Satellite
89- assert (
90- client .execute (
91- "find /etc/yum.repos.d/ -type f | grep -vF redhat.repo | xargs -I '{}' rm '{}'"
92- ).status
93- == 0
94- )
95- assert client .execute ('dnf -y update' ).status == 0
96-
97- # Downgrade to vulnerable glibc version
98- assert client .execute (f'dnf downgrade -y { GLIBC_RPM } ' ).status == 0
99-
100105 with satellite .ui_session () as session :
101106 session .organization .select (org_name = rhcloud_manifest_org .name )
102107
@@ -115,3 +120,69 @@ def test_rhcloud_insights_vulnerabilities_e2e(
115120 CVE_ID , hostname
116121 )
117122 assert any (vuln .get ('CVE ID' ) == CVE_ID for vuln in vulnerabilities )
123+
124+
125+ @pytest .mark .e2e
126+ @pytest .mark .no_containers
127+ @pytest .mark .rhel_ver_list ([9 , 10 ])
128+ @pytest .mark .parametrize ('module_target_sat_insights' , [False ], ids = ['local' ], indirect = True )
129+ def test_positive_bulk_disable_vulnerability_analysis (
130+ vulnerable_rhel_host ,
131+ rhcloud_manifest_org ,
132+ module_target_sat_insights ,
133+ setup_content_for_iop ,
134+ ):
135+ """Test disabling vulnerability analysis for a host via kebab menu on All Hosts page
136+
137+ :id: 4e7ba195-235d-4f4e-86d0-2ab9b2db4bf0
138+
139+ :steps:
140+ 1. Navigate to All Hosts page
141+ 2. Add "Total CVEs" column from Red Hat Lightspeed section
142+ 3. Search for the registered insights RHEL host
143+ 4. Verify the Total CVEs value is greater than 1
144+ 5. Use bulk action to select all hosts and disable vulnerability analysis
145+ 6. Verify the Total CVEs column now shows "Analysis disabled"
146+
147+ :expectedresults:
148+ 1. Total CVEs column is successfully added and displayed
149+ 2. Host shows CVE count greater than 1 initially
150+ 3. After bulk disable action, Total CVEs column shows "Analysis disabled"
151+
152+ :Verifies: SAT-40203
153+ """
154+ satellite = module_target_sat_insights
155+ client = vulnerable_rhel_host
156+ hostname = client .hostname
157+
158+ with satellite .ui_session () as session :
159+ # Select the correct organization
160+ session .organization .select (org_name = rhcloud_manifest_org .name )
161+ session .all_hosts .get_displayed_table_headers ()
162+ session .all_hosts .manage_table_columns ({'Total CVEs' : True })
163+
164+ # Verify the column is displayed
165+ displayed_columns = session .all_hosts .get_displayed_table_headers ()
166+ assert 'Total CVEs' in displayed_columns , (
167+ f"Total CVEs column not found. Available columns: { displayed_columns } "
168+ )
169+
170+ # Search for the registered host and total cves
171+ table_data = session .all_hosts .search (hostname )
172+ assert len (table_data ) > 0 , f"Host { hostname } not found after search"
173+ assert int (table_data [0 ]['Total CVEs' ]) > 1
174+ host_row = table_data [0 ]
175+ assert hostname in table_data [0 ]['Name' ], (
176+ f"Expected host { hostname } , but got { host_row ['Name' ]} "
177+ )
178+
179+ # Use bulk action to disable vulnerability analysis for all hosts
180+ session .all_hosts .manage_vulnerability_analysis ('Disable' )
181+
182+ # Search for the host again and verify status changed to "Analysis disabled"
183+ table_data = session .all_hosts .search (hostname )
184+ assert len (table_data ) > 0 , f"Host { hostname } not found after search"
185+ assert table_data [0 ]['Total CVEs' ] == 'Analysis disabled' , (
186+ f"Expected 'Analysis disabled' but got '{ table_data [0 ]['Total CVEs' ]} '"
187+ )
188+
0 commit comments