Best Python code snippet using tempest_python
test_qos.py
Source:test_qos.py
...28 cls.qos_consumer = 'front-end'29 cls.created_qos = cls.create_test_qos_specs(cls.qos_name,30 cls.qos_consumer,31 read_iops_sec='2000')32 def _create_delete_test_qos_with_given_consumer(self, consumer):33 name = utils.rand_name('qos')34 qos = {'name': name, 'consumer': consumer}35 body = self.create_test_qos_specs(name, consumer)36 for key in ['name', 'consumer']:37 self.assertEqual(qos[key], body[key])38 self.volume_qos_client.delete_qos(body['id'])39 self.volume_qos_client.wait_for_resource_deletion(body['id'])40 # validate the deletion41 list_qos = self.volume_qos_client.list_qos()['qos_specs']42 self.assertNotIn(body, list_qos)43 def _create_test_volume_type(self):44 vol_type_name = utils.rand_name("volume-type")45 vol_type = self.volume_types_client.create_volume_type(46 name=vol_type_name)['volume_type']47 self.addCleanup(self.volume_types_client.delete_volume_type,48 vol_type['id'])49 return vol_type50 def _test_associate_qos(self, vol_type_id):51 self.volume_qos_client.associate_qos(52 self.created_qos['id'], vol_type_id)53 def _test_get_association_qos(self):54 body = self.volume_qos_client.show_association_qos(55 self.created_qos['id'])['qos_associations']56 associations = []57 for association in body:58 associations.append(association['id'])59 return associations60 @test.idempotent_id('7e15f883-4bef-49a9-95eb-f94209a1ced1')61 def test_create_delete_qos_with_front_end_consumer(self):62 """Tests the creation and deletion of QoS specs63 With consumer as front end64 """65 self._create_delete_test_qos_with_given_consumer('front-end')66 @test.idempotent_id('b115cded-8f58-4ee4-aab5-9192cfada08f')67 def test_create_delete_qos_with_back_end_consumer(self):68 """Tests the creation and deletion of QoS specs69 With consumer as back-end70 """71 self._create_delete_test_qos_with_given_consumer('back-end')72 @test.idempotent_id('f88d65eb-ea0d-487d-af8d-71f4011575a4')73 def test_create_delete_qos_with_both_consumer(self):74 """Tests the creation and deletion of QoS specs75 With consumer as both front end and back end76 """77 self._create_delete_test_qos_with_given_consumer('both')78 @test.idempotent_id('7aa214cc-ac1a-4397-931f-3bb2e83bb0fd')79 def test_get_qos(self):80 """Tests the detail of a given qos-specs"""81 body = self.volume_qos_client.show_qos(82 self.created_qos['id'])['qos_specs']83 self.assertEqual(self.qos_name, body['name'])84 self.assertEqual(self.qos_consumer, body['consumer'])85 @test.idempotent_id('75e04226-bcf7-4595-a34b-fdf0736f38fc')86 def test_list_qos(self):87 """Tests the list of all qos-specs"""88 body = self.volume_qos_client.list_qos()['qos_specs']89 self.assertIn(self.created_qos, body)90 @test.idempotent_id('ed00fd85-4494-45f2-8ceb-9e2048919aed')91 def test_set_unset_qos_key(self):...
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!!