Mock out service availability check in unit test

The unit test test_get_all_host_states_share(),
testing host_manager's get_all_host_states_share()
function makes an unnecessary call to the manila/utils.py
function service_is_up(). This test fails sporadically
due to initialization problems with the fake data provided.

This patch mocks out the service availability check.
The service availability check already had its own
unit tests.

TrivialFix

Change-Id: I78090e86f5558d6b2192b0559445b7530380bcac
This commit is contained in:
Goutham Pacha Ravi 2015-12-22 11:27:32 +05:30
parent efdf04ead1
commit f4858a8310
1 changed files with 1 additions and 0 deletions

View File

@ -147,6 +147,7 @@ class HostManagerTestCase(test.TestCase):
self.mock_object(
db, 'service_get_all_by_topic',
mock.Mock(return_value=fakes.SHARE_SERVICES_WITH_POOLS))
self.mock_object(utils, 'service_is_up', mock.Mock(return_value=True))
with mock.patch.dict(self.host_manager.service_states,
fakes.SHARE_SERVICE_STATES_WITH_POOLS):