Fix floating bug with osprofiler test

The failures of `test_profiler_init` test was quite high. The issue of
it relates to wrong mocking.

Change-Id: Id1bc1bd045c9b3340b474c54bc8945cb1d6937fa
This commit is contained in:
Andrey Kurilin 2017-07-06 14:50:41 +03:00
parent 95c356f944
commit a309674555

View File

@ -106,15 +106,18 @@ class OpenStackScenarioTestCase(test.TestCase):
("user", CREDENTIAL_WITHOUT_HMAC)], 0))
@ddt.unpack
@mock.patch("rally.plugins.openstack.scenario.profiler.init")
@mock.patch("rally.plugins.openstack.scenario.profiler.get")
def test_profiler_init(self, users_credentials,
expected_init_call_count,
expected_call_count,
mock_profiler_get,
mock_profiler_init):
for user, credential in users_credentials:
print(user, credential.profiler_hmac_key)
self.context.update({user: {"credential": credential}})
base_scenario.OpenStackScenario(self.context)
self.assertEqual(expected_init_call_count,
self.assertEqual(expected_call_count,
mock_profiler_init.call_count)
self.assertEqual([mock.call()] * expected_call_count,
mock_profiler_get.call_args_list)
def test__choose_user_random(self):
users = [{"credential": mock.Mock(), "tenant_id": "foo"}