Best Python code snippet using tempest_python
test_server_actions.py
Source:test_server_actions.py
...163 server = self.client.show_server(rebuilt_server['id'])164 rebuilt_image_id = server['image']['id']165 self.assertEqual(new_image, rebuilt_image_id)166 self.client.start(self.server_id)167 def _test_resize_server_confirm(self, stop=False):168 # The server's RAM and disk space should be modified to that of169 # the provided flavor170 if stop:171 self.servers_client.stop(self.server_id)172 self.servers_client.wait_for_server_status(self.server_id,173 'SHUTOFF')174 self.client.resize(self.server_id, self.flavor_ref_alt)175 self.client.wait_for_server_status(self.server_id, 'VERIFY_RESIZE')176 self.client.confirm_resize(self.server_id)177 expected_status = 'SHUTOFF' if stop else 'ACTIVE'178 self.client.wait_for_server_status(self.server_id, expected_status)179 server = self.client.show_server(self.server_id)180 self.assertEqual(self.flavor_ref_alt, server['flavor']['id'])181 if stop:182 # NOTE(mriedem): tearDown requires the server to be started.183 self.client.start(self.server_id)184 # NOTE(jlk): Explicitly delete the server to get a new one for later185 # tests. Avoids resize down race issues.186 self.addCleanup(self.delete_server, self.server_id)187 @test.idempotent_id('1499262a-9328-4eda-9068-db1ac57498d2')188 @testtools.skipUnless(CONF.compute_feature_enabled.resize,189 'Resize not available.')190 def test_resize_server_confirm(self):191 self._test_resize_server_confirm(stop=False)192 @test.idempotent_id('138b131d-66df-48c9-a171-64f45eb92962')193 @testtools.skipUnless(CONF.compute_feature_enabled.resize,194 'Resize not available.')195 def test_resize_server_confirm_from_stopped(self):196 self._test_resize_server_confirm(stop=True)197 @test.idempotent_id('c03aab19-adb1-44f5-917d-c419577e9e68')198 @testtools.skipUnless(CONF.compute_feature_enabled.resize,199 'Resize not available.')200 def test_resize_server_revert(self):201 # The server's RAM and disk space should return to its original202 # values after a resize is reverted203 self.client.resize(self.server_id, self.flavor_ref_alt)204 self.client.wait_for_server_status(self.server_id, 'VERIFY_RESIZE')205 self.client.revert_resize(self.server_id)206 self.client.wait_for_server_status(self.server_id, 'ACTIVE')207 server = self.client.show_server(self.server_id)208 self.assertEqual(self.flavor_ref, server['flavor']['id'])209 @test.idempotent_id('b963d4f1-94b3-4c40-9e97-7b583f46e470')210 @testtools.skipUnless(CONF.compute_feature_enabled.snapshot,...
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!!