Merge "Convert ironic, swift, and heat api tests to use global CONF object"
diff --git a/tempest/api/baremetal/base.py b/tempest/api/baremetal/base.py
index ec87321..2e745f8 100644
--- a/tempest/api/baremetal/base.py
+++ b/tempest/api/baremetal/base.py
@@ -14,9 +14,12 @@
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
from tempest import exceptions as exc
from tempest import test
+CONF = config.CONF
+
def creates(resource):
"""Decorator that adds resources to the appropriate cleanup list."""
@@ -42,7 +45,7 @@
def setUpClass(cls):
super(BaseBaremetalTest, cls).setUpClass()
- if not cls.config.service_available.ironic:
+ if not CONF.service_available.ironic:
skip_msg = ('%s skipped as Ironic is not available' % cls.__name__)
raise cls.skipException(skip_msg)
diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py
index 41f23b3..0eedea1 100644
--- a/tempest/api/object_storage/base.py
+++ b/tempest/api/object_storage/base.py
@@ -18,9 +18,12 @@
from tempest import clients
from tempest.common import custom_matchers
from tempest.common import isolated_creds
+from tempest import config
from tempest import exceptions
import tempest.test
+CONF = config.CONF
+
class BaseObjectTest(tempest.test.BaseTestCase):
@@ -28,12 +31,12 @@
def setUpClass(cls):
cls.set_network_resources()
super(BaseObjectTest, cls).setUpClass()
- if not cls.config.service_available.swift:
+ if not CONF.service_available.swift:
skip_msg = ("%s skipped as swift is not available" % cls.__name__)
raise cls.skipException(skip_msg)
cls.isolated_creds = isolated_creds.IsolatedCreds(
cls.__name__, network_resources=cls.network_resources)
- if cls.config.compute.allow_tenant_isolation:
+ if CONF.compute.allow_tenant_isolation:
# Get isolated creds for normal user
creds = cls.isolated_creds.get_primary_creds()
username, tenant_name, password = creds
@@ -82,7 +85,7 @@
def _assign_member_role(cls):
primary_user = cls.isolated_creds.get_primary_user()
alt_user = cls.isolated_creds.get_alt_user()
- swift_role = cls.config.object_storage.operator_role
+ swift_role = CONF.object_storage.operator_role
try:
resp, roles = cls.os_admin.identity_client.list_roles()
role = next(r for r in roles if r['name'] == swift_role)
diff --git a/tempest/api/object_storage/test_container_sync.py b/tempest/api/object_storage/test_container_sync.py
index 32bbcbd..207fced 100644
--- a/tempest/api/object_storage/test_container_sync.py
+++ b/tempest/api/object_storage/test_container_sync.py
@@ -18,9 +18,13 @@
from tempest.api.object_storage import base
from tempest.common.utils import data_utils
+from tempest import config
from tempest.test import attr
from tempest.test import HTTP_SUCCESS
+CONF = config.CONF
+
+
# This test can be quite long to run due to its
# dependency on container-sync process running interval.
# You can obviously reduce the container-sync interval in the
@@ -40,9 +44,9 @@
# Must be configure according to container-sync interval
container_sync_timeout = \
- int(cls.config.object_storage.container_sync_timeout)
+ int(CONF.object_storage.container_sync_timeout)
cls.container_sync_interval = \
- int(cls.config.object_storage.container_sync_interval)
+ int(CONF.object_storage.container_sync_interval)
cls.attempts = \
int(container_sync_timeout / cls.container_sync_interval)
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index b69cc49..3424082 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -12,9 +12,11 @@
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
from tempest.openstack.common import log as logging
import tempest.test
+CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -26,12 +28,10 @@
def setUpClass(cls):
super(BaseOrchestrationTest, cls).setUpClass()
os = clients.OrchestrationManager()
- cls.orchestration_cfg = os.config.orchestration
- cls.compute_cfg = os.config.compute
- if not os.config.service_available.heat:
+ if not CONF.service_available.heat:
raise cls.skipException("Heat support is required")
- cls.build_timeout = cls.orchestration_cfg.build_timeout
- cls.build_interval = cls.orchestration_cfg.build_interval
+ cls.build_timeout = CONF.orchestration.build_timeout
+ cls.build_interval = CONF.orchestration.build_interval
cls.os = os
cls.orchestration_client = os.orchestration_client
@@ -45,7 +45,7 @@
def _get_default_network(cls):
resp, networks = cls.network_client.list_networks()
for net in networks['networks']:
- if net['name'] == cls.compute_cfg.fixed_network_name:
+ if net['name'] == CONF.compute.fixed_network_name:
return net
@classmethod
@@ -58,16 +58,6 @@
return admin_client
@classmethod
- def _get_client_args(cls):
-
- return (
- cls.config,
- cls.config.identity.admin_username,
- cls.config.identity.admin_password,
- cls.config.identity.uri
- )
-
- @classmethod
def create_stack(cls, stack_name, template_data, parameters={}):
resp, body = cls.client.create_stack(
stack_name,
diff --git a/tempest/api/orchestration/stacks/test_limits.py b/tempest/api/orchestration/stacks/test_limits.py
index 2b5bd8f..22f544d 100644
--- a/tempest/api/orchestration/stacks/test_limits.py
+++ b/tempest/api/orchestration/stacks/test_limits.py
@@ -14,9 +14,11 @@
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
+from tempest import config
from tempest import exceptions
from tempest.test import attr
+CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -32,7 +34,7 @@
@attr(type='gate')
def test_exceed_max_template_size_fails(self):
- fill = 'A' * self.orchestration_cfg.max_template_size
+ fill = 'A' * CONF.orchestration.max_template_size
template = '''
HeatTemplateFormatVersion: '2012-12-12'
Description: '%s'
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index bed72c8..243c3ce 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -16,8 +16,10 @@
from tempest.api.orchestration import base
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
from tempest.test import attr
+CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -91,16 +93,15 @@
@classmethod
def setUpClass(cls):
super(NeutronResourcesTestJSON, cls).setUpClass()
- if not cls.orchestration_cfg.image_ref:
+ if not CONF.orchestration.image_ref:
raise cls.skipException("No image available to test")
cls.client = cls.orchestration_client
os = clients.Manager()
- cls.network_cfg = os.config.network
- if not cls.config.service_available.neutron:
+ if not CONF.service_available.neutron:
raise cls.skipException("Neutron support is required")
cls.network_client = os.network_client
cls.stack_name = data_utils.rand_name('heat')
- cls.keypair_name = (cls.orchestration_cfg.keypair_name or
+ cls.keypair_name = (CONF.orchestration.keypair_name or
cls._create_keypair()['name'])
cls.external_router_id = cls._get_external_router_id()
@@ -110,8 +111,8 @@
cls.template,
parameters={
'KeyName': cls.keypair_name,
- 'InstanceType': cls.orchestration_cfg.instance_type,
- 'ImageId': cls.orchestration_cfg.image_ref,
+ 'InstanceType': CONF.orchestration.instance_type,
+ 'ImageId': CONF.orchestration.image_ref,
'ExternalRouterId': cls.external_router_id
})
cls.stack_id = cls.stack_identifier.split('/')[1]
diff --git a/tempest/api/orchestration/stacks/test_server_cfn_init.py b/tempest/api/orchestration/stacks/test_server_cfn_init.py
index 2ef629f..4267c1d 100644
--- a/tempest/api/orchestration/stacks/test_server_cfn_init.py
+++ b/tempest/api/orchestration/stacks/test_server_cfn_init.py
@@ -125,13 +125,13 @@
@classmethod
def setUpClass(cls):
super(ServerCfnInitTestJSON, cls).setUpClass()
- if not cls.orchestration_cfg.image_ref:
+ if not CONF.orchestration.image_ref:
raise cls.skipException("No image available to test")
cls.client = cls.orchestration_client
stack_name = data_utils.rand_name('heat')
- if cls.orchestration_cfg.keypair_name:
- keypair_name = cls.orchestration_cfg.keypair_name
+ if CONF.orchestration.keypair_name:
+ keypair_name = CONF.orchestration.keypair_name
else:
cls.keypair = cls._create_keypair()
keypair_name = cls.keypair['name']
@@ -142,8 +142,8 @@
cls.template,
parameters={
'key_name': keypair_name,
- 'flavor': cls.orchestration_cfg.instance_type,
- 'image': cls.orchestration_cfg.image_ref,
+ 'flavor': CONF.orchestration.instance_type,
+ 'image': CONF.orchestration.image_ref,
'network': cls._get_default_network()['id']
})