Allow for variable-domain testing
Ensures that ranger-tempest-plugin has needed roles in the project specified so that resource creation works in domain specified within ranger's region Change-Id: I753fbb4ca33f2692fe337f4dd83f3feedfb9b2d6
This commit is contained in:
parent
57323cb05d
commit
03f238e85e
@ -54,9 +54,6 @@ ORM_GROUP_OPTIONS = [
|
|||||||
cfg.StrOpt("catalog_type",
|
cfg.StrOpt("catalog_type",
|
||||||
default='ranger',
|
default='ranger',
|
||||||
help="ranger catalog type"),
|
help="ranger catalog type"),
|
||||||
cfg.StrOpt("domain",
|
|
||||||
default='Default',
|
|
||||||
help="Domain used for Ranger tempest testing"),
|
|
||||||
cfg.StrOpt("alt_region_available",
|
cfg.StrOpt("alt_region_available",
|
||||||
default=False,
|
default=False,
|
||||||
help="Alt region for ranger tempest testing"),
|
help="Alt region for ranger tempest testing"),
|
||||||
@ -64,4 +61,7 @@ ORM_GROUP_OPTIONS = [
|
|||||||
default='',
|
default='',
|
||||||
help="Provide alternate region for creating"
|
help="Provide alternate region for creating"
|
||||||
"resources with multiple regions"),
|
"resources with multiple regions"),
|
||||||
|
cfg.StrOpt("test_rbac",
|
||||||
|
default=False,
|
||||||
|
help="Determines if rbac tests should be ran")
|
||||||
]
|
]
|
||||||
|
@ -43,6 +43,7 @@ _region = {
|
|||||||
'description': {'type': 'string'},
|
'description': {'type': 'string'},
|
||||||
'designType': {'type': 'string'},
|
'designType': {'type': 'string'},
|
||||||
'locationType': {'type': 'string'},
|
'locationType': {'type': 'string'},
|
||||||
|
'domainName': {'type': 'string'},
|
||||||
'vlcpName': {'type': 'string'},
|
'vlcpName': {'type': 'string'},
|
||||||
'address': {
|
'address': {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
@ -150,7 +151,8 @@ list_region_v1 = {
|
|||||||
'OS_version': {'type': 'string'},
|
'OS_version': {'type': 'string'},
|
||||||
'keystone_EP': {'type': 'string'},
|
'keystone_EP': {'type': 'string'},
|
||||||
'zone_name': {'type': 'string'},
|
'zone_name': {'type': 'string'},
|
||||||
'location_type': {'type': 'string'}
|
'location_type': {'type': 'string'},
|
||||||
|
'domain_name': {'type': 'string'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,7 @@ class RangerClientBase(rest_client.RestClient):
|
|||||||
if not CONF.ranger.auth_enabled:
|
if not CONF.ranger.auth_enabled:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# Only used for ConnectionError message
|
||||||
region = self.auth_region
|
region = self.auth_region
|
||||||
|
|
||||||
keystone_ep = self.get_keystone_ep()
|
keystone_ep = self.get_keystone_ep()
|
||||||
|
@ -31,10 +31,14 @@ class BaseOrmTest(test.BaseTestCase):
|
|||||||
build_timeout = 120
|
build_timeout = 120
|
||||||
build_interval = 10
|
build_interval = 10
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setup_credentials(cls):
|
||||||
|
cls.set_network_resources()
|
||||||
|
super(BaseOrmTest, cls).setup_credentials()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(BaseOrmTest, cls).setup_clients()
|
cls.project_client = cls.os_admin.projects_client
|
||||||
cls.identity_client = cls.os_admin.projects_client
|
|
||||||
cls.region_client = cls.os_admin.rms_client
|
cls.region_client = cls.os_admin.rms_client
|
||||||
|
|
||||||
# Get regions in ranger deployment
|
# Get regions in ranger deployment
|
||||||
@ -42,6 +46,8 @@ class BaseOrmTest(test.BaseTestCase):
|
|||||||
region_names = [x['name'] for x in regions_list['regions']]
|
region_names = [x['name'] for x in regions_list['regions']]
|
||||||
|
|
||||||
# Check if region and alt region exist. If not, create those regions.
|
# Check if region and alt region exist. If not, create those regions.
|
||||||
|
# NOTE: These region creation statements will be removed when
|
||||||
|
# ranger-agent has been modified to create regions at deployment
|
||||||
if (CONF.identity.region not in region_names):
|
if (CONF.identity.region not in region_names):
|
||||||
cls.region_client.create_region(
|
cls.region_client.create_region(
|
||||||
CONF.identity.region,
|
CONF.identity.region,
|
||||||
@ -57,9 +63,10 @@ class BaseOrmTest(test.BaseTestCase):
|
|||||||
'zip': 'purposes'},
|
'zip': 'purposes'},
|
||||||
'metadata': {'meta1': ['region']},
|
'metadata': {'meta1': ['region']},
|
||||||
'designType': 'large',
|
'designType': 'large',
|
||||||
|
'domainName': CONF.auth.admin_domain_name,
|
||||||
'endpoints': [{
|
'endpoints': [{
|
||||||
'publicURL':
|
'publicURL':
|
||||||
'https://dashboard-ranger.%s.cci.att.com'
|
'https://dashboard-nc.%s.cci.att.com'
|
||||||
% CONF.identity.region,
|
% CONF.identity.region,
|
||||||
'type': 'dashboard'
|
'type': 'dashboard'
|
||||||
}, {
|
}, {
|
||||||
@ -88,9 +95,10 @@ class BaseOrmTest(test.BaseTestCase):
|
|||||||
'zip': 'purposes'},
|
'zip': 'purposes'},
|
||||||
'metadata': {'meta1': ['alt_region']},
|
'metadata': {'meta1': ['alt_region']},
|
||||||
'designType': 'large',
|
'designType': 'large',
|
||||||
|
'domainName': CONF.auth.admin_domain_name,
|
||||||
'endpoints': [{
|
'endpoints': [{
|
||||||
'publicURL':
|
'publicURL':
|
||||||
'https://dashboard-ranger.%s.cci.att.com'
|
'https://dashboard-nc.%s.cci.att.com'
|
||||||
% CONF.ranger.alt_region,
|
% CONF.ranger.alt_region,
|
||||||
'type': 'dashboard'
|
'type': 'dashboard'
|
||||||
}, {
|
}, {
|
||||||
@ -103,6 +111,7 @@ class BaseOrmTest(test.BaseTestCase):
|
|||||||
% CONF.ranger.alt_region,
|
% CONF.ranger.alt_region,
|
||||||
'type': 'ord'
|
'type': 'ord'
|
||||||
}]})
|
}]})
|
||||||
|
super(BaseOrmTest, cls).setup_clients()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def skip_checks(cls):
|
def skip_checks(cls):
|
||||||
|
@ -239,7 +239,7 @@ class CmsBaseOrmTest(base.BaseOrmTest):
|
|||||||
default_users_req.append(user["id"])
|
default_users_req.append(user["id"])
|
||||||
expected_users_count = len(region_users_req) + len(default_users_req)
|
expected_users_count = len(region_users_req) + len(default_users_req)
|
||||||
actual_users_count = 0
|
actual_users_count = 0
|
||||||
lcp_body = cls.identity_client.list_tenant_users(cust_id)
|
lcp_body = cls.project_client.list_tenant_users(cust_id)
|
||||||
for user in lcp_body["users"]:
|
for user in lcp_body["users"]:
|
||||||
users_lcp.append(user["id"])
|
users_lcp.append(user["id"])
|
||||||
dcp_body = cls.client.get_customer(cust_id)
|
dcp_body = cls.client.get_customer(cust_id)
|
||||||
@ -313,7 +313,7 @@ class CmsBaseOrmTest(base.BaseOrmTest):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _validate_customer_deletion_on_lcp(cls, customer_id):
|
def _validate_customer_deletion_on_lcp(cls, customer_id):
|
||||||
body = cls.identity_client.list_projects()["projects"]
|
body = cls.project_client.list_projects()["projects"]
|
||||||
customer_ids = [customer["id"]
|
customer_ids = [customer["id"]
|
||||||
for customer in body
|
for customer in body
|
||||||
if customer["id"] == customer_id]
|
if customer["id"] == customer_id]
|
||||||
|
@ -228,7 +228,7 @@ class FmsBaseOrmTest(base.BaseOrmTest):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_project_id(cls, project_name):
|
def _get_project_id(cls, project_name):
|
||||||
body = cls.identity_client.list_projects()
|
body = cls.project_client.list_projects()
|
||||||
for project in body["projects"]:
|
for project in body["projects"]:
|
||||||
if(project["name"] == project_name):
|
if(project["name"] == project_name):
|
||||||
return project["id"]
|
return project["id"]
|
||||||
|
@ -86,7 +86,7 @@ class ImsBaseOrmTest(base.BaseOrmTest):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_project_id(cls, project_name):
|
def _get_project_id(cls, project_name):
|
||||||
body = cls.identity_client.list_projects()
|
body = cls.project_client.list_projects()
|
||||||
for project in body["projects"]:
|
for project in body["projects"]:
|
||||||
if(project["name"] == project_name):
|
if(project["name"] == project_name):
|
||||||
return project["id"]
|
return project["id"]
|
||||||
|
@ -18,11 +18,6 @@ from ranger_tempest_plugin.tests.api import base
|
|||||||
|
|
||||||
class TestTempestCmsNegative(base.BaseOrmTest):
|
class TestTempestCmsNegative(base.BaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_credentials(cls):
|
|
||||||
cls.set_network_resources()
|
|
||||||
super(TestTempestCmsNegative, cls).setup_credentials()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestCmsNegative, cls).setup_clients()
|
super(TestTempestCmsNegative, cls).setup_clients()
|
||||||
|
@ -37,11 +37,6 @@ class TestTempestFms(fms_base.FmsBaseOrmTest):
|
|||||||
region = CONF.identity.region
|
region = CONF.identity.region
|
||||||
region_alt = CONF.ranger.alt_region
|
region_alt = CONF.ranger.alt_region
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_credentials(cls):
|
|
||||||
cls.set_network_resources()
|
|
||||||
super(TestTempestFms, cls).setup_credentials()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestFms, cls).setup_clients()
|
super(TestTempestFms, cls).setup_clients()
|
||||||
|
@ -18,11 +18,6 @@ from ranger_tempest_plugin.tests.api import base
|
|||||||
|
|
||||||
class TestTempestFmsNegative(base.BaseOrmTest):
|
class TestTempestFmsNegative(base.BaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_credentials(cls):
|
|
||||||
cls.set_network_resources()
|
|
||||||
super(TestTempestFmsNegative, cls).setup_credentials()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestFmsNegative, cls).setup_clients()
|
super(TestTempestFmsNegative, cls).setup_clients()
|
||||||
|
@ -25,11 +25,6 @@ CONF = config.CONF
|
|||||||
|
|
||||||
class TestTempestIms(ims_base.ImsBaseOrmTest):
|
class TestTempestIms(ims_base.ImsBaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_credentials(cls):
|
|
||||||
cls.set_network_resources()
|
|
||||||
super(TestTempestIms, cls).setup_credentials()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestIms, cls).setup_clients()
|
super(TestTempestIms, cls).setup_clients()
|
||||||
|
@ -18,11 +18,6 @@ from ranger_tempest_plugin.tests.api import base
|
|||||||
|
|
||||||
class TestTempestImsNegative(base.BaseOrmTest):
|
class TestTempestImsNegative(base.BaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_credentials(cls):
|
|
||||||
cls.set_network_resources()
|
|
||||||
super(TestTempestImsNegative, cls).setup_credentials()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestImsNegative, cls).setup_clients()
|
super(TestTempestImsNegative, cls).setup_clients()
|
||||||
|
@ -24,16 +24,6 @@ from tempest.lib.common.utils import data_utils
|
|||||||
|
|
||||||
class TestTempestRegionGroup(base.BaseOrmTest):
|
class TestTempestRegionGroup(base.BaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_credentials(cls):
|
|
||||||
cls.set_network_resources()
|
|
||||||
super(TestTempestRegionGroup, cls).setup_credentials()
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_clients(cls):
|
|
||||||
super(TestTempestRegionGroup, cls).setup_clients()
|
|
||||||
cls.client = cls.os_primary.rms_client
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_setup(cls):
|
def resource_setup(cls):
|
||||||
cls.setup_ids = []
|
cls.setup_ids = []
|
||||||
|
@ -18,11 +18,6 @@ from ranger_tempest_plugin.tests.api import base
|
|||||||
|
|
||||||
class TestTempestRegGroupNegative(base.BaseOrmTest):
|
class TestTempestRegGroupNegative(base.BaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_credentials(cls):
|
|
||||||
cls.set_network_resources()
|
|
||||||
super(TestTempestRegGroupNegative, cls).setup_credentials()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestRegGroupNegative, cls).setup_clients()
|
super(TestTempestRegGroupNegative, cls).setup_clients()
|
||||||
|
@ -18,11 +18,6 @@ from ranger_tempest_plugin.tests.api import base
|
|||||||
|
|
||||||
class TestTempestRegionsNegative(base.BaseOrmTest):
|
class TestTempestRegionsNegative(base.BaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_credentials(cls):
|
|
||||||
cls.set_network_resources()
|
|
||||||
super(TestTempestRegionsNegative, cls).setup_credentials()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestRegionsNegative, cls).setup_clients()
|
super(TestTempestRegionsNegative, cls).setup_clients()
|
||||||
|
@ -33,6 +33,14 @@ class TestCustomer(rbac_utils.RbacUtilsMixin, cms_base.CmsBaseOrmTest):
|
|||||||
super(TestCustomer, cls).setup_clients()
|
super(TestCustomer, cls).setup_clients()
|
||||||
cls.client = cls.os_primary.cms_rbac_client
|
cls.client = cls.os_primary.cms_rbac_client
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def skip_checks(cls):
|
||||||
|
super(TestCustomer, cls).skip_checks()
|
||||||
|
if not CONF.ranger.test_rbac:
|
||||||
|
skip_msg = ("%s skipped as this is not an rbac test run"
|
||||||
|
% cls.__name__)
|
||||||
|
raise cls.skipException(skip_msg)
|
||||||
|
|
||||||
@rbac_rule_validation.action(service="ranger",
|
@rbac_rule_validation.action(service="ranger",
|
||||||
rules=['customers:get_one'],
|
rules=['customers:get_one'],
|
||||||
expected_error_codes=[403])
|
expected_error_codes=[403])
|
||||||
|
@ -15,12 +15,17 @@
|
|||||||
from patrole_tempest_plugin import rbac_rule_validation
|
from patrole_tempest_plugin import rbac_rule_validation
|
||||||
from patrole_tempest_plugin import rbac_utils
|
from patrole_tempest_plugin import rbac_utils
|
||||||
|
|
||||||
from tempest.lib import decorators
|
|
||||||
from tempest.lib.common.utils import data_utils
|
|
||||||
|
|
||||||
from ranger_tempest_plugin import data_utils as orm_data_utils
|
from ranger_tempest_plugin import data_utils as orm_data_utils
|
||||||
from ranger_tempest_plugin.tests.api import rms_base
|
from ranger_tempest_plugin.tests.api import rms_base
|
||||||
|
|
||||||
|
from tempest import config
|
||||||
|
from tempest.lib import decorators
|
||||||
|
|
||||||
|
from tempest.lib.common.utils import data_utils
|
||||||
|
|
||||||
|
|
||||||
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class TestRegion(rbac_utils.RbacUtilsMixin, rms_base.RmsBaseOrmTest):
|
class TestRegion(rbac_utils.RbacUtilsMixin, rms_base.RmsBaseOrmTest):
|
||||||
|
|
||||||
@ -29,6 +34,14 @@ class TestRegion(rbac_utils.RbacUtilsMixin, rms_base.RmsBaseOrmTest):
|
|||||||
super(TestRegion, cls).setup_clients()
|
super(TestRegion, cls).setup_clients()
|
||||||
cls.client = cls.os_primary.rms_rbac_client
|
cls.client = cls.os_primary.rms_rbac_client
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def skip_checks(cls):
|
||||||
|
super(TestRegion, cls).skip_checks()
|
||||||
|
if not CONF.ranger.test_rbac:
|
||||||
|
skip_msg = ("%s skipped as this is not an rbac test run"
|
||||||
|
% cls.__name__)
|
||||||
|
raise cls.skipException(skip_msg)
|
||||||
|
|
||||||
@rbac_rule_validation.action(service='ranger',
|
@rbac_rule_validation.action(service='ranger',
|
||||||
rules=['region:get_all'],
|
rules=['region:get_all'],
|
||||||
expected_error_codes=[403])
|
expected_error_codes=[403])
|
||||||
@ -62,10 +75,10 @@ class TestRegion(rbac_utils.RbacUtilsMixin, rms_base.RmsBaseOrmTest):
|
|||||||
expected_error_codes=[403])
|
expected_error_codes=[403])
|
||||||
@decorators.idempotent_id('cbb32c8f-f183-42c4-a9d9-61e93d066c5f')
|
@decorators.idempotent_id('cbb32c8f-f183-42c4-a9d9-61e93d066c5f')
|
||||||
def test_update_region(self):
|
def test_update_region(self):
|
||||||
id = self.setup_ids[-1]
|
region_id = self.setup_ids[-1]
|
||||||
region = orm_data_utils.rand_region(id)
|
region = orm_data_utils.rand_region(region_id)
|
||||||
with self.override_role():
|
with self.override_role():
|
||||||
self.client.update_region(id, **region)
|
self.client.update_region(region_id, **region)
|
||||||
|
|
||||||
@rbac_rule_validation.action(service='ranger',
|
@rbac_rule_validation.action(service='ranger',
|
||||||
rules=['region:delete'],
|
rules=['region:delete'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user