Merge "Make ComputeTestCase.test_state_revert faster"

This commit is contained in:
Jenkins 2013-02-20 13:27:59 +00:00 committed by Gerrit Code Review
commit adfb9217fd

View File

@ -1787,13 +1787,11 @@ class ComputeTestCase(BaseTestCase):
self.compute.terminate_instance(self.context,
instance=jsonutils.to_primitive(instance))
def _test_state_revert(self, operation, pre_task_state,
def _test_state_revert(self, instance, operation, pre_task_state,
post_task_state=None, kwargs=None):
if kwargs is None:
kwargs = {}
instance = self._create_fake_instance()
# The API would have set task_state, so do that here to test
# that the state gets reverted on failure
db.instance_update(self.context, instance['uuid'],
@ -1863,8 +1861,9 @@ class ComputeTestCase(BaseTestCase):
("resume_instance", task_states.RESUMING),
]
instance = self._create_fake_instance()
for operation in actions:
self._test_state_revert(*operation)
self._test_state_revert(instance, *operation)
def _ensure_quota_reservations_committed(self):
"""Mock up commit of quota reservations."""