Updating region create to region update

tempest tests use region create statement to ensure
regions exist for testing purposes. ranger-agent
charts now include automation during deployment for
ranger regions, so these statements have been changed
to update statements to ensure region is pointing at
testing domain

Change-Id: I3024145c5b388d85b2aa78c223bd47e486fbd157
This commit is contained in:
jh629g 2020-03-26 13:33:04 -05:00
parent 67c882996e
commit b167877470
3 changed files with 10 additions and 97 deletions

View File

@ -43,74 +43,16 @@ class BaseOrmTest(test.BaseTestCase):
# Get regions in ranger deployment
_, regions_list = cls.region_client.list_regions()
region_names = [x['name'] for x in regions_list['regions']]
regions = [x for x in regions_list['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):
cls.region_client.create_region(
CONF.identity.region,
**{'id': CONF.identity.region,
'name': CONF.identity.region,
'description': 'region for testing',
'status': 'functional',
'rangerAgentVersion': '3.0',
'OSVersion': 'stein',
'CLLI': '123450',
'address': {'country': 'This', 'state': 'region',
'city': 'is for', 'street': 'test',
'zip': 'purposes'},
'metadata': {'meta1': ['region']},
'designType': 'large',
'domainName': CONF.auth.admin_domain_name,
'endpoints': [{
'publicURL':
'https://dashboard-nc.%s.cci.att.com'
% CONF.identity.region,
'type': 'dashboard'
}, {
'publicURL': cls.identity_url,
'type': 'identity'
}, {
'publicURL':
'https://ranger-agent-nc.%s.cci.att.com'
% CONF.identity.region,
'type': 'ord'
}]})
# TODO(jh629g): configuration of alternate region for testing
# this plugin needs to be refactored to ensure all region
# creation in this plugin exists in only one place.
if (CONF.ranger.alt_region not in region_names) and \
CONF.ranger.alt_region_available is True:
cls.region_client.create_region(
CONF.ranger.alt_region,
**{'status': 'functional',
'rangerAgentVersion': '3.0',
'OSVersion': 'stein',
'CLLI': '123450',
'address': {'country': 'This', 'state': 'region',
'city': 'is for', 'street': 'test',
'zip': 'purposes'},
'metadata': {'meta1': ['alt_region']},
'designType': 'large',
'domainName': CONF.auth.admin_domain_name,
'endpoints': [{
'publicURL':
'https://dashboard-nc.%s.cci.att.com'
% CONF.ranger.alt_region,
'type': 'dashboard'
}, {
'publicURL': 'https://identity-nc.%s.cci.att.com'
% CONF.ranger.alt_region,
'type': 'identity'
}, {
'publicURL':
'https://ranger-agent-nc.%s.cci.att.com'
% CONF.ranger.alt_region,
'type': 'ord'
}]})
for region in regions:
if region['domain_name'] != CONF.auth.admin_domain_name:
region['domain_name'] = CONF.auth.admin_domain_name
cls.region_client.update_region(region['id'],
**region)
cls.addClassResourceCleanup(cls.region_client.update_region,
region['id'],
**region)
super(BaseOrmTest, cls).setup_clients()
@classmethod

View File

@ -58,11 +58,8 @@ class ImsBaseOrmTest(base.BaseOrmTest):
post_body["disk-format"] = "qcow2"
post_body["container-format"] = "bare"
region["name"] = cls.region_id
region["name"] = CONF.identity.region
region["type"] = "single"
region["checksum"] = "7297321c2fa6424417a548c85edd6e98"
region["virtual_size"] = "None"
region["size"] = "38797312"
# set enabled status to True or False based on set_enabled value
post_body["enabled"] = True if set_enabled else False

View File

@ -15,7 +15,6 @@
from oslo_concurrency import lockutils
from ranger_tempest_plugin.data_utils import data_utils
from ranger_tempest_plugin.tests.api import ims_base
from tempest import config
@ -85,31 +84,6 @@ class TestTempestIms(ims_base.ImsBaseOrmTest):
self._del_img_validate_deletion_on_dcp_and_lcp(id_)
self.assertRaises(exceptions.NotFound, self.client.get_image, id_)
def _create_region(self, status='functional'):
region_name = data_utils.rand_name()
self.addCleanup(
self.os_admin.rms_client.delete_region,
region_name)
_, region = self.os_admin.rms_client.create_region(
**{
'region_id': region_name,
'status': status,
'endpoints': [{
'publicURL':
'https://dashboard-ranger.%s.com' % region_name,
'type': 'dashboard'
}, {
'publicURL': CONF.identity.uri_v3,
'type': 'identity'
}, {
'publicURL':
'https://ranger-agent.%s.com:9010' % region_name,
'type': 'ord'
}]})
return region
@decorators.idempotent_id('2b1bb28b-4151-4e75-ae1b-d21089c3418c')
def test_get_image(self):
"""Execute 'get_image' using the following options: