How to use _create_image_with_custom_property method in tempest

Best Python code snippet using tempest_python

test_volume.py

Source:test_volume.py Github

copy

Full Screen

...30 @classmethod31 def setup_credentials(cls):32 cls.prepare_instance_network()33 super(BaseAttachSCSIVolumeTest, cls).setup_credentials()34 def _create_image_with_custom_property(self, **kwargs):35 """Wrapper utility that returns the custom image.36 Creates a new image by downloading the default image's bits and37 uploading them to a new image. Any kwargs are set as image properties38 on the new image.39 :param return image_id: The UUID of the newly created image.40 """41 image = self.admin_image_client.show_image(CONF.compute.image_ref)42 image_data = self.admin_image_client.show_image_file(43 CONF.compute.image_ref).data44 image_file = io.BytesIO(image_data)45 create_dict = {46 'container_format': image['container_format'],47 'disk_format': image['disk_format'],48 'min_disk': image['min_disk'],49 'min_ram': image['min_ram'],50 'visibility': 'public',51 }52 create_dict.update(kwargs)53 new_image = self.admin_image_client.create_image(**create_dict)54 self.addCleanup(self.admin_image_client.wait_for_resource_deletion,55 new_image['id'])56 self.addCleanup(self.admin_image_client.delete_image, new_image['id'])57 self.admin_image_client.store_image_file(new_image['id'], image_file)58 return new_image['id']59class AttachSCSIVolumeTestJSON(BaseAttachSCSIVolumeTest):60 """Test attaching scsi volume to server"""61 @decorators.idempotent_id('777e468f-17ca-4da4-b93d-b7dbf56c0494')62 def test_attach_scsi_disk_with_config_drive(self):63 """Test the attach/detach volume with config drive/scsi disk64 Enable the config drive, followed by booting an instance65 from an image with meta properties hw_cdrom: scsi and use66 virtio-scsi mode with further asserting list volume attachments67 in instance after attach and detach of the volume.68 """69 custom_img = self._create_image_with_custom_property(70 hw_scsi_model='virtio-scsi',71 hw_disk_bus='scsi',72 hw_cdrom_bus='scsi')73 validation_resources = self.get_test_validation_resources(74 self.os_primary)75 server = self.create_test_server(76 image_id=custom_img,77 config_drive=True,78 validatable=True,79 validation_resources=validation_resources,80 wait_until="SSHABLE")81 # NOTE(lyarwood): self.create_test_server delete the server82 # at class level cleanup so add server cleanup to ensure that83 # the instance is deleted first before created image. This...

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