Best Python code snippet using tempest_python
test_group_snapshots.py
Source: test_group_snapshots.py
...37 self._delete_group_snapshot, group_snapshot)38 waiters.wait_for_volume_resource_status(39 self.group_snapshots_client, group_snapshot['id'], 'available')40 return group_snapshot41 def _delete_group_snapshot(self, group_snapshot):42 self.group_snapshots_client.delete_group_snapshot(group_snapshot['id'])43 vols = self.volumes_client.list_volumes(detail=True)['volumes']44 snapshots = self.snapshots_client.list_snapshots(45 detail=True)['snapshots']46 for vol in vols:47 for snap in snapshots:48 if (vol['group_id'] == group_snapshot['group_id'] and49 vol['id'] == snap['volume_id']):50 self.snapshots_client.wait_for_resource_deletion(51 snap['id'])52 self.group_snapshots_client.wait_for_resource_deletion(53 group_snapshot['id'])54class GroupSnapshotsTest(BaseGroupSnapshotsTest):55 _api_version = 356 min_microversion = '3.14'57 max_microversion = 'latest'58 @decorators.idempotent_id('1298e537-f1f0-47a3-a1dd-8adec8168897')59 def test_group_snapshot_create_show_list_delete(self):60 # Create volume type61 volume_type = self.create_volume_type()62 # Create group type63 group_type = self.create_group_type()64 # Create group65 grp = self.create_group(group_type=group_type['id'],66 volume_types=[volume_type['id']])67 # Create volume68 vol = self.create_volume(volume_type=volume_type['id'],69 group_id=grp['id'])70 # Create group snapshot71 group_snapshot_name = data_utils.rand_name('group_snapshot')72 group_snapshot = self._create_group_snapshot(73 group_id=grp['id'], name=group_snapshot_name)74 snapshots = self.snapshots_client.list_snapshots(75 detail=True)['snapshots']76 for snap in snapshots:77 if vol['id'] == snap['volume_id']:78 waiters.wait_for_volume_resource_status(79 self.snapshots_client, snap['id'], 'available')80 self.assertEqual(group_snapshot_name, group_snapshot['name'])81 # Get a given group snapshot82 group_snapshot = self.group_snapshots_client.show_group_snapshot(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'])111 # Create group_snapshot112 group_snapshot_name = data_utils.rand_name('group_snapshot')113 group_snapshot = self._create_group_snapshot(114 group_id=grp['id'], name=group_snapshot_name)115 self.assertEqual(group_snapshot_name, group_snapshot['name'])116 snapshots = self.snapshots_client.list_snapshots(117 detail=True)['snapshots']118 for snap in snapshots:119 if vol['id'] == snap['volume_id']:120 waiters.wait_for_volume_resource_status(121 self.snapshots_client, snap['id'], 'available')122 # Create Group from Group snapshot123 grp_name2 = data_utils.rand_name('Group_from_snap')124 grp2 = self.groups_client.create_group_from_source(125 group_snapshot_id=group_snapshot['id'], name=grp_name2)['group']126 self.addCleanup(self.delete_group, grp2['id'])127 self.assertEqual(grp_name2, grp2['name'])128 vols = self.volumes_client.list_volumes(detail=True)['volumes']129 for vol in vols:130 if vol['group_id'] == grp2['id']:131 waiters.wait_for_volume_resource_status(132 self.volumes_client, vol['id'], 'available')133 waiters.wait_for_volume_resource_status(134 self.groups_client, grp2['id'], 'available')135 @decorators.idempotent_id('7d7fc000-0b4c-4376-a372-544116d2e127')136 @decorators.related_bug('1739031')137 def test_delete_group_snapshots_following_updated_volumes(self):138 volume_type = self.create_volume_type()139 group_type = self.create_group_type()140 # Create a volume group141 grp = self.create_group(group_type=group_type['id'],142 volume_types=[volume_type['id']])143 # Note: When dealing with consistency groups all volumes must144 # reside on the same backend. Adding volumes to the same consistency145 # group from multiple backends isn't supported. In order to ensure all146 # volumes share the same backend, all volumes must share same147 # volume-type and group id.148 volume_list = []149 for _ in range(2):150 volume = self.create_volume(volume_type=volume_type['id'],151 group_id=grp['id'])152 volume_list.append(volume['id'])153 for vol in volume_list:154 self.groups_client.update_group(grp['id'],155 remove_volumes=vol)156 waiters.wait_for_volume_resource_status(157 self.groups_client, grp['id'], 'available')158 self.groups_client.update_group(grp['id'],159 add_volumes=vol)160 waiters.wait_for_volume_resource_status(161 self.groups_client, grp['id'], 'available')162 # Verify the created volumes are associated with consistency group163 vols = self.volumes_client.list_volumes(detail=True)['volumes']164 grp_vols = [v for v in vols if v['group_id'] == grp['id']]165 self.assertEqual(2, len(grp_vols))166 # Create a snapshot group167 group_snapshot = self._create_group_snapshot(group_id=grp['id'])168 snapshots = self.snapshots_client.list_snapshots(169 detail=True)['snapshots']170 for snap in snapshots:171 if snap['volume_id'] in volume_list:172 waiters.wait_for_volume_resource_status(173 self.snapshots_client, snap['id'], 'available')174 # Delete a snapshot group175 self._delete_group_snapshot(group_snapshot)176class GroupSnapshotsV319Test(BaseGroupSnapshotsTest):177 _api_version = 3178 min_microversion = '3.19'179 max_microversion = 'latest'180 @decorators.idempotent_id('3b42c9b9-c984-4444-816e-ca2e1ed30b40')181 @decorators.skip_because(bug='1770179')182 def test_reset_group_snapshot_status(self):183 # Create volume type184 volume_type = self.create_volume_type()185 # Create group type186 group_type = self.create_group_type()187 # Create group188 group = self.create_group(group_type=group_type['id'],189 volume_types=[volume_type['id']])...
Check out the latest blogs from LambdaTest on this topic:
These days, development teams depend heavily on feedback from automated tests to evaluate the quality of the system they are working on.
I think that probably most development teams describe themselves as being “agile” and probably most development teams have standups, and meetings called retrospectives.There is also a lot of discussion about “agile”, much written about “agile”, and there are many presentations about “agile”. A question that is often asked is what comes after “agile”? Many testers work in “agile” teams so this question matters to us.
I routinely come across test strategy documents when working with customers. They are lengthy—100 pages or more—and packed with monotonous text that is routinely reused from one project to another. Yawn once more— the test halt and resume circumstances, the defect management procedure, entrance and exit criteria, unnecessary generic risks, and in fact, one often-used model replicates the requirements of textbook testing, from stress to systems integration.
To understand the agile testing mindset, we first need to determine what makes a team “agile.” To me, an agile team continually focuses on becoming self-organized and cross-functional to be able to complete any challenge they may face during a project.
When working on web automation with Selenium, I encountered scenarios where I needed to refresh pages from time to time. When does this happen? One scenario is that I needed to refresh the page to check that the data I expected to see was still available even after refreshing. Another possibility is to clear form data without going through each input individually.
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!!