How to use _modify_backup_url method in tempest

Best Python code snippet using tempest_python

test_volumes_backup.py

Source:test_volumes_backup.py Github

copy

Full Screen

...33 return json.loads(base64.decode_as_text(backup_url))34 def _encode_backup(self, backup):35 retval = json.dumps(backup)36 return base64.encode_as_text(retval)37 def _modify_backup_url(self, backup_url, changes):38 backup = self._decode_url(backup_url)39 backup.update(changes)40 return self._encode_backup(backup)41 @decorators.idempotent_id('a99c54a1-dd80-4724-8a13-13bf58d4068d')42 def test_volume_backup_export_import(self):43 """Test backup export import functionality.44 Cinder allows exporting DB backup information through its API so it can45 be imported back in case of a DB loss.46 """47 volume = self.create_volume()48 # Create backup49 backup_name = data_utils.rand_name(self.__class__.__name__ + '-Backup')50 backup = (self.create_backup(backup_client=self.admin_backups_client,51 volume_id=volume['id'],52 name=backup_name))53 self.assertEqual(backup_name, backup['name'])54 # Export Backup55 export_backup = (self.admin_backups_client.export_backup(backup['id'])56 ['backup-record'])57 self.assertIn('backup_service', export_backup)58 self.assertIn('backup_url', export_backup)59 self.assertTrue(export_backup['backup_service'].startswith(60 'cinder.backup.drivers'))61 self.assertIsNotNone(export_backup['backup_url'])62 # NOTE(geguileo): Backups are imported with the same backup id63 # (important for incremental backups among other things), so we cannot64 # import the exported backup information as it is, because that Backup65 # ID already exists. So we'll fake the data by changing the backup id66 # in the exported backup DB info we have retrieved before importing it67 # back.68 new_id = data_utils.rand_uuid()69 new_url = self._modify_backup_url(70 export_backup['backup_url'], {'id': new_id})71 # Import Backup72 import_backup = self.admin_backups_client.import_backup(73 backup_service=export_backup['backup_service'],74 backup_url=new_url)['backup']75 # NOTE(geguileo): We delete both backups, but only one of those76 # deletions will delete data from the backup back-end because they77 # were both pointing to the same backend data.78 self.addCleanup(self._delete_backup, new_id)79 self.assertIn("id", import_backup)80 self.assertEqual(new_id, import_backup['id'])81 waiters.wait_for_backup_status(self.admin_backups_client,82 import_backup['id'], 'available')83 # Verify Import Backup...

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