From 70b874d94e79d752b2f9701b8121edab59f44b8f Mon Sep 17 00:00:00 2001 From: Julia Varlamova Date: Wed, 29 Oct 2014 13:14:45 +0400 Subject: [PATCH] Fix concurrency issue in security-service tempest test Tempest test 'test_list_security_services_detailed_filter_by_ss_attributes' is used by two modules: tempest.api.share.test_security_services tempest.api.share.admin.test_security_services. And when both of them are running at a time, they interfere with each other. That causes mismatch error - we expect 1 security service to be listed, but get 2. Remove check if length of returned list is equals to 1. Add check if all returned security services satisfy filtering opts. Change-Id: Ia78549209f38a8272743b1edfd2172a53ef59197 Closes-bug: #1386619 --- .../tempest/api/share/test_security_services.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/tempest/tempest/api/share/test_security_services.py b/contrib/tempest/tempest/api/share/test_security_services.py index 45a1ae7660..0fec0cbf5f 100644 --- a/contrib/tempest/tempest/api/share/test_security_services.py +++ b/contrib/tempest/tempest/api/share/test_security_services.py @@ -80,7 +80,7 @@ class SecurityServiceListMixin(object): [self.assertIn(key, s_s.keys()) for s_s in listed for key in keys] @test.attr(type=["gate", "smoke"]) - def test_list_security_services_filter_by_ss_attributes(self): + def test_list_security_services_detailed_filter_by_ss_attributes(self): search_opts = { 'status': 'NEW', 'name': 'ss_ldap', @@ -91,12 +91,12 @@ class SecurityServiceListMixin(object): 'domain': 'fake_domain_1', } resp, listed = self.shares_client.list_security_services( + detailed=True, params=search_opts) - self.assertEqual(1, len(listed)) - self.assertEqual(self.ss_ldap['id'], listed[0]['id']) - - keys = ["name", "id", "status", "type", ] - [self.assertIn(key, s_s.keys()) for s_s in listed for key in keys] + self.assertTrue(any(self.ss_ldap['id'] == ss['id'] for ss in listed)) + for ss in listed: + self.assertTrue(all(ss[key] == value for key, value + in six.iteritems(search_opts))) class SecurityServicesTest(base.BaseSharesTest,