From bd5acac654c7a51e9a43da0df78ce13a4b43be84 Mon Sep 17 00:00:00 2001
From: jh629g <jh629g@att.com>
Date: Thu, 10 Sep 2020 12:52:07 -0500
Subject: [PATCH] Remove Ranger region create, catch all errrors

Remove ranger region create in favor of
charts performing needed creation. All
errors when ranger tempest attempts to
get region from ranger now mean that Ranger
is not available and we should skip all
tests

Change-Id: Ideb968aeece89b177c591408dbba78a7c2f9e916
---
 ranger_tempest_plugin/tests/api/base.py | 44 ++-----------------------
 1 file changed, 3 insertions(+), 41 deletions(-)

diff --git a/ranger_tempest_plugin/tests/api/base.py b/ranger_tempest_plugin/tests/api/base.py
index 3f1a7a4..f7da4ee 100755
--- a/ranger_tempest_plugin/tests/api/base.py
+++ b/ranger_tempest_plugin/tests/api/base.py
@@ -56,48 +56,10 @@ class BaseOrmTest(test.BaseTestCase):
         try:
             # check if ranger region exists
             cls.region_client.get_region(CONF.identity.region)
-        except exceptions.Unauthorized:
-            # create region for testing if it doesnt exist
-            cls.region_client.create_region(
-                **{'id': CONF.identity.region,
-                   'name': CONF.identity.region,
-                   "locationType": "Floor",
-                   "vlcpName": CONF.identity.region,
-                   'description': 'region for testing',
-                   'status': 'functional',
-                   'rangerAgentVersion': '3.0',
-                   'OSVersion': 'stein',
-                   'CLLI': '12345',
-                   'address': {'country': 'This', 'state': 'region',
-                               'city': 'is for', 'street': 'test',
-                               'zip': 'purposes'},
-                   'metadata': {},
-                   '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'
-                   }]})
-        except (exceptions.UnexpectedResponseCode, exceptions.NotFound) as e:
-            raise cls.skipException(
-                "Test skipped, Ranger region unavailable") from e
-
         except Exception as exp:
-            if "ConnectionError" in str(exp):
-                skip_msg = "Tests skipped, Ranger unavailable: {}".format(
-                    str(exp))
-                raise cls.skipException(skip_msg)
-            raise exp
+            skip_msg = "Ranger services unavailable: {}".format(
+                str(exp))
+            raise cls.skipException(skip_msg)
 
         try:
             # alt_region_available is True, skip tests and warn