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
This commit is contained in:
Martin Pavlasek 2014-04-15 17:15:15 +02:00
parent 3dd21f3320
commit 4c3f2ab56e
4 changed files with 32 additions and 2 deletions

View File

@ -571,6 +571,9 @@
# applies to user and project (string value)
#admin_domain_name = <None>
# ID of the default domain (string value)
#default_domain_id = default
[identity-feature-enabled]

View File

@ -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'])

View File

@ -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):

View File

@ -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',