How to use _test_associate_qos method in tempest

Best Python code snippet using tempest_python

test_qos.py

Source:test_qos.py Github

copy

Full Screen

...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):92 """Test the addition of a specs key to qos-specs"""93 args = {'iops_bytes': '500'}94 body = self.volume_qos_client.set_qos_key(95 self.created_qos['id'],96 iops_bytes='500')['qos_specs']97 self.assertEqual(args, body)98 body = self.volume_qos_client.show_qos(99 self.created_qos['id'])['qos_specs']100 self.assertEqual(args['iops_bytes'], body['specs']['iops_bytes'])101 # test the deletion of a specs key from qos-specs102 keys = ['iops_bytes']103 self.volume_qos_client.unset_qos_key(self.created_qos['id'], keys)104 operation = 'qos-key-unset'105 self.volume_qos_client.wait_for_qos_operations(self.created_qos['id'],106 operation, keys)107 body = self.volume_qos_client.show_qos(108 self.created_qos['id'])['qos_specs']109 self.assertNotIn(keys[0], body['specs'])110 @test.idempotent_id('1dd93c76-6420-485d-a771-874044c416ac')111 def test_associate_disassociate_qos(self):112 """Test the following operations :113 1. associate_qos114 2. get_association_qos115 3. disassociate_qos116 4. disassociate_all_qos117 """118 # create a test volume-type119 vol_type = []120 for _ in range(0, 3):121 vol_type.append(self._create_test_volume_type())122 # associate the qos-specs with volume-types123 for i in range(0, 3):124 self._test_associate_qos(vol_type[i]['id'])125 # get the association of the qos-specs126 associations = self._test_get_association_qos()127 for i in range(0, 3):128 self.assertIn(vol_type[i]['id'], associations)129 # disassociate a volume-type with qos-specs130 self.volume_qos_client.disassociate_qos(131 self.created_qos['id'], vol_type[0]['id'])132 operation = 'disassociate'133 self.volume_qos_client.wait_for_qos_operations(self.created_qos['id'],134 operation,135 vol_type[0]['id'])136 associations = self._test_get_association_qos()137 self.assertNotIn(vol_type[0]['id'], associations)138 # disassociate all volume-types from qos-specs...

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