Merge "tests: Drop support for testing identity v2"
This commit is contained in:
commit
108545a692
@ -83,10 +83,6 @@ class BaseFunctionalTest(base.TestCase):
|
||||
|
||||
self._set_operator_cloud()
|
||||
|
||||
self.identity_version = self.user_cloud.config.get_api_version(
|
||||
'identity'
|
||||
)
|
||||
|
||||
self.flavor = self._pick_flavor()
|
||||
self.image = self._pick_image()
|
||||
|
||||
@ -301,12 +297,7 @@ class KeystoneBaseFunctionalTest(BaseFunctionalTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
use_keystone_v2 = os.environ.get('OPENSTACKSDK_USE_KEYSTONE_V2', False)
|
||||
if use_keystone_v2:
|
||||
# keystone v2 has special behavior for the admin
|
||||
# interface and some of the operations, so make a new cloud
|
||||
# object with interface set to admin.
|
||||
# We only do it for keystone tests on v2 because otherwise
|
||||
# the admin interface is not a thing that wants to actually
|
||||
# be used
|
||||
self._set_operator_cloud(interface='admin')
|
||||
# we only support v3, since v2 was deprecated in Queens (2018)
|
||||
|
||||
if not self.conn.has_service('identity', '3'):
|
||||
self.skipTest('identity service not supported by cloud')
|
||||
|
@ -21,14 +21,13 @@ from openstack import exceptions
|
||||
from openstack.tests.functional import base
|
||||
|
||||
|
||||
class TestDomain(base.BaseFunctionalTest):
|
||||
class TestDomain(base.KeystoneBaseFunctionalTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
if not self.operator_cloud:
|
||||
self.skipTest("Operator cloud is required for this test")
|
||||
i_ver = self.operator_cloud.config.get_api_version('identity')
|
||||
if i_ver in ('2', '2.0'):
|
||||
self.skipTest('Identity service does not support domains')
|
||||
|
||||
self.domain_prefix = self.getUniqueString('domain')
|
||||
self.addCleanup(self._cleanup_domains)
|
||||
|
||||
|
@ -22,7 +22,6 @@ Functional tests for endpoint resource.
|
||||
import random
|
||||
import string
|
||||
|
||||
from openstack.cloud.exc import OpenStackCloudUnavailableFeature
|
||||
from openstack import exceptions
|
||||
from openstack.tests.functional import base
|
||||
|
||||
@ -39,6 +38,7 @@ class TestEndpoints(base.KeystoneBaseFunctionalTest):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
if not self.operator_cloud:
|
||||
self.skipTest("Operator cloud is required for this test")
|
||||
|
||||
@ -117,15 +117,6 @@ class TestEndpoints(base.KeystoneBaseFunctionalTest):
|
||||
self.assertIsNotNone(endpoints[0].get('id'))
|
||||
|
||||
def test_update_endpoint(self):
|
||||
ver = self.operator_cloud.config.get_api_version('identity')
|
||||
if ver.startswith('2'):
|
||||
# NOTE(SamYaple): Update endpoint only works with v3 api
|
||||
self.assertRaises(
|
||||
OpenStackCloudUnavailableFeature,
|
||||
self.operator_cloud.update_endpoint,
|
||||
'endpoint_id1',
|
||||
)
|
||||
else:
|
||||
# service operations require existing region. Do not test updating
|
||||
# region for now
|
||||
region = list(self.operator_cloud.identity.regions())[0].id
|
||||
|
@ -21,15 +21,13 @@ from openstack import exceptions
|
||||
from openstack.tests.functional import base
|
||||
|
||||
|
||||
class TestGroup(base.BaseFunctionalTest):
|
||||
class TestGroup(base.KeystoneBaseFunctionalTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
if not self.operator_cloud:
|
||||
self.skipTest("Operator cloud is required for this test")
|
||||
|
||||
i_ver = self.operator_cloud.config.get_api_version('identity')
|
||||
if i_ver in ('2', '2.0'):
|
||||
self.skipTest('Identity service does not support groups')
|
||||
self.group_prefix = self.getUniqueString('group')
|
||||
self.addCleanup(self._cleanup_groups)
|
||||
|
||||
|
@ -28,6 +28,7 @@ from openstack.tests.functional import base
|
||||
class TestProject(base.KeystoneBaseFunctionalTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
if not self.operator_cloud:
|
||||
self.skipTest("Operator cloud is required for this test")
|
||||
|
||||
@ -52,11 +53,8 @@ class TestProject(base.KeystoneBaseFunctionalTest):
|
||||
params = {
|
||||
'name': project_name,
|
||||
'description': 'test_create_project',
|
||||
'domain_id': self.operator_cloud.get_domain('default')['id'],
|
||||
}
|
||||
if self.identity_version == '3':
|
||||
params['domain_id'] = self.operator_cloud.get_domain('default')[
|
||||
'id'
|
||||
]
|
||||
|
||||
project = self.operator_cloud.create_project(**params)
|
||||
|
||||
@ -94,11 +92,8 @@ class TestProject(base.KeystoneBaseFunctionalTest):
|
||||
'name': project_name,
|
||||
'description': 'test_update_project',
|
||||
'enabled': True,
|
||||
'domain_id': self.operator_cloud.get_domain('default')['id'],
|
||||
}
|
||||
if self.identity_version == '3':
|
||||
params['domain_id'] = self.operator_cloud.get_domain('default')[
|
||||
'id'
|
||||
]
|
||||
|
||||
project = self.operator_cloud.create_project(**params)
|
||||
updated_project = self.operator_cloud.update_project(
|
||||
@ -126,11 +121,10 @@ class TestProject(base.KeystoneBaseFunctionalTest):
|
||||
|
||||
def test_delete_project(self):
|
||||
project_name = self.new_project_name + '_delete'
|
||||
params = {'name': project_name}
|
||||
if self.identity_version == '3':
|
||||
params['domain_id'] = self.operator_cloud.get_domain('default')[
|
||||
'id'
|
||||
]
|
||||
params = {
|
||||
'name': project_name,
|
||||
'domain_id': self.operator_cloud.get_domain('default')['id'],
|
||||
}
|
||||
project = self.operator_cloud.create_project(**params)
|
||||
self.assertIsNotNone(project)
|
||||
self.assertTrue(self.operator_cloud.delete_project(project['id']))
|
||||
|
@ -11,10 +11,10 @@
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
test_identity
|
||||
test_roles
|
||||
----------------------------------
|
||||
|
||||
Functional tests for identity methods.
|
||||
Functional tests for role methods.
|
||||
"""
|
||||
|
||||
import random
|
||||
@ -24,11 +24,13 @@ from openstack import exceptions
|
||||
from openstack.tests.functional import base
|
||||
|
||||
|
||||
class TestIdentity(base.KeystoneBaseFunctionalTest):
|
||||
class TestRoles(base.KeystoneBaseFunctionalTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
if not self.operator_cloud:
|
||||
self.skipTest("Operator cloud is required for this test")
|
||||
|
||||
self.role_prefix = 'test_role' + ''.join(
|
||||
random.choice(string.ascii_lowercase) for _ in range(5)
|
||||
)
|
||||
@ -36,7 +38,6 @@ class TestIdentity(base.KeystoneBaseFunctionalTest):
|
||||
self.group_prefix = self.getUniqueString('group')
|
||||
|
||||
self.addCleanup(self._cleanup_users)
|
||||
if self.identity_version not in ('2', '2.0'):
|
||||
self.addCleanup(self._cleanup_groups)
|
||||
self.addCleanup(self._cleanup_roles)
|
||||
|
||||
@ -82,11 +83,10 @@ class TestIdentity(base.KeystoneBaseFunctionalTest):
|
||||
raise exceptions.SDKException('\n'.join(exception_list))
|
||||
|
||||
def _create_user(self, **kwargs):
|
||||
domain_id = None
|
||||
if self.identity_version not in ('2', '2.0'):
|
||||
domain = self.operator_cloud.get_domain('default')
|
||||
domain_id = domain['id']
|
||||
return self.operator_cloud.create_user(domain_id=domain_id, **kwargs)
|
||||
return self.operator_cloud.create_user(
|
||||
domain_id=domain['id'], **kwargs
|
||||
)
|
||||
|
||||
def test_list_roles(self):
|
||||
roles = self.operator_cloud.list_roles()
|
||||
@ -124,8 +124,6 @@ class TestIdentity(base.KeystoneBaseFunctionalTest):
|
||||
# need to make this test a little more specific, and add more for testing
|
||||
# filtering functionality.
|
||||
def test_list_role_assignments(self):
|
||||
if self.identity_version in ('2', '2.0'):
|
||||
self.skipTest("Identity service does not support role assignments")
|
||||
assignments = self.operator_cloud.list_role_assignments()
|
||||
self.assertIsInstance(assignments, list)
|
||||
self.assertGreater(len(assignments), 0)
|
||||
@ -177,8 +175,6 @@ class TestIdentity(base.KeystoneBaseFunctionalTest):
|
||||
self.assertEqual(0, len(assignments))
|
||||
|
||||
def test_grant_revoke_role_group_project(self):
|
||||
if self.identity_version in ('2', '2.0'):
|
||||
self.skipTest("Identity service does not support group")
|
||||
role_name = self.role_prefix + '_grant_group_project'
|
||||
role = self.operator_cloud.create_role(role_name)
|
||||
group_name = self.group_prefix + '_group_project'
|
||||
@ -215,8 +211,6 @@ class TestIdentity(base.KeystoneBaseFunctionalTest):
|
||||
self.assertEqual(0, len(assignments))
|
||||
|
||||
def test_grant_revoke_role_user_domain(self):
|
||||
if self.identity_version in ('2', '2.0'):
|
||||
self.skipTest("Identity service does not support domain")
|
||||
role_name = self.role_prefix + '_grant_user_domain'
|
||||
role = self.operator_cloud.create_role(role_name)
|
||||
user_name = self.user_prefix + '_user_domain'
|
||||
@ -254,8 +248,6 @@ class TestIdentity(base.KeystoneBaseFunctionalTest):
|
||||
self.assertEqual(0, len(assignments))
|
||||
|
||||
def test_grant_revoke_role_group_domain(self):
|
||||
if self.identity_version in ('2', '2.0'):
|
||||
self.skipTest("Identity service does not support domain or group")
|
||||
role_name = self.role_prefix + '_grant_group_domain'
|
||||
role = self.operator_cloud.create_role(role_name)
|
||||
group_name = self.group_prefix + '_group_domain'
|
||||
@ -321,8 +313,6 @@ class TestIdentity(base.KeystoneBaseFunctionalTest):
|
||||
self.assertEqual(0, len(assignments))
|
||||
|
||||
def test_grant_revoke_role_group_system(self):
|
||||
if self.identity_version in ('2', '2.0'):
|
||||
self.skipTest("Identity service does not support system or group")
|
||||
role_name = self.role_prefix + '_grant_group_system'
|
||||
role = self.operator_cloud.create_role(role_name)
|
||||
group_name = self.group_prefix + '_group_system'
|
@ -22,7 +22,6 @@ Functional tests for service resource.
|
||||
import random
|
||||
import string
|
||||
|
||||
from openstack.cloud import exc
|
||||
from openstack import exceptions
|
||||
from openstack.tests.functional import base
|
||||
|
||||
@ -68,16 +67,6 @@ class TestServices(base.KeystoneBaseFunctionalTest):
|
||||
self.assertIsNotNone(service.get('id'))
|
||||
|
||||
def test_update_service(self):
|
||||
ver = self.operator_cloud.config.get_api_version('identity')
|
||||
if ver.startswith('2'):
|
||||
# NOTE(SamYaple): Update service only works with v3 api
|
||||
self.assertRaises(
|
||||
exc.OpenStackCloudUnavailableFeature,
|
||||
self.operator_cloud.update_service,
|
||||
'service_id',
|
||||
name='new name',
|
||||
)
|
||||
else:
|
||||
service = self.operator_cloud.create_service(
|
||||
name=self.new_service_name + '_create',
|
||||
type='test_type',
|
||||
@ -90,9 +79,7 @@ class TestServices(base.KeystoneBaseFunctionalTest):
|
||||
description='this is an updated description',
|
||||
enabled=False,
|
||||
)
|
||||
self.assertEqual(
|
||||
new_service.name, self.new_service_name + '_update'
|
||||
)
|
||||
self.assertEqual(new_service.name, self.new_service_name + '_update')
|
||||
self.assertEqual(
|
||||
new_service.description, 'this is an updated description'
|
||||
)
|
||||
|
@ -44,12 +44,10 @@ class TestUsers(base.KeystoneBaseFunctionalTest):
|
||||
raise exceptions.SDKException('\n'.join(exception_list))
|
||||
|
||||
def _create_user(self, **kwargs):
|
||||
domain_id = None
|
||||
i_ver = self.operator_cloud.config.get_api_version('identity')
|
||||
if i_ver not in ('2', '2.0'):
|
||||
domain = self.operator_cloud.get_domain('default')
|
||||
domain_id = domain['id']
|
||||
return self.operator_cloud.create_user(domain_id=domain_id, **kwargs)
|
||||
return self.operator_cloud.create_user(
|
||||
domain_id=domain['id'], **kwargs
|
||||
)
|
||||
|
||||
def test_list_users(self):
|
||||
users = self.operator_cloud.list_users()
|
||||
@ -154,10 +152,6 @@ class TestUsers(base.KeystoneBaseFunctionalTest):
|
||||
self.assertIsNotNone(new_cloud.service_catalog)
|
||||
|
||||
def test_users_and_groups(self):
|
||||
i_ver = self.operator_cloud.config.get_api_version('identity')
|
||||
if i_ver in ('2', '2.0'):
|
||||
self.skipTest('Identity service does not support groups')
|
||||
|
||||
group_name = self.getUniqueString('group')
|
||||
self.addCleanup(self.operator_cloud.delete_group, group_name)
|
||||
|
||||
|
@ -20,8 +20,10 @@ class TestAutoAllocatedTopology(base.BaseFunctionalTest):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
if not self.operator_cloud:
|
||||
self.skipTest("Operator cloud is required for this test")
|
||||
|
||||
if not self.operator_cloud._has_neutron_extension(
|
||||
"auto-allocated-topology"
|
||||
):
|
||||
@ -55,11 +57,8 @@ class TestAutoAllocatedTopology(base.BaseFunctionalTest):
|
||||
'test project used only for the '
|
||||
'TestAutoAllocatedTopology tests class'
|
||||
),
|
||||
'domain_id': self.operator_cloud.get_domain('default')['id'],
|
||||
}
|
||||
if self.identity_version == '3':
|
||||
params['domain_id'] = self.operator_cloud.get_domain(
|
||||
'default'
|
||||
)['id']
|
||||
|
||||
project = self.operator_cloud.create_project(**params)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user