How to use wait_for_volume_resource_status method in tempest

Best Python code snippet using tempest_python

test_volume_backup.py

Source:test_volume_backup.py Github

copy

Full Screen

...46 snapshot_id=snapshot['id'])47 # Get a given backup48 backup = self.backups_client.show_backup(49 backup['id'])['backup']50 waiters.wait_for_volume_resource_status(51 self.backups_client,52 backup['id'], 'available')53 self.assertEqual(volume['id'], backup['volume_id'])54 self.assertEqual(snapshot['id'], backup['snapshot_id'])55 self.snapshots_client.delete_snapshot(snapshot['id'])56 self.snapshots_client.wait_for_resource_deletion(snapshot['id'])57 self.volumes_client.delete_volume(volume['id'])58 self.volumes_client.wait_for_resource_deletion(volume['id'])59 @test.idempotent_id('b5d837b0-7066-455d-88fc-4a721a899306')60 def test_backup_create_and_restore_to_an_existing_volume(self):61 """Test backup create and restore to an existing volume."""62 # Create volume63 src_vol = self.create_volume()64 self.addCleanup(self.volumes_client.delete_volume,65 src_vol['id'])66 # Create backup67 backup = self.backups_client.create_backup(68 volume_id=src_vol['id'])['backup']69 self.addCleanup(self.backups_client.delete_backup, backup['id'])70 waiters.wait_for_volume_resource_status(71 self.backups_client,72 backup['id'], 'available')73 # Restore to existing volume74 restore = self.backups_client.restore_backup(75 backup_id=backup['id'],76 volume_id=src_vol['id'])['restore']77 waiters.wait_for_volume_resource_status(78 self.backups_client,79 backup['id'], 'available')80 waiters.wait_for_volume_resource_status(81 self.volumes_client,82 src_vol['id'], 'available')83 self.assertEqual(src_vol['id'], restore['volume_id'])84 self.assertEqual(backup['id'], restore['backup_id'])85 @test.idempotent_id('c810fe2c-cb40-43ab-96aa-471b74516a98')86 def test_incremental_backup(self):87 """Test create incremental backup."""88 # Create volume from image89 volume = self.create_volume(size=CONF.volume.volume_size,90 imageRef=CONF.compute.image_ref)91 self.addCleanup(self.volumes_client.delete_volume,92 volume['id'])93 # Create backup94 backup = self.backups_client.create_backup(95 volume_id=volume['id'])['backup']96 waiters.wait_for_volume_resource_status(self.backups_client,97 backup['id'], 'available')98 # Create a server99 bd_map = [{'volume_id': volume['id'],100 'delete_on_termination': '0'}]101 server_name = data_utils.rand_name('instance')102 server = self.create_server(103 name=server_name,104 block_device_mapping=bd_map,105 wait_until='ACTIVE')106 # Delete VM107 self.servers_client.delete_server(server['id'])108 # Create incremental backup109 waiters.wait_for_volume_resource_status(self.volumes_client,110 volume['id'], 'available')111 backup_incr = self.backups_client.create_backup(112 volume_id=volume['id'],113 incremental=True)['backup']114 waiters.wait_for_volume_resource_status(self.backups_client,115 backup_incr['id'],116 'available')117 is_incremental = self.backups_client.show_backup(118 backup_incr['id'])['backup']['is_incremental']119 self.assertTrue(is_incremental)120 self.backups_client.delete_backup(backup_incr['id'])121 self.backups_client.wait_for_resource_deletion(backup_incr['id'])122 self.backups_client.delete_backup(backup['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