summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2012-07-26 14:16:24 +0100
committerMark McLoughlin <markmc@redhat.com>2012-07-26 16:53:17 +0100
commitac180dc10aa0ee7eb5e288f4d51cfe46bff33b2d (patch)
tree65f2450993bc88a70fef3708c1cf38fea86ecf05 /nova/tests
parent1dab66327368dab8271ee68db0c0bbb97c8d0555 (diff)
Remove return values from some compute RPC methods
The checks_instance_lock decorator currently discards any return value from the functions it wraps. Luckily, none of the callers of these functions check for a return value. Since the return values are unused, just remove them. Fixing the decorator to return them would effectively be a change to the RPC API. And since we know the return value is unused, we also know that nothing checks for the False return from checks_instance_lock() and that too can be removed. Change-Id: I8b49107dba51caf52665341e4977de179b6404f6
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/compute/test_compute.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index e2c736c54..030dab490 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -1041,17 +1041,24 @@ class ComputeTestCase(BaseTestCase):
None,
is_admin=False)
- # decorator should return False (fail) with locked nonadmin context
+ def check_task_state(task_state):
+ instance = db.instance_get_by_uuid(self.context, instance_uuid)
+ self.assertEqual(instance['task_state'], task_state)
+
+ db.instance_update(self.context, instance_uuid,
+ {'task_state': task_states.REBOOTING})
+
+ # should fail with locked nonadmin context, task_state won't be cleared
self.compute_api.lock(self.context, instance)
- ret_val = self.compute.reboot_instance(non_admin_context,
+ self.compute.reboot_instance(non_admin_context,
instance=jsonutils.to_primitive(instance))
- self.assertEqual(ret_val, False)
+ check_task_state(task_states.REBOOTING)
- # decorator should return None (success) with unlocked nonadmin context
+ # should succeed with unlocked nonadmin context, task_state cleared
self.compute_api.unlock(self.context, instance)
- ret_val = self.compute.reboot_instance(non_admin_context,
+ self.compute.reboot_instance(non_admin_context,
instance=jsonutils.to_primitive(instance))
- self.assertEqual(ret_val, None)
+ check_task_state(None)
self.compute.terminate_instance(self.context, instance_uuid)