Best Python code snippet using tempest_python
test_group_snapshots.py
Source:test_group_snapshots.py
...83 group_snapshot['id'])['group_snapshot']84 self.assertEqual(group_snapshot_name, group_snapshot['name'])85 # Get all group snapshots with details, check some detail-specific86 # elements, and look for the created group snapshot87 group_snapshots = self.group_snapshots_client.list_group_snapshots(88 detail=True)['group_snapshots']89 for grp_snapshot in group_snapshots:90 self.assertIn('created_at', grp_snapshot)91 self.assertIn('group_id', grp_snapshot)92 self.assertIn((group_snapshot['name'], group_snapshot['id']),93 [(m['name'], m['id']) for m in group_snapshots])94 # Delete group snapshot95 self._delete_group_snapshot(group_snapshot)96 group_snapshots = self.group_snapshots_client.list_group_snapshots()[97 'group_snapshots']98 self.assertEmpty(group_snapshots)99 @decorators.idempotent_id('eff52c70-efc7-45ed-b47a-4ad675d09b81')100 def test_create_group_from_group_snapshot(self):101 # Create volume type102 volume_type = self.create_volume_type()103 # Create group type104 group_type = self.create_group_type()105 # Create Group106 grp = self.create_group(group_type=group_type['id'],107 volume_types=[volume_type['id']])108 # Create volume109 vol = self.create_volume(volume_type=volume_type['id'],110 group_id=grp['id'])...
purge_rbd.py
Source:purge_rbd.py
...98 print("Create group snapshots")99 for snap in SNAPS:100 rbd.create_group_snapshot(GROUP, snap)101 print(102 "Group snapshot list: " + str(rbd.list_group_snapshots(GROUP))103 )104 for snap in SNAPS:105 if not rbd.group_snapshot_exists(GROUP, snap):106 raise Exception(107 "Could not create snapshot "108 + snap109 + " on group "110 + GROUP111 )112 # Remove snapshots from group113 print("Purge group " + GROUP)114 rbd.purge_group(GROUP)115 # Verify purge116 snap_list = rbd.list_group_snapshots(GROUP)117 print("Snaps from group " + GROUP + ": " + str(snap_list))118 if len(snap_list) != 0:119 raise Exception("Error purging group" + GROUP)120 # Remove group121 print("Remove group " + IMG_NAME)122 rbd.remove_group(GROUP)123 group_list = rbd.list_groups()124 print("Group list: " + str(group_list))125 if GROUP in group_list:126 raise Exception("Could not remove group " + GROUP)127 print("Test finished")128 finally:129 # Cleanup130 if rbd.group_exists(GROUP):...
group_snapshots_client.py
Source:group_snapshots_client.py
...48 resp, body = self.get(url)49 body = json.loads(body)50 self.validate_response(schema.show_group_snapshot, resp, body)51 return rest_client.ResponseBody(resp, body)52 def list_group_snapshots(self, detail=False, **params):53 """Information for all the tenant's group snapshots.54 For more information, please refer to the official API reference:55 https://docs.openstack.org/api-ref/block-storage/v3/#list-group-snapshots56 https://docs.openstack.org/api-ref/block-storage/v3/#list-group-snapshots-with-details57 """58 url = "group_snapshots"59 list_group_snapshots = schema.list_group_snapshots_no_detail60 if detail:61 url += "/detail"62 list_group_snapshots = schema.list_group_snapshots_with_detail63 if params:64 url += '?%s' % urllib.urlencode(params)65 resp, body = self.get(url)66 body = json.loads(body)...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!