summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2011-11-16 21:33:48 +0000
committerGerrit Code Review <review@openstack.org>2011-11-16 21:33:48 +0000
commit217af7df5980ee7a258d2e8b24aea4444c083201 (patch)
tree98d5bb48131e741d52a717e00837f49ced16def4 /nova/tests
parent7c34941b89437e69037be4ea392885c914c227ce (diff)
parent1dba0cdc332e54162dc1d880e80deca968dbff4e (diff)
Merge "Convert remaining calls to use instance objects"
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):