How to use update_volume_metadata method in tempest

Best Python code snippet using tempest_python

cinder_db.py

Source: cinder_db.py Github

copy

Full Screen

...56 self.mysql.execute(sql, **parameters)57 def update_volume(self, old_id, **kwargs):58 sql = 'UPDATE volumes SET {} WHERE id = :old_id'59 self._update_table(sql, old_id, kwargs)60 def update_volume_metadata(self, old_id, **kwargs):61 sql = 'UPDATE volume_metadata SET {} WHERE volume_id = :old_id'62 self._update_table(sql, old_id, kwargs)63 def update_volume_id(self, old_id, new_id):64 with self.mysql.transaction():65 # It is impossible to update the primary key if any tables have66 # dependent records.67 # Making a copy of the fake volume with ID from source cloud.68 row = self.mysql.execute("SELECT * FROM volumes "69 "WHERE id = :old_id",70 old_id=old_id).fetchone()71 parameters = {'id': new_id}72 parameters.update({k: v for k, v in row.items() if k != 'id'})73 insert = "INSERT INTO volumes ({}) VALUES ({})".format(74 ', '.join(parameters.keys()),75 ', '.join(':{}'.format(k) for k in parameters.keys())76 )77 self.mysql.execute(insert, **parameters)78 # Update all dependent tables79 self.update_volume_metadata(old_id, volume_id=new_id)80 # Update an ID of fake volume to raise an exception if it still has81 # not updated dependent records in other tables82 fake_id = str(uuid_lib.uuid4())83 self.update_volume(old_id, id=fake_id)84 # Delete fake volume85 self.mysql.execute('DELETE FROM volumes WHERE id = :old_id',86 old_id=fake_id)87 def inc_quota_usages(self, project_id, resource, value):88 self.mysql.execute("UPDATE quota_usages "89 "SET in_use = in_use + :value "90 "WHERE project_id = :project_id "91 "AND resource = :resource",92 project_id=project_id,93 resource=resource,...

Full Screen

Full Screen

test_volume_metadata_rbac.py

Source: test_volume_metadata_rbac.py Github

copy

Full Screen

...26 def setUp(self):27 super(VolumeMetadataRbacTest, self).setUp()28 self._add_metadata(self.volume)29 def tearDown(self):30 self.volumes_client.update_volume_metadata(self.volume['id'], {})31 super(VolumeMetadataRbacTest, self).tearDown()32 def _add_metadata(self, volume):33 # Create metadata for the volume34 metadata = {"key1": "value1"}35 self.volumes_client.create_volume_metadata(36 self.volume['id'], metadata)['metadata']37 @rbac_rule_validation.action(service="cinder",38 rule="volume:create_volume_metadata")39 @decorators.idempotent_id('232bbb8b-4c29-44dc-9077-b1398c20b738')40 def test_create_volume_metadata(self):41 self.rbac_utils.switch_role(self, toggle_rbac_role=True)42 self._add_metadata(self.volume)43 @rbac_rule_validation.action(service="cinder",44 rule="volume:get_volume_metadata")45 @decorators.idempotent_id('87ea37d9-23ab-47b2-a59c-16fc4d2c6dfa')46 def test_show_volume_metadata(self):47 self.rbac_utils.switch_role(self, toggle_rbac_role=True)48 self.volumes_client.show_volume_metadata(self.volume['id'])['metadata']49 @rbac_rule_validation.action(service="cinder",50 rule="volume:delete_volume_metadata")51 @decorators.idempotent_id('7498dfc1-9db2-4423-ad20-e6dcb25d1beb')52 def test_delete_volume_metadata_item(self):53 self.rbac_utils.switch_role(self, toggle_rbac_role=True)54 self.volumes_client.delete_volume_metadata_item(self.volume['id'],55 "key1")56 @decorators.idempotent_id('a41c8eed-2051-4a25-b401-df036faacbdc')57 @rbac_rule_validation.action(58 service="cinder",59 rule="volume:delete_volume_metadata")60 def test_delete_volume_image_metadata(self):61 self.volumes_client.update_volume_image_metadata(62 self.volume['id'], image_id=self.image_id)63 self.rbac_utils.switch_role(self, toggle_rbac_role=True)64 self.volumes_client.delete_volume_image_metadata(self.volume['id'],65 'image_id')66 @rbac_rule_validation.action(service="cinder",67 rule="volume:update_volume_metadata")68 @decorators.idempotent_id('8ce2ff80-99ba-49ae-9bb1-7e96729ee5af')69 def test_update_volume_metadata_item(self):70 updated_metadata_item = {"key1": "value1_update"}71 self.rbac_utils.switch_role(self, toggle_rbac_role=True)72 self.volumes_client.update_volume_metadata_item(73 self.volume['id'], "key1", updated_metadata_item)['meta']74 @decorators.idempotent_id('a231b445-97a5-4657-b05f-245895e88da9')75 @rbac_rule_validation.action(service="cinder",76 rule="volume:update_volume_metadata")77 def test_update_volume_metadata(self):78 updated_metadata = {"key1": "value1"}79 self.rbac_utils.switch_role(self, toggle_rbac_role=True)80 self.volumes_client.update_volume_metadata(self.volume['id'],81 updated_metadata)82 @decorators.idempotent_id('a9d9e825-5ea3-42e6-96f3-7ac4e97b2ed0')83 @rbac_rule_validation.action(84 service="cinder",85 rule="volume:update_volume_metadata")86 def test_update_volume_image_metadata(self):87 self.rbac_utils.switch_role(self, toggle_rbac_role=True)88 self.volumes_client.update_volume_image_metadata(...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Rebuild Confidence in Your Test Automation

These days, development teams depend heavily on feedback from automated tests to evaluate the quality of the system they are working on.

What will come after “agile”?

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.

Test strategy and how to communicate it

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.

Do you possess the necessary characteristics to adopt an Agile testing mindset?

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.

How To Refresh Page Using Selenium C# [Complete Tutorial]

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.

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