How to use _create_and_stage_image method in tempest

Best Python code snippet using tempest_python

test_images.py

Source:test_images.py Github

copy

Full Screen

...175 'Either glance-direct import method not present in %s or '176 'None or only one store is '177 'configured %s' % (cls.available_import_methods,178 cls.available_stores))179 def _create_and_stage_image(self, all_stores=False):180 """Create Image & stage image file for glance-direct import method."""181 image_name = data_utils.rand_name('test-image')182 container_format = CONF.image.container_formats[0]183 disk_format = CONF.image.disk_formats[0]184 image = self.create_image(name=image_name,185 container_format=container_format,186 disk_format=disk_format,187 visibility='private')188 self.assertEqual('queued', image['status'])189 self.client.stage_image_file(190 image['id'],191 io.BytesIO(data_utils.random_bytes()))192 # Check image status is 'uploading'193 body = self.client.show_image(image['id'])194 self.assertEqual(image['id'], body['id'])195 self.assertEqual('uploading', body['status'])196 if all_stores:197 stores_list = ','.join([store['id']198 for store in self.available_stores])199 else:200 stores = [store['id'] for store in self.available_stores]201 stores_list = stores[::len(stores) - 1]202 return body, stores_list203 @decorators.idempotent_id('bf04ff00-3182-47cb-833a-f1c6767b47fd')204 def test_glance_direct_import_image_to_all_stores(self):205 """Test image is imported in all available stores206 Create image, import image to all available stores using glance-direct207 import method and verify that import succeeded.208 """209 image, stores = self._create_and_stage_image(all_stores=True)210 self.client.image_import(211 image['id'], method='glance-direct', all_stores=True)212 waiters.wait_for_image_imported_to_stores(self.client,213 image['id'], stores)214 @decorators.idempotent_id('82fb131a-dd2b-11ea-aec7-340286b6c574')215 def test_glance_direct_import_image_to_specific_stores(self):216 """Test image is imported in all available stores217 Create image, import image to specified store(s) using glance-direct218 import method and verify that import succeeded.219 """220 image, stores = self._create_and_stage_image()221 self.client.image_import(image['id'], method='glance-direct',222 stores=stores)223 waiters.wait_for_image_imported_to_stores(self.client, image['id'],224 (','.join(stores)))225class BasicOperationsImagesTest(base.BaseV2ImageTest):226 """Here we test the basic operations of images"""227 @decorators.attr(type='smoke')228 @decorators.idempotent_id('139b765e-7f3d-4b3d-8b37-3ca3876ee318')229 def test_register_upload_get_image_file(self):230 """Here we test these functionalities231 Register image, upload the image file, get image and get image232 file api's233 """234 uuid = '00000000-1111-2222-3333-444455556666'...

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