diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-03-05 04:08:09 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-03-05 04:08:09 +0000 |
commit | 6072ddab97236fa488e78e6755e0167aea7ab710 (patch) | |
tree | a560df75bf7d6adc915af8b5871a5c33ddab6ce0 /nova/tests | |
parent | 71047567ee25bacf664f9b6387d9a5c53c63622e (diff) | |
parent | 5eed26fec4185dfcd8e9c1877a5a47068b0f3cc6 (diff) | |
download | nova-6072ddab97236fa488e78e6755e0167aea7ab710.tar.gz nova-6072ddab97236fa488e78e6755e0167aea7ab710.tar.xz nova-6072ddab97236fa488e78e6755e0167aea7ab710.zip |
Merge "Catching InstanceNotFound exception during reboot instance"
Diffstat (limited to 'nova/tests')
-rw-r--r-- | nova/tests/compute/test_compute.py | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 7869b76cc..7f85eee49 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -1085,7 +1085,7 @@ class ComputeTestCase(BaseTestCase): self.compute.terminate_instance(self.context, instance=jsonutils.to_primitive(instance)) - def _test_reboot(self, soft, legacy_nwinfo_driver): + def _test_reboot(self, soft, legacy_nwinfo_driver, test_delete=False): # This is a true unit test, so we don't need the network stubs. fake_network.unset_stub_network_methods(self.stubs) @@ -1164,13 +1164,24 @@ class ComputeTestCase(BaseTestCase): # Power state should be updated again self.compute._get_power_state(econtext, updated_instance1).AndReturn(fake_power_state2) - self.compute._instance_update(econtext, updated_instance1['uuid'], - power_state=fake_power_state2, - task_state=None, - vm_state=vm_states.ACTIVE).AndReturn(updated_instance2) - self.compute._notify_about_instance_usage(econtext, - updated_instance2, - 'reboot.end') + if test_delete: + self.compute._instance_update(econtext, updated_instance1['uuid'], + power_state=fake_power_state2, + task_state=None, + vm_state=vm_states.ACTIVE).AndRaise( + exception.InstanceNotFound( + instance_id=updated_instance1['uuid'])) + self.compute._notify_about_instance_usage(econtext, + updated_instance1, + 'reboot.end') + else: + self.compute._instance_update(econtext, updated_instance1['uuid'], + power_state=fake_power_state2, + task_state=None, + vm_state=vm_states.ACTIVE).AndReturn(updated_instance2) + self.compute._notify_about_instance_usage(econtext, + updated_instance2, + 'reboot.end') self.mox.ReplayAll() self.compute.reboot_instance(self.context, instance=instance, @@ -1181,9 +1192,15 @@ class ComputeTestCase(BaseTestCase): def test_reboot_soft(self): self._test_reboot(True, False) + def test_reboot_soft_and_delete(self): + self._test_reboot(True, False, True) + def test_reboot_hard(self): self._test_reboot(False, False) + def test_reboot_hard_and_delete(self): + self._test_reboot(False, False, True) + def test_reboot_soft_legacy_nwinfo_driver(self): self._test_reboot(True, True) |