Best Python code snippet using tempest_python
test_shelve_instance.py
Source:test_shelve_instance.py
...32 def skip_checks(cls):33 super(TestShelveInstance, cls).skip_checks()34 if not CONF.compute_feature_enabled.shelve:35 raise cls.skipException("Shelve is not available.")36 def _shelve_then_unshelve_server(self, server):37 compute.shelve_server(self.servers_client, server['id'],38 force_shelve_offload=True)39 self.servers_client.unshelve_server(server['id'])40 waiters.wait_for_server_status(self.servers_client, server['id'],41 'ACTIVE')42 def _create_server_then_shelve_and_unshelve(self, boot_from_volume=False):43 keypair = self.create_keypair()44 security_group = self._create_security_group()45 security_groups = [{'name': security_group['name']}]46 server = self.create_server(47 key_name=keypair['name'],48 security_groups=security_groups,49 volume_backed=boot_from_volume)50 instance_ip = self.get_server_ip(server)51 timestamp = self.create_timestamp(instance_ip,52 private_key=keypair['private_key'])53 # Prevent bug #1257594 from coming back54 # Unshelve used to boot the instance with the original image, not55 # with the instance snapshot56 self._shelve_then_unshelve_server(server)57 timestamp2 = self.get_timestamp(instance_ip,58 private_key=keypair['private_key'])59 self.assertEqual(timestamp, timestamp2)60 @decorators.idempotent_id('1164e700-0af0-4a4c-8792-35909a88743c')61 @testtools.skipUnless(CONF.network.public_network_id,62 'The public_network_id option must be specified.')63 @test.services('compute', 'network', 'image')64 def test_shelve_instance(self):65 self._create_server_then_shelve_and_unshelve()66 @decorators.idempotent_id('c1b6318c-b9da-490b-9c67-9339b627271f')67 @testtools.skipUnless(CONF.network.public_network_id,68 'The public_network_id option must be specified.')69 @test.services('compute', 'volume', 'network', 'image')70 def test_shelve_volume_backed_instance(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!!