Best Python code snippet using tempest_python
test_shelve_instance.py
Source:test_shelve_instance.py
...55 waiters.wait_for_server_status(self.servers_client,56 server['id'], 'ACTIVE')57 dst_host = self.get_host_for_server(server['id'])58 self.assertNotEqual(src_host, dst_host)59 def _create_server_then_shelve_and_unshelve(self, boot_from_volume=False,60 cold_migrate=False):61 keypair = self.create_keypair()62 security_group = self.create_security_group()63 security_groups = [{'name': security_group['name']}]64 server = self.create_server(65 key_name=keypair['name'],66 security_groups=security_groups,67 volume_backed=boot_from_volume)68 instance_ip = self.get_server_ip(server)69 timestamp = self.create_timestamp(instance_ip,70 private_key=keypair['private_key'],71 server=server)72 # Prevent bug #1257594 from coming back73 # Unshelve used to boot the instance with the original image, not74 # with the instance snapshot75 self._shelve_then_unshelve_server(server)76 if cold_migrate:77 # Prevent bug #1732428 from coming back78 self._cold_migrate_server(server)79 timestamp2 = self.get_timestamp(instance_ip,80 private_key=keypair['private_key'],81 server=server)82 self.assertEqual(timestamp, timestamp2)83 @decorators.attr(type='slow')84 @decorators.idempotent_id('1164e700-0af0-4a4c-8792-35909a88743c')85 @testtools.skipUnless(CONF.network.public_network_id,86 'The public_network_id option must be specified.')87 @utils.services('compute', 'network', 'image')88 def test_shelve_instance(self):89 self._create_server_then_shelve_and_unshelve()90 @decorators.attr(type='slow')91 @decorators.idempotent_id('c1b6318c-b9da-490b-9c67-9339b627271f')92 @testtools.skipUnless(CONF.network.public_network_id,93 'The public_network_id option must be specified.')94 @utils.services('compute', 'volume', 'network', 'image')95 def test_shelve_volume_backed_instance(self):96 self._create_server_then_shelve_and_unshelve(boot_from_volume=True)97 @decorators.attr(type='slow')98 @decorators.idempotent_id('1295fd9e-193a-4cf8-b211-55358e021bae')99 @testtools.skipUnless(CONF.network.public_network_id,100 'The public_network_id option must be specified.')101 @testtools.skipUnless(CONF.compute_feature_enabled.cold_migration,102 'Cold migration not available.')103 @testtools.skipUnless(CONF.compute_feature_enabled.shelve_migrate,104 'Shelve migrate not available.')105 @testtools.skipUnless(CONF.compute.min_compute_nodes > 1,106 'Less than 2 compute nodes, skipping multinode '107 'tests.')108 @utils.services('compute', 'network', 'image')109 def test_cold_migrate_unshelved_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!!