How to use _delete_backup method in tempest

Best Python code snippet using tempest_python

backups.py

Source:backups.py Github

copy

Full Screen

...21 :param kwargs: optional additional arguments for backup creation22 """23 backup = self._create_backup(self.context["instance"]["id"],24 name=name, **kwargs)25 self._delete_backup(backup)26@scenario.configure(name="TroveBackups.create_and_show_backup")27class CreateAndShowBackup(utils.TroveScenario):28 def run(self, name=None, **kwargs):29 """Create a backup of the instance, while the instance was30 created in context. And then get the details for the backkup.31 :param name: the name of backup to create32 :param kwargs: optional additional arguments for backup creation33 """34 backup = self._create_backup(self.context["instance"]["id"],35 name=name, **kwargs)36 self._get_backup(backup)37 self._delete_backup(backup)38@scenario.configure(name="TroveBackups.create_incremental_backup")39class CreateIncrementalBackup(utils.TroveScenario):40 def run(self, name=None, **kwargs):41 """Create an incremental backup, while the parent backup was42 created in context.43 :param name: the name of backup to create44 :param kwargs: optional additional arguments for backup creation45 """46 instance_id = self.context["instance"]["id"]47 if "incremental" in kwargs.keys():48 if kwargs["incremental"] is not True:49 raise Exception("'incremental' must set to True.")50 else:51 pass52 else:53 kwargs["incremental"] = True54 backup = self._create_backup(instance_id,55 name=name, **kwargs)56 self._delete_backup(backup)57@scenario.configure(name="TroveBackups.create_incremental_backup"58 "_and_delete_parent")59class CreateIncrementalBackupAndDeleteParent(utils.TroveScenario):60 def run(self, name=None, **kwargs):61 """Create a backup for instance as parent and create an incremental62 backup from the parent, and then delete the parent backup, check if63 children backups are delete with it.64 :param name: the name of backup to create65 :param kwargs: optional additional arguments for backup creation66 """67 instance_id = self.context["instance"]["id"]68 if "child_backups_counts" not in kwargs.keys():69 child_counts = 170 else:71 child_counts = kwargs["child_backups_counts"]72 del kwargs["child_backups_counts"]73 if "incremental" in kwargs.keys():74 if kwargs["incremental"] is not True:75 raise Exception("'incremental' must set to True.")76 else:77 parent_bck = self._create_backup(instance_id,78 name=name, **kwargs)79 else:80 kwargs["incremental"] = True81 parent_bck = self._create_backup(instance_id,82 name=name, **kwargs)83 child_bcks = []84 for i in range(0, child_counts):85 child_bcks.append(self._create_backup(instance_id,86 name=name, **kwargs))87 self._delete_backup(parent_bck)88 for child_bck in child_bcks:89 try:90 from troveclient.exceptions import NotFound91 self._get_backup(child_bck)92 raise Exception("Child backup %s is not deleted" % child_bck)93 except NotFound:94 msg = ("Child backup %s is deleted, check OK" % child_bck)95 LOG.debug(msg)96@scenario.configure(name="TroveBackups.create_incremental_backup_and_delete")97class CreateIncrementalBackupAndDelete(utils.TroveScenario):98 def run(self, name=None, **kwargs):99 """Create a backup for instance as parent and create an incremental100 backup from the parent, delete the children backups first, and then101 delete the parent backup.102 :param name: the name of backup to create103 :param kwargs: optional additional arguments for backup creation104 """105 instance_id = self.context["instance"]["id"]106 if "child_backups_counts" not in kwargs.keys():107 child_counts = 1108 instance_id = self.context["instance"]["id"]109 if "incremental" in kwargs.keys():110 if kwargs["incremental"] is not True:111 raise Exception("'incremental' must set to True.")112 else:113 parent_bck = self._create_backup(instance_id,114 name=name, **kwargs)115 else:116 kwargs["incremental"] = True117 parent_bck = self._create_backup(instance_id,118 name=name, **kwargs)119 child_bcks = []120 for i in range(0, child_counts):121 child_bcks.append(self._create_backup(instance_id,122 name=name, **kwargs))123 for child_bck in child_bcks:124 self._delete_backup(child_bck)125 LOG.debug("Child backup [%s: %s] is deleted"126 % (child_bck.name, child_bck.id))127 self._delete_backup(parent_bck)128 LOG.debug("Parent backup [%s: %s] is deleted"...

Full Screen

Full Screen

test_volumes_backup.py

Source:test_volumes_backup.py Github

copy

Full Screen

...27 @classmethod28 def resource_setup(cls):29 super(VolumesBackupsV2Test, cls).resource_setup()30 cls.volume = cls.create_volume()31 def _delete_backup(self, backup_id):32 self.backups_adm_client.delete_backup(backup_id)33 self.backups_adm_client.wait_for_backup_deletion(backup_id)34 @test.idempotent_id('a66eb488-8ee1-47d4-8e9f-575a095728c6')35 def test_volume_backup_create_get_detailed_list_restore_delete(self):36 # Create backup37 backup_name = data_utils.rand_name('Backup')38 create_backup = self.backups_adm_client.create_backup39 backup = create_backup(volume_id=self.volume['id'],40 name=backup_name)['backup']41 self.addCleanup(self.backups_adm_client.delete_backup,42 backup['id'])43 self.assertEqual(backup_name, backup['name'])44 self.admin_volume_client.wait_for_volume_status(45 self.volume['id'], 'available')...

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