summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2011-11-29 20:57:13 +0000
committerGerrit Code Review <review@openstack.org>2011-11-29 20:57:13 +0000
commit80d832b39b937e41685b6ae3f6c4e06238b80d6d (patch)
tree566892a682282d67885f0db329d4b7a1d3385b4e /nova/tests
parentf1deb8dbd48f936c2e1c2b1c0b5feb63e7da4be2 (diff)
parent41d674e9c562e82bf7e5f23ab09de43e2c565ef7 (diff)
Merge "reboot & rebuild to use uuids in compute manager"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_compute.py39
1 files changed, 30 insertions, 9 deletions
diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py
index 558b27c2a..02c8698cb 100644
--- a/nova/tests/test_compute.py
+++ b/nova/tests/test_compute.py
@@ -335,15 +335,28 @@ class ComputeTestCase(BaseTestCase):
self.compute.resume_instance(self.context, instance_uuid)
self.compute.terminate_instance(self.context, instance_id)
+ def test_rebuild(self):
+ """Ensure instance can be rebuilt"""
+ instance = self._create_fake_instance()
+ instance_id = instance['id']
+ instance_uuid = instance['uuid']
+
+ self.compute.run_instance(self.context, instance_id)
+ self.compute.rebuild_instance(self.context, instance_uuid)
+ self.compute.terminate_instance(self.context, instance_id)
+
def test_reboot_soft(self):
"""Ensure instance can be soft rebooted"""
- instance_id = self._create_instance()
+ instance = self._create_fake_instance()
+ instance_id = instance['id']
+ instance_uuid = instance['uuid']
+
self.compute.run_instance(self.context, instance_id)
db.instance_update(self.context, instance_id,
{'task_state': task_states.REBOOTING})
reboot_type = "SOFT"
- self.compute.reboot_instance(self.context, instance_id, reboot_type)
+ self.compute.reboot_instance(self.context, instance_uuid, reboot_type)
inst_ref = db.instance_get(self.context, instance_id)
self.assertEqual(inst_ref['power_state'], power_state.RUNNING)
@@ -353,13 +366,16 @@ class ComputeTestCase(BaseTestCase):
def test_reboot_hard(self):
"""Ensure instance can be hard rebooted"""
- instance_id = self._create_instance()
+ instance = self._create_fake_instance()
+ instance_id = instance['id']
+ instance_uuid = instance['uuid']
+
self.compute.run_instance(self.context, instance_id)
db.instance_update(self.context, instance_id,
{'task_state': task_states.REBOOTING_HARD})
reboot_type = "HARD"
- self.compute.reboot_instance(self.context, instance_id, reboot_type)
+ self.compute.reboot_instance(self.context, instance_uuid, reboot_type)
inst_ref = db.instance_get(self.context, instance_id)
self.assertEqual(inst_ref['power_state'], power_state.RUNNING)
@@ -663,12 +679,14 @@ class ComputeTestCase(BaseTestCase):
# decorator should return False (fail) with locked nonadmin context
self.compute.lock_instance(self.context, instance_uuid)
- ret_val = self.compute.reboot_instance(non_admin_context, instance_id)
+ ret_val = self.compute.reboot_instance(non_admin_context,
+ instance_uuid)
self.assertEqual(ret_val, False)
# decorator should return None (success) with unlocked nonadmin context
self.compute.unlock_instance(self.context, instance_uuid)
- ret_val = self.compute.reboot_instance(non_admin_context, instance_id)
+ ret_val = self.compute.reboot_instance(non_admin_context,
+ instance_uuid)
self.assertEqual(ret_val, None)
self.compute.terminate_instance(self.context, instance_id)
@@ -1351,7 +1369,8 @@ class ComputeAPITestCase(BaseTestCase):
db.instance_destroy(self.context, instance_id)
def test_rebuild(self):
- instance_id = self._create_instance()
+ inst_ref = self._create_fake_instance()
+ instance_id = inst_ref['id']
self.compute.run_instance(self.context, instance_id)
instance = db.instance_get(self.context, instance_id)
@@ -1368,7 +1387,8 @@ class ComputeAPITestCase(BaseTestCase):
def test_reboot_soft(self):
"""Ensure instance can be soft rebooted"""
- instance_id = self._create_instance()
+ inst_ref = self._create_fake_instance()
+ instance_id = inst_ref['id']
self.compute.run_instance(self.context, instance_id)
inst_ref = db.instance_get(self.context, instance_id)
@@ -1384,7 +1404,8 @@ class ComputeAPITestCase(BaseTestCase):
def test_reboot_hard(self):
"""Ensure instance can be hard rebooted"""
- instance_id = self._create_instance()
+ inst_ref = self._create_fake_instance()
+ instance_id = inst_ref['id']
self.compute.run_instance(self.context, instance_id)
inst_ref = db.instance_get(self.context, instance_id)