How to use _create_server_and_rescue_image method in tempest

Best Python code snippet using tempest_python

test_server_rescue.py

Source:test_server_rescue.py Github

copy

Full Screen

...93 raise cls.skipException(msg)94 if not CONF.compute_feature_enabled.stable_rescue:95 msg = "Stable rescue not available."96 raise cls.skipException(msg)97 def _create_server_and_rescue_image(self, hw_rescue_device=None,98 hw_rescue_bus=None,99 block_device_mapping_v2=None):100 if block_device_mapping_v2:101 server_id = self.create_test_server(102 wait_until='ACTIVE',103 block_device_mapping_v2=block_device_mapping_v2)['id']104 else:105 server_id = self.create_test_server(wait_until='ACTIVE')['id']106 image_id = self.create_image_from_server(server_id,107 wait_until='ACTIVE')['id']108 if hw_rescue_bus:109 self.images_client.update_image(110 image_id, [dict(add='/hw_rescue_bus',111 value=hw_rescue_bus)])112 if hw_rescue_device:113 self.images_client.update_image(114 image_id, [dict(add='/hw_rescue_device',115 value=hw_rescue_device)])116 return server_id, image_id117 def _test_stable_device_rescue(self, server_id, rescue_image_id):118 self.servers_client.rescue_server(119 server_id, rescue_image_ref=rescue_image_id)120 waiters.wait_for_server_status(121 self.servers_client, server_id, 'RESCUE')122 self.servers_client.unrescue_server(server_id)123 waiters.wait_for_server_status(124 self.servers_client, server_id, 'ACTIVE')125class ServerStableDeviceRescueTest(BaseServerStableDeviceRescueTest):126 @decorators.idempotent_id('947004c3-e8ef-47d9-9f00-97b74f9eaf96')127 def test_stable_device_rescue_cdrom_ide(self):128 server_id, rescue_image_id = self._create_server_and_rescue_image(129 hw_rescue_device='cdrom', hw_rescue_bus='ide')130 self._test_stable_device_rescue(server_id, rescue_image_id)131 @decorators.idempotent_id('16865750-1417-4854-bcf7-496e6753c01e')132 def test_stable_device_rescue_disk_virtio(self):133 server_id, rescue_image_id = self._create_server_and_rescue_image(134 hw_rescue_device='disk', hw_rescue_bus='virtio')135 self._test_stable_device_rescue(server_id, rescue_image_id)136 @decorators.idempotent_id('12340157-6306-4745-bdda-cfa019908b48')137 def test_stable_device_rescue_disk_scsi(self):138 server_id, rescue_image_id = self._create_server_and_rescue_image(139 hw_rescue_device='disk', hw_rescue_bus='scsi')140 self._test_stable_device_rescue(server_id, rescue_image_id)141 @decorators.idempotent_id('647d04cf-ad35-4956-89ab-b05c5c16f30c')142 def test_stable_device_rescue_disk_usb(self):143 server_id, rescue_image_id = self._create_server_and_rescue_image(144 hw_rescue_device='disk', hw_rescue_bus='usb')145 self._test_stable_device_rescue(server_id, rescue_image_id)146 @decorators.idempotent_id('a3772b42-00bf-4310-a90b-1cc6fd3e7eab')147 def test_stable_device_rescue_disk_virtio_with_volume_attached(self):148 server_id, rescue_image_id = self._create_server_and_rescue_image(149 hw_rescue_device='disk', hw_rescue_bus='virtio')150 server = self.servers_client.show_server(server_id)['server']151 volume = self.create_volume()152 self.attach_volume(server, volume)153 waiters.wait_for_volume_resource_status(self.volumes_client,154 volume['id'], 'in-use')155 self._test_stable_device_rescue(server_id, rescue_image_id)156class ServerBootFromVolumeStableRescueTest(BaseServerStableDeviceRescueTest):157 min_microversion = '2.87'158 @decorators.idempotent_id('48f123cb-922a-4065-8db6-b9a9074a556b')159 def test_stable_device_rescue_bfv_blank_volume(self):160 block_device_mapping_v2 = [{161 "boot_index": "0",162 "source_type": "blank",163 "volume_size": CONF.volume.volume_size,164 "destination_type": "volume"}]165 server_id, rescue_image_id = self._create_server_and_rescue_image(166 hw_rescue_device='disk', hw_rescue_bus='virtio',167 block_device_mapping_v2=block_device_mapping_v2)168 self._test_stable_device_rescue(server_id, rescue_image_id)169 @decorators.idempotent_id('e4636333-c928-40fc-98b7-70a23eef4224')170 def test_stable_device_rescue_bfv_image_volume(self):171 block_device_mapping_v2 = [{172 "boot_index": "0",173 "source_type": "image",174 "volume_size": CONF.volume.volume_size,175 "uuid": CONF.compute.image_ref,176 "destination_type": "volume"}]177 server_id, rescue_image_id = self._create_server_and_rescue_image(178 hw_rescue_device='disk', hw_rescue_bus='virtio',179 block_device_mapping_v2=block_device_mapping_v2)180 self._test_stable_device_rescue(server_id, rescue_image_id)181 @decorators.idempotent_id('7fcc5d2c-130e-4750-95f5-7343f9d0a2f3')182 def test_stable_device_rescue_bfv_snapshot_volume(self):183 volume_id = self.create_volume()['id']184 self.volumes_client.set_bootable_volume(volume_id, bootable=True)185 snapshot_id = self.create_volume_snapshot(volume_id)['id']186 block_device_mapping_v2 = [{187 "boot_index": "0",188 "source_type": "snapshot",189 "volume_size": CONF.volume.volume_size,190 "uuid": snapshot_id,191 "destination_type": "volume"}]192 server_id, rescue_image_id = self._create_server_and_rescue_image(193 hw_rescue_device='disk', hw_rescue_bus='virtio',194 block_device_mapping_v2=block_device_mapping_v2)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful