summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2011-11-09 20:22:22 +0000
committerGerrit Code Review <review@openstack.org>2011-11-09 20:22:22 +0000
commitcc3fe3f71da4f97d672e7acfb270913bf0940303 (patch)
treed33c70dba8cb18cf14de4695a0abeab6d535cf5e /nova/tests
parent814cb1acc3237e7a31b85b43015e46c87231ead7 (diff)
parentaf2acabe35f91d0bdd2b2c921f23d6828e480a20 (diff)
Merge "Converting rebuild to use instance objects."
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()