mock out build_instances/rebuild_instance when not used

Trying to close the gap on what could be causing issues
with races in the conductor tests that hit build/rebuild
instance.

Change-Id: If36ffc21192493c940df9f60beef9476fbd31f84
Partial-Bug: #1434161
This commit is contained in:
Matt Riedemann 2015-03-20 14:41:11 -07:00
parent 37a6c601f3
commit 97d049b977
1 changed files with 12 additions and 0 deletions

View File

@ -7282,6 +7282,18 @@ class ComputeAPITestCase(BaseTestCase):
self.fake_show = fake_show
# Mock out build_instances and rebuild_instance since nothing in these
# tests should need those to actually run. We do this to avoid
# possible races with other tests that actually test those methods
# and mock things out within them, like conductor tests.
self.build_instances_mock = mock.Mock(autospec=True)
self.compute_api.compute_task_api.build_instances = \
self.build_instances_mock
self.rebuild_instance_mock = mock.Mock(autospec=True)
self.compute_api.compute_task_api.rebuild_instance = \
self.rebuild_instance_mock
def _run_instance(self, params=None):
instance = self._create_fake_instance_obj(params, services=True)
instance_uuid = instance['uuid']