From 4c3f2ab56eba799e92e13c103a6cb374efe21f0b Mon Sep 17 00:00:00 2001 From: Martin Pavlasek Date: Tue, 15 Apr 2014 17:15:15 +0200 Subject: [PATCH] Added test of default domain in Keystone Default domain is part of Keystone APIv3 domains feature added in Grizzly backward compatibility for APIv2 which is not aware of domain concept. Summary of scope this change: * added new variable 'default_domain_id' in tempest.conf (default value 'default') * new test: default domain must exists (backward compatibility) Change-Id: Ib77d259e2f377ff19e2cf40fa164f42c0669ea56 --- etc/tempest.conf.sample | 3 +++ tempest/api/identity/admin/v3/test_domains.py | 22 +++++++++++++++++-- tempest/api/identity/base.py | 6 +++++ tempest/config.py | 3 +++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample index 5b15c5ee34..06365a6e8e 100644 --- a/etc/tempest.conf.sample +++ b/etc/tempest.conf.sample @@ -571,6 +571,9 @@ # applies to user and project (string value) #admin_domain_name = +# ID of the default domain (string value) +#default_domain_id = default + [identity-feature-enabled] diff --git a/tempest/api/identity/admin/v3/test_domains.py b/tempest/api/identity/admin/v3/test_domains.py index 79943bb1ae..b775e9199a 100644 --- a/tempest/api/identity/admin/v3/test_domains.py +++ b/tempest/api/identity/admin/v3/test_domains.py @@ -13,10 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. +from tempest.api.identity import base +from tempest import config +from tempest import test + from tempest_lib.common.utils import data_utils -from tempest.api.identity import base -from tempest import test +CONF = config.CONF class DomainsTestJSON(base.BaseIdentityV3AdminTest): @@ -105,3 +108,18 @@ class DomainsTestJSON(base.BaseIdentityV3AdminTest): expected_data = {'name': d_name, 'enabled': True} self.assertIsNone(domain['description']) self.assertDictContainsSubset(expected_data, domain) + + +class DefaultDomainTestJSON(base.BaseIdentityV3AdminTest): + + @classmethod + def resource_setup(cls): + cls.domain_id = CONF.identity.default_domain_id + super(DefaultDomainTestJSON, cls).resource_setup() + + @test.attr(type='smoke') + @test.idempotent_id('17a5de24-e6a0-4e4a-a9ee-d85b6e5612b5') + def test_default_domain_exists(self): + domain = self.client.get_domain(self.domain_id) + + self.assertTrue(domain['enabled']) diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py index 878ff6d81f..913e807b42 100644 --- a/tempest/api/identity/base.py +++ b/tempest/api/identity/base.py @@ -172,6 +172,12 @@ class BaseIdentityV3AdminTest(BaseIdentityV3Test): if len(role) > 0: return role[0] + def delete_domain(self, domain_id): + # NOTE(mpavlase) It is necessary to disable the domain before deleting + # otherwise it raises Forbidden exception + self.client.update_domain(domain_id, enabled=False) + self.client.delete_domain(domain_id) + class DataGenerator(object): diff --git a/tempest/config.py b/tempest/config.py index bdbf9424f7..505b6dfd45 100644 --- a/tempest/config.py +++ b/tempest/config.py @@ -142,6 +142,9 @@ IdentityGroup = [ cfg.StrOpt('admin_domain_name', help="Admin domain name for authentication (Keystone V3)." "The same domain applies to user and project"), + cfg.StrOpt('default_domain_id', + default='default', + help="ID of the default domain"), ] identity_feature_group = cfg.OptGroup(name='identity-feature-enabled',