From 44c5bd28bbae1d3c5336dbcb45eb34c0def46dec Mon Sep 17 00:00:00 2001 From: Sergey Skripnick Date: Wed, 27 Apr 2016 15:12:48 +0200 Subject: [PATCH] Fix randomly failed unit test This test is calling cleanup method that uses publish/consume approach. Threads created by this method may be completed in any order and test is failing because of wrong order of calls. Fixed by ignoring order of calls. Change-Id: Id7344d1a52c0757184bf1793510fe60cc5a78ce2 --- tests/unit/plugins/openstack/context/keystone/test_roles.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/plugins/openstack/context/keystone/test_roles.py b/tests/unit/plugins/openstack/context/keystone/test_roles.py index 15f939a2..709a7cc9 100644 --- a/tests/unit/plugins/openstack/context/keystone/test_roles.py +++ b/tests/unit/plugins/openstack/context/keystone/test_roles.py @@ -117,7 +117,8 @@ class RoleGeneratorTestCase(test.TestCase): mock.call("u1", "r2", tenant="t1"), mock.call("u2", "r2", tenant="t2") ] - fc.keystone().roles.add_user_role.assert_has_calls(calls) + fc.keystone().roles.add_user_role.assert_has_calls(calls, + any_order=True) self.assertEqual( 4, fc.keystone().roles.add_user_role.call_count) self.assertEqual(