How to use test_suspend_server method in tempest

Best Python code snippet using tempest_python

test_suspend_server_rbac.py

Source:test_suspend_server_rbac.py Github

copy

Full Screen

...43 @decorators.idempotent_id('b775930f-237c-431c-83ae-d33ed1b9700b')44 @rbac_rule_validation.action(45 service="nova",46 rule="os_compute_api:os-suspend-server:suspend")47 def test_suspend_server(self):48 self.rbac_utils.switch_role(self, toggle_rbac_role=True)49 self.servers_client.suspend_server(self.server['id'])50 waiters.wait_for_server_status(self.servers_client, self.server['id'],51 'SUSPENDED')52 @decorators.idempotent_id('4d90bd02-11f8-45b1-a8a1-534665584675')53 @rbac_rule_validation.action(54 service="nova",55 rule="os_compute_api:os-suspend-server:resume")56 def test_resume_server(self):57 self.servers_client.suspend_server(self.server['id'])58 waiters.wait_for_server_status(self.servers_client, self.server['id'],59 'SUSPENDED')60 self.rbac_utils.switch_role(self, toggle_rbac_role=True)61 self.servers_client.resume_server(self.server['id'])...

Full Screen

Full Screen

generate_example_data.py

Source:generate_example_data.py Github

copy

Full Screen

1import random2import time3files = [4 'network/linux_net.py',5 'test.py',6 'tests/unit/api/openstack/compute/admin_only_action_common.py',7 'tests/unit/api/openstack/compute/test_admin_actions.py',8 'tests/unit/api/openstack/compute/test_block_device_mapping.py',9 'tests/unit/api/openstack/compute/test_lock_server.py',10 'tests/unit/api/openstack/compute/test_migrate_server.py',11 'tests/unit/api/openstack/compute/test_migrations.py',12 'tests/unit/api/openstack/compute/test_pause_server.py',13 'tests/unit/api/openstack/compute/test_quotas.py',14 'tests/unit/api/openstack/compute/test_suspend_server.py',15 'tests/unit/api/openstack/compute/test_virtual_interfaces.py',16 'tests/unit/api/openstack/compute/test_volumes.py',17 'tests/unit/cells/fakes.py',18 'tests/unit/cells/test_cells_manager.py',19 'tests/unit/cells/test_cells_messaging.py',20 'tests/unit/cells/test_cells_rpc_driver.py',21 'tests/unit/compute/test_compute_api.py',22 'tests/unit/conductor/tasks/test_live_migrate.py',23 'tests/unit/conductor/test_conductor.py',24 'tests/unit/consoleauth/test_consoleauth.py',25 'tests/unit/network/test_linux_net.py',26 'tests/unit/network/test_manager.py',27 'tests/unit/network/test_neutronv2.py',28 'tests/unit/objects/test_instance.py',29 'tests/unit/test_service.py',30 'tests/unit/virt/libvirt/test_driver.py',31 'tests/unit/virt/test_block_device.py',32 'tests/unit/virt/test_virt_drivers.py',33 'tests/unit/virt/vmwareapi/test_driver_api.py',34 'tests/unit/virt/xenapi/image/test_utils.py',35 'tests/unit/virt/xenapi/image/test_vdi_through_dev.py',36 'tests/unit/virt/xenapi/test_vm_utils.py',37 'tests/unit/virt/xenapi/test_vmops.py',38 'tests/unit/virt/xenapi/test_xenapi.py',39]40with open('data/num_matched_files.csv', 'w') as f:41 ts = int(time.time())42 hr = 60*6043 records = 10044 c = ''45 for i in range(0, records):46 cts = ts-((records-i)*hr)47 val = len(files)-int((i/(float(records))*len(files)))48 c += '{0},{1}'.format(cts, val) + '\n'49 f.write(c)50with open('data/num_matched_lines.csv', 'w') as f:51 ts = int(time.time())52 hr = 60*6053 records = 100054 todo = 180055 c = ''56 for i in range(0, records):57 cts = ts-((records-i)*hr)58 done = random.randint(0, int(todo/float(100)))59 todo -= done60 c += '{0},{1}'.format(cts, todo) + '\n'...

Full Screen

Full Screen

test_server.py

Source:test_server.py Github

copy

Full Screen

...30 def test_snapshot_server(self):31 self.server.wait()32 image = self.server.snapshot()33 self.assertIn(image, ACCOUNT.images)34 def test_suspend_server(self):35 self.server.wait()36 self.server.suspend()37 self.assertEqual("suspended", self.server.status)38 def test_wait_for_server(self):39 self.assertNotEqual("running", self.server.status)40 self.server.wait()41 self.assertEqual("running", self.server.status)42 pass43 def test_reboot_server(self):44 self.server.wait()45 self.server.reboot()46 def test_reset_root_password(self):47 self.server.wait()48 self.server.reset_root_password("just_testing")...

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