@@ -91,6 +91,7 @@ def test_positive_crud_ocpv_cr(module_ocpv_sat, module_org, module_location):
9191@pytest .mark .parametrize ('setting_update' , ['destroy_vm_on_host_delete=True' ], indirect = True )
9292def test_positive_userdata_image_provision_end_to_end (
9393 request ,
94+ session ,
9495 setting_update ,
9596 module_ocpv_cr ,
9697 module_ocpv_sat ,
@@ -113,10 +114,12 @@ def test_positive_userdata_image_provision_end_to_end(
113114
114115 :expectedresults: Host is provisioned successfully on OpenShift Virtualization
115116
117+ :Verifies: SAT-42060, SAT-41355
116118 """
117119 name = gen_string ('alpha' ).lower ()
118120 sat = module_ocpv_sat
119121 os = module_ocpv_image .os
122+ memory = '6442450944'
120123
121124 USERDATA_TEMPLATE = """\
122125 #cloud-config
@@ -159,7 +162,7 @@ def test_positive_userdata_image_provision_end_to_end(
159162 compute_attributes = {
160163 'cpus' : 1 ,
161164 'image_id' : module_ocpv_image .image .uuid ,
162- 'memory' : '6442450944' ,
165+ 'memory' : memory ,
163166 'start' : '1' ,
164167 'volumes_attributes' : {
165168 '0' : {
@@ -192,6 +195,38 @@ def test_positive_userdata_image_provision_end_to_end(
192195 assert host .name == f'{ name } .{ module_ocpv_hostgroup .domain .read ().name } '
193196 assert host .build_status_label == 'Installed'
194197
198+ # Verify VM state and power management via UI
199+ # After successful provisioning, validate that:
200+ cr = module_ocpv_sat .api .AbstractComputeResource (id = module_ocpv_cr .id ).read ()
201+ value = int (memory ) / (1024 ** 3 )
202+ with session :
203+ session .organization .select (org_name = module_org .name )
204+ session .location .select (loc_name = module_location .name )
205+ # The VM appears in the compute resource with correct power state (On)
206+ assert (
207+ session .computeresource .search_virtual_machine (cr .name , host .name )[0 ]['Power' ] == 'On'
208+ )
209+ # Power management actions work correctly (Power Off transitions the VM state)
210+ assert (
211+ session .computeresource .search_virtual_machine (cr .name , host .name )[0 ]['Actions' ]
212+ == 'Power Off'
213+ )
214+ # Memory allocation matches the configured value
215+ assert (
216+ session .computeresource .search_virtual_machine (cr .name , host .name )[0 ]['Memory' ]
217+ == f'{ value } GB'
218+ )
219+ # Test VM power management: power off the VM and verify the state changes accordingly
220+ # After power off, the VM should show 'Off' status and 'Power On' as the available action
221+ session .computeresource .vm_poweroff (cr .name , host .name )
222+ assert (
223+ session .computeresource .search_virtual_machine (cr .name , host .name )[0 ]['Power' ] == 'Off'
224+ )
225+ assert (
226+ session .computeresource .search_virtual_machine (cr .name , host .name )[0 ]['Actions' ]
227+ == 'Power On'
228+ )
229+
195230
196231@pytest .mark .parametrize ('name' , ** parametrized (valid_data_list ()))
197232def test_positive_create_with_name_description (
0 commit comments