Convert compute api tests to global CONF object
This commit takes all the uses of config in the compute api tests and
converts them to use the global CONF object.
Partially implements bp config-cleanup
Change-Id: Iac92d6ac88200222392a131b4c95411594c509ba
diff --git a/tempest/api/compute/admin/test_fixed_ips.py b/tempest/api/compute/admin/test_fixed_ips.py
index 0c36837..cfb2f0e 100644
--- a/tempest/api/compute/admin/test_fixed_ips.py
+++ b/tempest/api/compute/admin/test_fixed_ips.py
@@ -14,8 +14,11 @@
# under the License.
from tempest.api.compute import base
+from tempest import config
from tempest.test import attr
+CONF = config.CONF
+
class FixedIPsTestJson(base.BaseV2ComputeAdminTest):
_interface = 'json'
@@ -23,7 +26,7 @@
@classmethod
def setUpClass(cls):
super(FixedIPsTestJson, cls).setUpClass()
- if cls.config.service_available.neutron:
+ if CONF.service_available.neutron:
msg = ("%s skipped as neutron is available" % cls.__name__)
raise cls.skipException(msg)
cls.client = cls.os_adm.fixed_ips_client
diff --git a/tempest/api/compute/admin/test_fixed_ips_negative.py b/tempest/api/compute/admin/test_fixed_ips_negative.py
index bf7fd51..def9810 100644
--- a/tempest/api/compute/admin/test_fixed_ips_negative.py
+++ b/tempest/api/compute/admin/test_fixed_ips_negative.py
@@ -13,9 +13,12 @@
# under the License.
from tempest.api.compute import base
+from tempest import config
from tempest import exceptions
from tempest.test import attr
+CONF = config.CONF
+
class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest):
_interface = 'json'
@@ -23,7 +26,7 @@
@classmethod
def setUpClass(cls):
super(FixedIPsNegativeTestJson, cls).setUpClass()
- if cls.config.service_available.neutron:
+ if CONF.service_available.neutron:
msg = ("%s skipped as neutron is available" % cls.__name__)
raise cls.skipException(msg)
cls.client = cls.os_adm.fixed_ips_client
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 5539894..441c87d 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -17,10 +17,12 @@
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
import tempest.test
+CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -37,15 +39,15 @@
os = cls.get_client_manager()
cls.os = os
- cls.build_interval = cls.config.compute.build_interval
- cls.build_timeout = cls.config.compute.build_timeout
- cls.ssh_user = cls.config.compute.ssh_user
- cls.image_ref = cls.config.compute.image_ref
- cls.image_ref_alt = cls.config.compute.image_ref_alt
- cls.flavor_ref = cls.config.compute.flavor_ref
- cls.flavor_ref_alt = cls.config.compute.flavor_ref_alt
- cls.image_ssh_user = cls.config.compute.image_ssh_user
- cls.image_ssh_password = cls.config.compute.image_ssh_password
+ cls.build_interval = CONF.compute.build_interval
+ cls.build_timeout = CONF.compute.build_timeout
+ cls.ssh_user = CONF.compute.ssh_user
+ cls.image_ref = CONF.compute.image_ref
+ cls.image_ref_alt = CONF.compute.image_ref_alt
+ cls.flavor_ref = CONF.compute.flavor_ref
+ cls.flavor_ref_alt = CONF.compute.flavor_ref_alt
+ cls.image_ssh_user = CONF.compute.image_ssh_user
+ cls.image_ssh_password = CONF.compute.image_ssh_password
cls.servers = []
cls.images = []
cls.multi_user = cls.get_multi_user()
@@ -57,14 +59,14 @@
# used in testing. If the test cases are allowed to create
# users (config.compute.allow_tenant_isolation is true,
# then we allow multi-user.
- if not cls.config.compute.allow_tenant_isolation:
- user1 = cls.config.identity.username
- user2 = cls.config.identity.alt_username
+ if not CONF.compute.allow_tenant_isolation:
+ user1 = CONF.identity.username
+ user2 = CONF.identity.alt_username
if not user2 or user1 == user2:
multi_user = False
else:
- user2_password = cls.config.identity.alt_password
- user2_tenant_name = cls.config.identity.alt_tenant_name
+ user2_password = CONF.identity.alt_password
+ user2_tenant_name = CONF.identity.alt_tenant_name
if not user2_password or not user2_tenant_name:
msg = ("Alternate user specified but not alternate "
"tenant or password: alt_tenant_name=%s "
@@ -234,14 +236,14 @@
@classmethod
def setUpClass(cls):
super(BaseV2ComputeAdminTest, cls).setUpClass()
- admin_username = cls.config.compute_admin.username
- admin_password = cls.config.compute_admin.password
- admin_tenant = cls.config.compute_admin.tenant_name
+ admin_username = CONF.compute_admin.username
+ admin_password = CONF.compute_admin.password
+ admin_tenant = CONF.compute_admin.tenant_name
if not (admin_username and admin_password and admin_tenant):
msg = ("Missing Compute Admin API credentials "
"in configuration.")
raise cls.skipException(msg)
- if (cls.config.compute.allow_tenant_isolation or
+ if (CONF.compute.allow_tenant_isolation or
cls.force_tenant_isolation is True):
creds = cls.isolated_creds.get_admin_creds()
admin_username, admin_tenant_name, admin_password = creds
@@ -265,7 +267,7 @@
cls.set_network_resources()
super(BaseV3ComputeTest, cls).setUpClass()
- if not cls.config.compute_feature_enabled.api_v3:
+ if not CONF.compute_feature_enabled.api_v3:
cls.tearDownClass()
skip_msg = ("%s skipped as nova v3 api is not available" %
cls.__name__)
@@ -330,14 +332,14 @@
@classmethod
def setUpClass(cls):
super(BaseV3ComputeAdminTest, cls).setUpClass()
- admin_username = cls.config.compute_admin.username
- admin_password = cls.config.compute_admin.password
- admin_tenant = cls.config.compute_admin.tenant_name
+ admin_username = CONF.compute_admin.username
+ admin_password = CONF.compute_admin.password
+ admin_tenant = CONF.compute_admin.tenant_name
if not (admin_username and admin_password and admin_tenant):
msg = ("Missing Compute Admin API credentials "
"in configuration.")
raise cls.skipException(msg)
- if cls.config.compute.allow_tenant_isolation:
+ if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_admin_creds()
admin_username, admin_tenant_name, admin_password = creds
os_adm = clients.Manager(username=admin_username,
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
index e4d83c5..f24343b 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
@@ -17,9 +17,12 @@
from tempest.api.compute.floating_ips 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
+
class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest):
_interface = 'json'
@@ -40,7 +43,7 @@
cls.floating_ip_ids.append(body[i]['id'])
while True:
cls.non_exist_id = data_utils.rand_int_id(start=999)
- if cls.config.service_available.neutron:
+ if CONF.service_available.neutron:
cls.non_exist_id = str(uuid.uuid4())
if cls.non_exist_id not in cls.floating_ip_ids:
break
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py b/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
index bb1c828..8d60e7d 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
@@ -17,9 +17,12 @@
from tempest.api.compute 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
+
class FloatingIPDetailsNegativeTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@@ -34,7 +37,7 @@
# Negative test:Should not be able to GET the details
# of non-existent floating IP
# Creating a non-existent floatingIP id
- if self.config.service_available.neutron:
+ if CONF.service_available.neutron:
non_exist_id = str(uuid.uuid4())
else:
non_exist_id = data_utils.rand_int_id(start=999)
diff --git a/tempest/api/compute/images/test_images.py b/tempest/api/compute/images/test_images.py
index fc09741..4cc36c9 100644
--- a/tempest/api/compute/images/test_images.py
+++ b/tempest/api/compute/images/test_images.py
@@ -15,9 +15,12 @@
from tempest.api.compute import base
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
from tempest import exceptions
from tempest.test import attr
+CONF = config.CONF
+
class ImagesTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@@ -25,7 +28,7 @@
@classmethod
def setUpClass(cls):
super(ImagesTestJSON, cls).setUpClass()
- if not cls.config.service_available.glance:
+ if not CONF.service_available.glance:
skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg)
cls.client = cls.images_client
@@ -34,7 +37,7 @@
cls.image_ids = []
if cls.multi_user:
- if cls.config.compute.allow_tenant_isolation:
+ if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_alt_creds()
username, tenant_name, password = creds
cls.alt_manager = clients.Manager(username=username,
diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index 0cb748b..8d60623 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -55,7 +55,7 @@
def setUpClass(cls):
super(ImagesOneServerTestJSON, cls).setUpClass()
cls.client = cls.images_client
- if not cls.config.service_available.glance:
+ if not CONF.service_available.glance:
skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg)
@@ -69,7 +69,7 @@
cls.image_ids = []
if cls.multi_user:
- if cls.config.compute.allow_tenant_isolation:
+ if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_alt_creds()
username, tenant_name, password = creds
cls.alt_manager = clients.Manager(username=username,
diff --git a/tempest/api/compute/images/test_images_oneserver_negative.py b/tempest/api/compute/images/test_images_oneserver_negative.py
index 3f93fbe..c96c4a4 100644
--- a/tempest/api/compute/images/test_images_oneserver_negative.py
+++ b/tempest/api/compute/images/test_images_oneserver_negative.py
@@ -17,11 +17,14 @@
from tempest.api.compute import base
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.test import attr
from tempest.test import skip_because
+CONF = config.CONF
+
LOG = logging.getLogger(__name__)
@@ -57,7 +60,7 @@
def setUpClass(cls):
super(ImagesOneServerNegativeTestJSON, cls).setUpClass()
cls.client = cls.images_client
- if not cls.config.service_available.glance:
+ if not CONF.service_available.glance:
skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg)
@@ -71,7 +74,7 @@
cls.image_ids = []
if cls.multi_user:
- if cls.config.compute.allow_tenant_isolation:
+ if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_alt_creds()
username, tenant_name, password = creds
cls.alt_manager = clients.Manager(username=username,
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index c04729c..f82143e 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -14,10 +14,12 @@
# under the License.
from tempest.api.compute import base
+from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.test import attr
+CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -28,7 +30,7 @@
@classmethod
def setUpClass(cls):
super(ListImageFiltersTestJSON, cls).setUpClass()
- if not cls.config.service_available.glance:
+ if not CONF.service_available.glance:
skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg)
cls.client = cls.images_client
diff --git a/tempest/api/compute/images/test_list_images.py b/tempest/api/compute/images/test_list_images.py
index ae1e8d0..ed38442 100644
--- a/tempest/api/compute/images/test_list_images.py
+++ b/tempest/api/compute/images/test_list_images.py
@@ -14,8 +14,11 @@
# under the License.
from tempest.api.compute import base
+from tempest import config
from tempest.test import attr
+CONF = config.CONF
+
class ListImagesTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@@ -23,7 +26,7 @@
@classmethod
def setUpClass(cls):
super(ListImagesTestJSON, cls).setUpClass()
- if not cls.config.service_available.glance:
+ if not CONF.service_available.glance:
skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg)
cls.client = cls.images_client
diff --git a/tempest/api/compute/security_groups/test_security_group_rules.py b/tempest/api/compute/security_groups/test_security_group_rules.py
index 6aa5cb5..375105e 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules.py
@@ -15,8 +15,11 @@
from tempest.api.compute.security_groups import base
from tempest.common.utils import data_utils
+from tempest import config
from tempest.test import attr
+CONF = config.CONF
+
class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest):
_interface = 'json'
@@ -25,7 +28,7 @@
def setUpClass(cls):
super(SecurityGroupRulesTestJSON, cls).setUpClass()
cls.client = cls.security_groups_client
- cls.neutron_available = cls.config.service_available.neutron
+ cls.neutron_available = CONF.service_available.neutron
@attr(type='smoke')
def test_security_group_rules_create(self):
diff --git a/tempest/api/compute/security_groups/test_security_groups_negative.py b/tempest/api/compute/security_groups/test_security_groups_negative.py
index 98ed8e8..ce1eada 100644
--- a/tempest/api/compute/security_groups/test_security_groups_negative.py
+++ b/tempest/api/compute/security_groups/test_security_groups_negative.py
@@ -31,7 +31,7 @@
def setUpClass(cls):
super(SecurityGroupsNegativeTestJSON, cls).setUpClass()
cls.client = cls.security_groups_client
- cls.neutron_available = cls.config.service_available.neutron
+ cls.neutron_available = CONF.service_available.neutron
def _delete_security_group(self, securitygroup_id):
resp, _ = self.client.delete_security_group(securitygroup_id)
diff --git a/tempest/api/compute/servers/test_attach_interfaces.py b/tempest/api/compute/servers/test_attach_interfaces.py
index 4dacb48..9cdac55 100644
--- a/tempest/api/compute/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/servers/test_attach_interfaces.py
@@ -14,18 +14,21 @@
# under the License.
from tempest.api.compute import base
+from tempest import config
from tempest import exceptions
from tempest.test import attr
import time
+CONF = config.CONF
+
class AttachInterfacesTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
def setUpClass(cls):
- if not cls.config.service_available.neutron:
+ if not CONF.service_available.neutron:
raise cls.skipException("Neutron is required")
# This test class requires network and subnet
cls.set_network_resources(network=True, subnet=True)
diff --git a/tempest/api/compute/servers/test_list_server_filters.py b/tempest/api/compute/servers/test_list_server_filters.py
index 1dc0a39..15b3faa 100644
--- a/tempest/api/compute/servers/test_list_server_filters.py
+++ b/tempest/api/compute/servers/test_list_server_filters.py
@@ -71,7 +71,7 @@
flavor=cls.flavor_ref_alt,
wait_until='ACTIVE')
- cls.fixed_network_name = cls.config.compute.fixed_network_name
+ cls.fixed_network_name = CONF.compute.fixed_network_name
@utils.skip_unless_attr('multiple_images', 'Only one image found')
@attr(type='gate')
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index fea8dd5..f113047 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -369,7 +369,7 @@
resp, server = self.client.shelve_server(self.server_id)
self.assertEqual(202, resp.status)
- offload_time = self.config.compute.shelved_offload_time
+ offload_time = CONF.compute.shelved_offload_time
if offload_time >= 0:
self.client.wait_for_server_status(self.server_id,
'SHELVED_OFFLOADED',
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index 8f49aec..e0181b9 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -19,9 +19,12 @@
from tempest.api.compute import base
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
from tempest import exceptions
from tempest import test
+CONF = config.CONF
+
class ServersNegativeTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@@ -408,7 +411,7 @@
self.assertEqual(202, resp.status)
self.addCleanup(self.client.unshelve_server, self.server_id)
- offload_time = self.config.compute.shelved_offload_time
+ offload_time = CONF.compute.shelved_offload_time
if offload_time >= 0:
self.client.wait_for_server_status(self.server_id,
'SHELVED_OFFLOADED',
diff --git a/tempest/api/compute/servers/test_virtual_interfaces.py b/tempest/api/compute/servers/test_virtual_interfaces.py
index 32376eb..95703d4 100644
--- a/tempest/api/compute/servers/test_virtual_interfaces.py
+++ b/tempest/api/compute/servers/test_virtual_interfaces.py
@@ -19,12 +19,12 @@
from tempest import config
from tempest import test
+CONF = config.CONF
+
class VirtualInterfacesTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
- CONF = config.CONF
-
@classmethod
def setUpClass(cls):
# This test needs a network and a subnet
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index 13b75cf..4774fec 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -16,10 +16,13 @@
from tempest.api.compute import base
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.test import attr
+CONF = config.CONF
+
LOG = logging.getLogger(__name__)
@@ -39,7 +42,7 @@
cls.keypairs_client = cls.os.keypairs_client
cls.security_client = cls.os.security_groups_client
- if cls.config.compute.allow_tenant_isolation:
+ if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_alt_creds()
username, tenant_name, password = creds
cls.alt_manager = clients.Manager(username=username,
diff --git a/tempest/api/compute/test_extensions.py b/tempest/api/compute/test_extensions.py
index aac635c..55146e5 100644
--- a/tempest/api/compute/test_extensions.py
+++ b/tempest/api/compute/test_extensions.py
@@ -15,9 +15,12 @@
from tempest.api.compute import base
+from tempest import config
from tempest.openstack.common import log as logging
from tempest import test
+CONF = config.CONF
+
LOG = logging.getLogger(__name__)
@@ -28,11 +31,11 @@
@test.attr(type='gate')
def test_list_extensions(self):
# List of all extensions
- if len(self.config.compute_feature_enabled.api_extensions) == 0:
+ if len(CONF.compute_feature_enabled.api_extensions) == 0:
raise self.skipException('There are not any extensions configured')
resp, extensions = self.extensions_client.list_extensions()
self.assertEqual(200, resp.status)
- ext = self.config.compute_feature_enabled.api_extensions[0]
+ ext = CONF.compute_feature_enabled.api_extensions[0]
if ext == 'all':
self.assertIn('Hosts', map(lambda x: x['name'], extensions))
elif ext:
diff --git a/tempest/api/compute/test_live_block_migration.py b/tempest/api/compute/test_live_block_migration.py
index 85d314b..fcd055b 100644
--- a/tempest/api/compute/test_live_block_migration.py
+++ b/tempest/api/compute/test_live_block_migration.py
@@ -23,13 +23,13 @@
from tempest import exceptions
from tempest.test import attr
+CONF = config.CONF
+
class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
_host_key = 'OS-EXT-SRV-ATTR:host'
_interface = 'json'
- CONF = config.CONF
-
@classmethod
def setUpClass(cls):
super(LiveBlockMigrationTestJSON, cls).setUpClass()
@@ -57,8 +57,7 @@
def _migrate_server_to(self, server_id, dest_host):
_resp, body = self.admin_servers_client.live_migrate_server(
server_id, dest_host,
- self.config.compute_feature_enabled.
- block_migration_for_live_migration)
+ CONF.compute_feature_enabled.block_migration_for_live_migration)
return body
def _get_host_other_than(self, host):
diff --git a/tempest/api/compute/v3/admin/test_quotas.py b/tempest/api/compute/v3/admin/test_quotas.py
index e116734..ad3519d 100644
--- a/tempest/api/compute/v3/admin/test_quotas.py
+++ b/tempest/api/compute/v3/admin/test_quotas.py
@@ -15,9 +15,12 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
+from tempest import config
from tempest import exceptions
from tempest import test
+CONF = config.CONF
+
class QuotasAdminV3TestJSON(base.BaseV3ComputeAdminTest):
_interface = 'json'
@@ -26,7 +29,7 @@
@classmethod
def setUpClass(cls):
super(QuotasAdminV3TestJSON, cls).setUpClass()
- cls.auth_url = cls.config.identity.uri
+ cls.auth_url = CONF.identity.uri
cls.client = cls.quotas_client
cls.adm_client = cls.quotas_admin_client
cls.identity_admin_client = cls._get_identity_admin_client()
diff --git a/tempest/api/compute/v3/images/test_image_metadata.py b/tempest/api/compute/v3/images/test_image_metadata.py
index d0d2daf..e9ca04a 100644
--- a/tempest/api/compute/v3/images/test_image_metadata.py
+++ b/tempest/api/compute/v3/images/test_image_metadata.py
@@ -15,8 +15,11 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
+from tempest import config
from tempest.test import attr
+CONF = config.CONF
+
class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@@ -24,7 +27,7 @@
@classmethod
def setUpClass(cls):
super(ImagesMetadataTestJSON, cls).setUpClass()
- if not cls.config.service_available.glance:
+ if not CONF.service_available.glance:
skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg)
diff --git a/tempest/api/compute/v3/images/test_images.py b/tempest/api/compute/v3/images/test_images.py
index 52772e0..4ef6f25 100644
--- a/tempest/api/compute/v3/images/test_images.py
+++ b/tempest/api/compute/v3/images/test_images.py
@@ -15,9 +15,12 @@
from tempest.api.compute import base
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
from tempest import exceptions
from tempest.test import attr
+CONF = config.CONF
+
class ImagesV3TestJSON(base.BaseV3ComputeTest):
_interface = 'json'
@@ -25,14 +28,14 @@
@classmethod
def setUpClass(cls):
super(ImagesV3TestJSON, cls).setUpClass()
- if not cls.config.service_available.glance:
+ if not CONF.service_available.glance:
skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg)
cls.client = cls.images_client
cls.servers_client = cls.servers_client
if cls.multi_user:
- if cls.config.compute.allow_tenant_isolation:
+ if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_alt_creds()
username, tenant_name, password = creds
cls.alt_manager = clients.Manager(username=username,
diff --git a/tempest/api/compute/v3/images/test_images_oneserver.py b/tempest/api/compute/v3/images/test_images_oneserver.py
index babf452..c5ab691 100644
--- a/tempest/api/compute/v3/images/test_images_oneserver.py
+++ b/tempest/api/compute/v3/images/test_images_oneserver.py
@@ -55,7 +55,7 @@
def setUpClass(cls):
super(ImagesOneServerTestJSON, cls).setUpClass()
cls.client = cls.images_client
- if not cls.config.service_available.glance:
+ if not CONF.service_available.glance:
skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg)
@@ -69,7 +69,7 @@
cls.image_ids = []
if cls.multi_user:
- if cls.config.compute.allow_tenant_isolation:
+ if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_alt_creds()
username, tenant_name, password = creds
cls.alt_manager = clients.Manager(username=username,
diff --git a/tempest/api/compute/v3/images/test_images_oneserver_negative.py b/tempest/api/compute/v3/images/test_images_oneserver_negative.py
index dc628dc..bebec9a 100644
--- a/tempest/api/compute/v3/images/test_images_oneserver_negative.py
+++ b/tempest/api/compute/v3/images/test_images_oneserver_negative.py
@@ -17,11 +17,14 @@
from tempest.api.compute import base
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.test import attr
from tempest.test import skip_because
+CONF = config.CONF
+
LOG = logging.getLogger(__name__)
@@ -57,7 +60,7 @@
def setUpClass(cls):
super(ImagesOneServerNegativeTestJSON, cls).setUpClass()
cls.client = cls.images_client
- if not cls.config.service_available.glance:
+ if not CONF.service_available.glance:
skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg)
@@ -71,7 +74,7 @@
cls.image_ids = []
if cls.multi_user:
- if cls.config.compute.allow_tenant_isolation:
+ if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_alt_creds()
username, tenant_name, password = creds
cls.alt_manager = clients.Manager(username=username,
diff --git a/tempest/api/compute/v3/images/test_list_image_filters.py b/tempest/api/compute/v3/images/test_list_image_filters.py
index ad93b3d..1459792 100644
--- a/tempest/api/compute/v3/images/test_list_image_filters.py
+++ b/tempest/api/compute/v3/images/test_list_image_filters.py
@@ -14,10 +14,12 @@
# under the License.
from tempest.api.compute import base
+from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.test import attr
+CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -28,7 +30,7 @@
@classmethod
def setUpClass(cls):
super(ListImageFiltersTestJSON, cls).setUpClass()
- if not cls.config.service_available.glance:
+ if not CONF.service_available.glance:
skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg)
cls.client = cls.images_client
diff --git a/tempest/api/compute/v3/servers/test_attach_interfaces.py b/tempest/api/compute/v3/servers/test_attach_interfaces.py
index aa85424..634d06f 100644
--- a/tempest/api/compute/v3/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/v3/servers/test_attach_interfaces.py
@@ -14,18 +14,21 @@
# under the License.
from tempest.api.compute import base
+from tempest import config
from tempest import exceptions
from tempest.test import attr
import time
+CONF = config.CONF
+
class AttachInterfacesV3TestJSON(base.BaseV3ComputeTest):
_interface = 'json'
@classmethod
def setUpClass(cls):
- if not cls.config.service_available.neutron:
+ if not CONF.service_available.neutron:
raise cls.skipException("Neutron is required")
# This test class requires network and subnet
cls.set_network_resources(network=True, subnet=True)
diff --git a/tempest/api/compute/v3/servers/test_attach_volume.py b/tempest/api/compute/v3/servers/test_attach_volume.py
index 2529af9..6ae74ff 100644
--- a/tempest/api/compute/v3/servers/test_attach_volume.py
+++ b/tempest/api/compute/v3/servers/test_attach_volume.py
@@ -36,8 +36,8 @@
@classmethod
def setUpClass(cls):
super(AttachVolumeV3TestJSON, cls).setUpClass()
- cls.device = cls.config.compute.volume_device_name
- if not cls.config.service_available.cinder:
+ cls.device = CONF.compute.volume_device_name
+ if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
diff --git a/tempest/api/compute/v3/servers/test_list_server_filters.py b/tempest/api/compute/v3/servers/test_list_server_filters.py
index 15d6fa2..3638045 100644
--- a/tempest/api/compute/v3/servers/test_list_server_filters.py
+++ b/tempest/api/compute/v3/servers/test_list_server_filters.py
@@ -71,7 +71,7 @@
flavor=cls.flavor_ref_alt,
wait_until='ACTIVE')
- cls.fixed_network_name = cls.config.compute.fixed_network_name
+ cls.fixed_network_name = CONF.compute.fixed_network_name
@utils.skip_unless_attr('multiple_images', 'Only one image found')
@attr(type='gate')
diff --git a/tempest/api/compute/v3/servers/test_server_actions.py b/tempest/api/compute/v3/servers/test_server_actions.py
index fdf23f8..b8dc85b 100644
--- a/tempest/api/compute/v3/servers/test_server_actions.py
+++ b/tempest/api/compute/v3/servers/test_server_actions.py
@@ -359,7 +359,7 @@
resp, server = self.client.shelve_server(self.server_id)
self.assertEqual(202, resp.status)
- offload_time = self.config.compute.shelved_offload_time
+ offload_time = CONF.compute.shelved_offload_time
if offload_time >= 0:
self.client.wait_for_server_status(self.server_id,
'SHELVED_OFFLOADED',
diff --git a/tempest/api/compute/v3/servers/test_servers_negative.py b/tempest/api/compute/v3/servers/test_servers_negative.py
index e58d33d..2e01cd6 100644
--- a/tempest/api/compute/v3/servers/test_servers_negative.py
+++ b/tempest/api/compute/v3/servers/test_servers_negative.py
@@ -19,9 +19,12 @@
from tempest.api.compute import base
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
from tempest import exceptions
from tempest import test
+CONF = config.CONF
+
class ServersNegativeV3TestJSON(base.BaseV3ComputeTest):
_interface = 'json'
@@ -396,7 +399,7 @@
self.assertEqual(202, resp.status)
self.addCleanup(self.client.unshelve_server, self.server_id)
- offload_time = self.config.compute.shelved_offload_time
+ offload_time = CONF.compute.shelved_offload_time
if offload_time >= 0:
self.client.wait_for_server_status(self.server_id,
'SHELVED_OFFLOADED',
diff --git a/tempest/api/compute/v3/test_extensions.py b/tempest/api/compute/v3/test_extensions.py
index 32f62d5..775d70a 100644
--- a/tempest/api/compute/v3/test_extensions.py
+++ b/tempest/api/compute/v3/test_extensions.py
@@ -15,9 +15,11 @@
from tempest.api.compute import base
+from tempest import config
from tempest.openstack.common import log as logging
from tempest import test
+CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -28,11 +30,11 @@
@test.attr(type='gate')
def test_list_extensions(self):
# List of all extensions
- if len(self.config.compute_feature_enabled.api_v3_extensions) == 0:
+ if len(CONF.compute_feature_enabled.api_v3_extensions) == 0:
raise self.skipException('There are not any extensions configured')
resp, extensions = self.extensions_client.list_extensions()
self.assertEqual(200, resp.status)
- ext = self.config.compute_feature_enabled.api_v3_extensions[0]
+ ext = CONF.compute_feature_enabled.api_v3_extensions[0]
if ext == 'all':
self.assertIn('Hosts', map(lambda x: x['name'], extensions))
elif ext:
diff --git a/tempest/api/compute/v3/test_live_block_migration.py b/tempest/api/compute/v3/test_live_block_migration.py
index 087bffb..c881206 100644
--- a/tempest/api/compute/v3/test_live_block_migration.py
+++ b/tempest/api/compute/v3/test_live_block_migration.py
@@ -23,13 +23,13 @@
from tempest import exceptions
from tempest.test import attr
+CONF = config.CONF
+
class LiveBlockMigrationV3TestJSON(base.BaseV3ComputeAdminTest):
_host_key = 'os-extended-server-attributes:host'
_interface = 'json'
- CONF = config.CONF
-
@classmethod
def setUpClass(cls):
super(LiveBlockMigrationV3TestJSON, cls).setUpClass()
@@ -57,7 +57,7 @@
def _migrate_server_to(self, server_id, dest_host):
_resp, body = self.admin_servers_client.live_migrate_server(
server_id, dest_host,
- self.config.compute_feature_enabled.
+ CONF.compute_feature_enabled.
block_migration_for_live_migration)
return body
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index d51bf13..8d8e3ec 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -36,8 +36,8 @@
@classmethod
def setUpClass(cls):
super(AttachVolumeTestJSON, cls).setUpClass()
- cls.device = cls.config.compute.volume_device_name
- if not cls.config.service_available.cinder:
+ cls.device = CONF.compute.volume_device_name
+ if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
diff --git a/tempest/api/compute/volumes/test_volumes_list.py b/tempest/api/compute/volumes/test_volumes_list.py
index ac89f99..bec2ef4 100644
--- a/tempest/api/compute/volumes/test_volumes_list.py
+++ b/tempest/api/compute/volumes/test_volumes_list.py
@@ -15,8 +15,11 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
+from tempest import config
from tempest.test import attr
+CONF = config.CONF
+
class VolumesTestJSON(base.BaseV2ComputeTest):
@@ -34,7 +37,7 @@
def setUpClass(cls):
super(VolumesTestJSON, cls).setUpClass()
cls.client = cls.volumes_extensions_client
- if not cls.config.service_available.cinder:
+ if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
# Create 3 Volumes
diff --git a/tempest/api/compute/volumes/test_volumes_negative.py b/tempest/api/compute/volumes/test_volumes_negative.py
index e01e349..85b30e2 100644
--- a/tempest/api/compute/volumes/test_volumes_negative.py
+++ b/tempest/api/compute/volumes/test_volumes_negative.py
@@ -17,9 +17,12 @@
from tempest.api.compute 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
+
class VolumesNegativeTest(base.BaseV2ComputeTest):
_interface = 'json'
@@ -28,7 +31,7 @@
def setUpClass(cls):
super(VolumesNegativeTest, cls).setUpClass()
cls.client = cls.volumes_extensions_client
- if not cls.config.service_available.cinder:
+ if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)