From ea5efd5c3515b692cc0fce9e0b12f741db44aeeb Mon Sep 17 00:00:00 2001 From: Ghanshyam Mann Date: Tue, 12 Mar 2019 18:09:26 +0000 Subject: [PATCH] Use credentials domain instead of creating new one test_list_projects tests create a new domain and try to test the list projects operation based on new domain-id. Keystone is implementing the domain roles functionality for projects resource - https://review.openstack.org/#/c/624218/ Which means listing the projects with authorized domain only. This commit modify the tests to use the same domain as requester and create project with that domain only not new one. Also add the debug log. Change-Id: I401815b4a0d3f7ad90801d5580897be870d33013 --- tempest/api/identity/admin/v3/test_list_projects.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tempest/api/identity/admin/v3/test_list_projects.py b/tempest/api/identity/admin/v3/test_list_projects.py index 50f3186f65..299a61835b 100644 --- a/tempest/api/identity/admin/v3/test_list_projects.py +++ b/tempest/api/identity/admin/v3/test_list_projects.py @@ -13,11 +13,14 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from tempest.api.identity import base from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators +LOG = logging.getLogger(__name__) CONF = config.CONF @@ -26,6 +29,9 @@ class BaseListProjectsTestJSON(base.BaseIdentityV3AdminTest): def _list_projects_with_params(self, included, excluded, params, key): # Validate that projects in ``included`` belongs to the projects # returned that match ``params`` but not projects in ``excluded`` + all_projects = self.projects_client.list_projects()['projects'] + LOG.debug("Complete list of projects available in keystone: %s", + all_projects) body = self.projects_client.list_projects(params)['projects'] for p in included: self.assertIn(p[key], map(lambda x: x[key], body)) @@ -39,13 +45,12 @@ class ListProjectsTestJSON(BaseListProjectsTestJSON): def resource_setup(cls): super(ListProjectsTestJSON, cls).resource_setup() cls.project_ids = list() - # Create a domain - cls.domain = cls.create_domain() + cls.domain_id = cls.os_admin.credentials.domain_id # Create project with domain cls.p1_name = data_utils.rand_name('project') cls.p1 = cls.projects_client.create_project( cls.p1_name, enabled=False, - domain_id=cls.domain['id'])['project'] + domain_id=cls.domain_id)['project'] cls.addClassResourceCleanup(cls.projects_client.delete_project, cls.p1['id']) cls.project_ids.append(cls.p1['id'])