summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorBrian Waldon <brian.waldon@rackspace.com>2011-11-10 23:36:17 -0500
committerBrian Waldon <brian.waldon@rackspace.com>2011-11-16 13:03:12 -0800
commit1dba0cdc332e54162dc1d880e80deca968dbff4e (patch)
treec479c43014bbd5ca876152279867130168c206d6 /nova/tests
parent3278f4d72f369403395b745987d7e80330817e6a (diff)
Convert remaining calls to use instance objects
Related to blueprint internal-uuids. This touches get_diagnostics, get_actions, and restore. Change-Id: Ic4b3d9476fb53cb97b4ea75ad2e846374b2b4a41
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_compute.py33
1 files changed, 32 insertions, 1 deletions
diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py
index 69b998d68..4d0832e2a 100644
--- a/nova/tests/test_compute.py
+++ b/nova/tests/test_compute.py
@@ -1112,7 +1112,7 @@ class ComputeAPITestCase(BaseTestCase):
db.instance_destroy(self.context, instance_id)
def test_force_delete(self):
- """Ensure instance can be soft rebooted"""
+ """Ensure instance can be deleted after a soft delete"""
instance_id = self._create_instance()
self.compute.run_instance(self.context, instance_id)
@@ -1189,6 +1189,24 @@ class ComputeAPITestCase(BaseTestCase):
db.instance_destroy(self.context, instance_id)
+ def test_restore(self):
+ """Ensure instance can be restored from a soft delete"""
+ instance_id = self._create_instance()
+ self.compute.run_instance(self.context, instance_id)
+
+ instance = db.instance_get(self.context, instance_id)
+ self.compute_api.soft_delete(self.context, instance)
+
+ instance = db.instance_get(self.context, instance_id)
+ self.assertEqual(instance['task_state'], task_states.POWERING_OFF)
+
+ self.compute_api.restore(self.context, instance)
+
+ instance = db.instance_get(self.context, instance_id)
+ self.assertEqual(instance['task_state'], task_states.POWERING_ON)
+
+ db.instance_destroy(self.context, instance_id)
+
def test_rebuild(self):
instance_id = self._create_instance()
self.compute.run_instance(self.context, instance_id)
@@ -1980,6 +1998,7 @@ class ComputeAPITestCase(BaseTestCase):
instance = self.compute_api.get(self.context, instance_id)
self.compute_api.add_fixed_ip(self.context, instance, '1')
self.compute_api.remove_fixed_ip(self.context, instance, '192.168.1.1')
+ self.compute_api.delete(self.context, instance)
def test_attach_volume_invalid(self):
self.assertRaises(exception.ApiError,
@@ -2106,6 +2125,18 @@ class ComputeAPITestCase(BaseTestCase):
self.compute_api.remove_security_group(self.context,
instance,
security_group_name)
+
+ def test_get_diagnostics(self):
+ instance_id = self._create_instance()
+ instance = self.compute_api.get(self.context, instance_id)
+ self.compute_api.get_diagnostics(self.context, instance)
+ self.compute_api.delete(self.context, instance)
+
+ def test_get_actions(self):
+ context = self.context.elevated()
+ instance_id = self._create_instance()
+ instance = self.compute_api.get(self.context, instance_id)
+ self.compute_api.get_actions(context, instance)
self.compute_api.delete(self.context, instance)
def test_inject_file(self):