summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_compute.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py
index 29dc99dd7..08c2dfbb3 100644
--- a/nova/tests/test_compute.py
+++ b/nova/tests/test_compute.py
@@ -343,6 +343,22 @@ class ComputeTestCase(test.TestCase):
self.compute.resume_instance(self.context, instance_id)
self.compute.terminate_instance(self.context, instance_id)
+ def test_rebuild(self):
+ instance_id = self._create_instance()
+ self.compute.run_instance(self.context, instance_id)
+
+ instance = db.instance_get(self.context, instance_id)
+ self.assertEqual(instance['task_state'], None)
+
+ image_ref = instance["image_ref"]
+ password = "new_password"
+ self.compute_api.rebuild(self.context, instance, image_ref, password)
+
+ instance = db.instance_get(self.context, instance_id)
+ self.assertEqual(instance['task_state'], task_states.REBUILDING)
+
+ db.instance_destroy(self.context, instance_id)
+
def test_reboot_soft_api(self):
"""Ensure instance can be soft rebooted"""
instance_id = self._create_instance()