How to use _unshelve_server method in tempest

Best Python code snippet using tempest_python

test_bug_1835822.py

Source:test_bug_1835822.py Github

copy

Full Screen

...67 def _shelve_server(self, active_server):68 self.api.post_server_action(active_server['id'], {'shelve': {}})69 return self._wait_for_state_change(70 self.api, active_server, 'SHELVED_OFFLOADED')71 def _unshelve_server(self, shelved_server):72 self.api.post_server_action(shelved_server['id'], {'unshelve': {}})73 return self._wait_for_state_change(self.api, shelved_server, 'ACTIVE')74 # ---------------------------- tests ----------------------------75 def test_create_server_with_config_drive(self):76 """Verify that we can create a server with a config drive.77 """78 active_server = self._create_active_server(79 server_args={'config_drive': True})80 self.assertTrue(active_server['config_drive'])81 def test_create_server_without_config_drive(self):82 """Verify that we can create a server without83 a config drive.84 """85 self.flags(force_config_drive=False)86 active_server = self._create_active_server()87 self.assertEqual('', active_server['config_drive'])88 def test_create_server_with_forced_config_drive(self):89 """Verify that we can create a server with a forced90 config drive.91 """92 self.flags(force_config_drive=True)93 active_server = self._create_active_server()94 self.assertTrue(active_server['config_drive'])95 def test_create_server_with_forced_config_drive_reboot(self):96 """Verify that we can create a server with a forced97 config drive and it survives reboot.98 """99 self.flags(force_config_drive=True)100 active_server = self._create_active_server()101 self.assertTrue(active_server['config_drive'])102 active_server = self._hard_reboot_server(active_server)103 self.assertTrue(active_server['config_drive'])104 def test_create_server_config_drive_reboot_after_conf_change(self):105 """Verify that we can create a server with or without a forced106 config drive it does not change across a reboot.107 """108 # NOTE(sean-k-mooney): we do not need to restart the compute109 # service because of the way self.flags overrides the config110 # values.111 self.flags(force_config_drive=True)112 with_config_drive = self._create_active_server()113 self.assertTrue(with_config_drive['config_drive'])114 self.flags(force_config_drive=False)115 without_config_drive = self._create_active_server()116 self.assertEqual('', without_config_drive['config_drive'])117 # this server was created with force_config_drive=true118 # so assert now that force_config_drive is false it does119 # not override the value it was booted with.120 with_config_drive = self._hard_reboot_server(with_config_drive)121 self.assertTrue(with_config_drive['config_drive'])122 # this server was booted with force_config_drive=False so123 # assert that it's config drive setting is not overridden124 self.flags(force_config_drive=True)125 without_config_drive = self._hard_reboot_server(without_config_drive)126 self.assertEqual('', without_config_drive['config_drive'])127 def test_create_server_config_drive_rebuild_after_conf_change(self):128 """Verify that we can create a server with or without a forced129 config drive it does not change across a rebuild.130 """131 self.flags(force_config_drive=True)132 with_config_drive = self._create_active_server()133 self.assertTrue(with_config_drive['config_drive'])134 self.flags(force_config_drive=False)135 without_config_drive = self._create_active_server()136 self.assertEqual('', without_config_drive['config_drive'])137 # this server was created with force_config_drive=true138 # so assert now that force_config_drive is false it does139 # not override the value it was booted with.140 with_config_drive = self._rebuild_server(with_config_drive)141 self.assertTrue(with_config_drive['config_drive'])142 # this server was booted with force_config_drive=False so143 # assert that it's config drive setting is not overridden144 self.flags(force_config_drive=True)145 without_config_drive = self._rebuild_server(without_config_drive)146 self.assertEqual('', without_config_drive['config_drive'])147 def test_create_server_config_drive_shelve_unshelve_conf_change(self):148 """Verify that we can create a server with or without a forced149 config drive it does not change across a shelve and unshelve.150 """151 self.flags(force_config_drive=True)152 with_config_drive = self._create_active_server()153 self.assertTrue(with_config_drive['config_drive'])154 self.flags(force_config_drive=False)155 without_config_drive = self._create_active_server()156 self.assertEqual('', without_config_drive['config_drive'])157 # this server was created with force_config_drive=true158 # so assert now that force_config_drive is false it does159 # not override the value it was booted with.160 with_config_drive = self._shelve_server(with_config_drive)161 with_config_drive = self._unshelve_server(with_config_drive)162 self.assertTrue(with_config_drive['config_drive'])163 # this server was booted with force_config_drive=False so164 # assert that it's config drive setting is not overridden165 self.flags(force_config_drive=True)166 without_config_drive = self._shelve_server(without_config_drive)167 without_config_drive = self._unshelve_server(without_config_drive)...

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