How to use _create_volume_from_snapshot method in tempest

Best Python code snippet using tempest_python

test_volumes_snapshots.py

Source:test_volumes_snapshots.py Github

copy

Full Screen

...106 self.assertEqual(new_s_name, updated_snapshot['name'])107 self.assertEqual(new_desc, updated_snapshot['description'])108 # Delete the snapshot109 self.delete_snapshot(snapshot['id'])110 def _create_volume_from_snapshot(self, extra_size=0):111 src_size = CONF.volume.volume_size112 size = src_size + extra_size113 src_vol = self.create_volume(size=src_size)114 src_snap = self.create_snapshot(src_vol['id'])115 dst_vol = self.create_volume(snapshot_id=src_snap['id'],116 size=size)117 # NOTE(zhufl): dst_vol is created based on snapshot, so dst_vol118 # should be deleted before deleting snapshot, otherwise deleting119 # snapshot will end with status 'error-deleting'. This depends on120 # the implementation mechanism of vendors, generally speaking,121 # some verdors will use "virtual disk clone" which will promote122 # disk clone speed, and in this situation the "disk clone"123 # is just a relationship between volume and snapshot.124 self.addCleanup(self.delete_volume, self.volumes_client, dst_vol['id'])125 volume = self.volumes_client.show_volume(dst_vol['id'])['volume']126 # Should allow127 self.assertEqual(volume['snapshot_id'], src_snap['id'])128 self.assertEqual(volume['size'], size)129 @decorators.idempotent_id('677863d1-3142-456d-b6ac-9924f667a7f4')130 def test_volume_from_snapshot(self):131 # Creates a volume from a snapshot passing a size132 # different from the source133 self._create_volume_from_snapshot(extra_size=1)134 @decorators.idempotent_id('053d8870-8282-4fff-9dbb-99cb58bb5e0a')135 def test_volume_from_snapshot_no_size(self):136 # Creates a volume from a snapshot defaulting to original size137 self._create_volume_from_snapshot()138 @decorators.idempotent_id('bbcfa285-af7f-479e-8c1a-8c34fc16543c')139 @testtools.skipUnless(CONF.volume_feature_enabled.backup,140 "Cinder backup is disabled")141 def test_snapshot_backup(self):142 # Create a snapshot143 snapshot = self.create_snapshot(volume_id=self.volume_origin['id'])144 backup = self.create_backup(volume_id=self.volume_origin['id'],145 snapshot_id=snapshot['id'])146 waiters.wait_for_volume_resource_status(self.snapshots_client,147 snapshot['id'], 'available')148 backup_info = self.backups_client.show_backup(backup['id'])['backup']149 self.assertEqual(self.volume_origin['id'], backup_info['volume_id'])...

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