From f4858a8310fd523c90d8a0ce1e5fb0aa367d775b Mon Sep 17 00:00:00 2001 From: Goutham Pacha Ravi Date: Tue, 22 Dec 2015 11:27:32 +0530 Subject: [PATCH] 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 --- manila/tests/scheduler/test_host_manager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/manila/tests/scheduler/test_host_manager.py b/manila/tests/scheduler/test_host_manager.py index ca8529e7dd..d9cf3b8768 100644 --- a/manila/tests/scheduler/test_host_manager.py +++ b/manila/tests/scheduler/test_host_manager.py @@ -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):