summaryrefslogtreecommitdiffstats
path: root/nova/tests/compute/test_compute.py
diff options
context:
space:
mode:
Diffstat (limited to 'nova/tests/compute/test_compute.py')
-rw-r--r--nova/tests/compute/test_compute.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index 4fbf805f1..90e3f7f32 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -1201,9 +1201,7 @@ class ComputeTestCase(BaseTestCase):
self.compute._deallocate_network(mox.IgnoreArg(), mox.IgnoreArg())
self.mox.ReplayAll()
- self.assertRaises(exception.InstanceNotFound,
- self.compute.run_instance,
- self.context, instance=instance)
+ self.compute.run_instance(self.context, instance=instance)
def test_run_instance_bails_on_missing_instance(self):
# Make sure that run_instance() will quickly ignore a deleted instance
@@ -2056,6 +2054,24 @@ class ComputeTestCase(BaseTestCase):
self._assert_state({'task_state': None})
self.compute.terminate_instance(self.context, instance=instance)
+ def test_snapshot_handles_cases_when_instance_is_deleted(self):
+ instance = jsonutils.to_primitive(self._create_fake_instance(
+ {'vm_state': 'deleting'}))
+ self.compute.run_instance(self.context, instance=instance)
+ db.instance_update(self.context, instance['uuid'],
+ {"task_state": task_states.DELETING})
+ self.compute.snapshot_instance(self.context, "failing_snapshot",
+ instance=instance)
+ self.compute.terminate_instance(self.context, instance=instance)
+
+ def test_snapshot_handles_cases_when_instance_is_not_found(self):
+ instance = jsonutils.to_primitive(self._create_fake_instance(
+ {'vm_state': 'deleting'}))
+ instance["uuid"] = str(uuid.uuid4())
+ self.compute.snapshot_instance(self.context, "failing_snapshot",
+ instance=instance)
+ self.compute.terminate_instance(self.context, instance=instance)
+
def _assert_state(self, state_dict):
"""Assert state of VM is equal to state passed as parameter."""
instances = db.instance_get_all(self.context)