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
This commit is contained in:
Matthew Treinish
2014-01-29 16:49:12 +00:00
parent dd33245c77
commit b0a78fc30a
36 changed files with 141 additions and 74 deletions

View File

@@ -14,8 +14,11 @@
# under the License. # under the License.
from tempest.api.compute import base from tempest.api.compute import base
from tempest import config
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class FixedIPsTestJson(base.BaseV2ComputeAdminTest): class FixedIPsTestJson(base.BaseV2ComputeAdminTest):
_interface = 'json' _interface = 'json'
@@ -23,7 +26,7 @@ class FixedIPsTestJson(base.BaseV2ComputeAdminTest):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(FixedIPsTestJson, cls).setUpClass() super(FixedIPsTestJson, cls).setUpClass()
if cls.config.service_available.neutron: if CONF.service_available.neutron:
msg = ("%s skipped as neutron is available" % cls.__name__) msg = ("%s skipped as neutron is available" % cls.__name__)
raise cls.skipException(msg) raise cls.skipException(msg)
cls.client = cls.os_adm.fixed_ips_client cls.client = cls.os_adm.fixed_ips_client

View File

@@ -13,9 +13,12 @@
# under the License. # under the License.
from tempest.api.compute import base from tempest.api.compute import base
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest): class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest):
_interface = 'json' _interface = 'json'
@@ -23,7 +26,7 @@ class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(FixedIPsNegativeTestJson, cls).setUpClass() super(FixedIPsNegativeTestJson, cls).setUpClass()
if cls.config.service_available.neutron: if CONF.service_available.neutron:
msg = ("%s skipped as neutron is available" % cls.__name__) msg = ("%s skipped as neutron is available" % cls.__name__)
raise cls.skipException(msg) raise cls.skipException(msg)
cls.client = cls.os_adm.fixed_ips_client cls.client = cls.os_adm.fixed_ips_client

View File

@@ -17,10 +17,12 @@ import time
from tempest import clients from tempest import clients
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.openstack.common import log as logging from tempest.openstack.common import log as logging
import tempest.test import tempest.test
CONF = config.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@@ -37,15 +39,15 @@ class BaseComputeTest(tempest.test.BaseTestCase):
os = cls.get_client_manager() os = cls.get_client_manager()
cls.os = os cls.os = os
cls.build_interval = cls.config.compute.build_interval cls.build_interval = CONF.compute.build_interval
cls.build_timeout = cls.config.compute.build_timeout cls.build_timeout = CONF.compute.build_timeout
cls.ssh_user = cls.config.compute.ssh_user cls.ssh_user = CONF.compute.ssh_user
cls.image_ref = cls.config.compute.image_ref cls.image_ref = CONF.compute.image_ref
cls.image_ref_alt = cls.config.compute.image_ref_alt cls.image_ref_alt = CONF.compute.image_ref_alt
cls.flavor_ref = cls.config.compute.flavor_ref cls.flavor_ref = CONF.compute.flavor_ref
cls.flavor_ref_alt = cls.config.compute.flavor_ref_alt cls.flavor_ref_alt = CONF.compute.flavor_ref_alt
cls.image_ssh_user = cls.config.compute.image_ssh_user cls.image_ssh_user = CONF.compute.image_ssh_user
cls.image_ssh_password = cls.config.compute.image_ssh_password cls.image_ssh_password = CONF.compute.image_ssh_password
cls.servers = [] cls.servers = []
cls.images = [] cls.images = []
cls.multi_user = cls.get_multi_user() cls.multi_user = cls.get_multi_user()
@@ -57,14 +59,14 @@ class BaseComputeTest(tempest.test.BaseTestCase):
# used in testing. If the test cases are allowed to create # used in testing. If the test cases are allowed to create
# users (config.compute.allow_tenant_isolation is true, # users (config.compute.allow_tenant_isolation is true,
# then we allow multi-user. # then we allow multi-user.
if not cls.config.compute.allow_tenant_isolation: if not CONF.compute.allow_tenant_isolation:
user1 = cls.config.identity.username user1 = CONF.identity.username
user2 = cls.config.identity.alt_username user2 = CONF.identity.alt_username
if not user2 or user1 == user2: if not user2 or user1 == user2:
multi_user = False multi_user = False
else: else:
user2_password = cls.config.identity.alt_password user2_password = CONF.identity.alt_password
user2_tenant_name = cls.config.identity.alt_tenant_name user2_tenant_name = CONF.identity.alt_tenant_name
if not user2_password or not user2_tenant_name: if not user2_password or not user2_tenant_name:
msg = ("Alternate user specified but not alternate " msg = ("Alternate user specified but not alternate "
"tenant or password: alt_tenant_name=%s " "tenant or password: alt_tenant_name=%s "
@@ -234,14 +236,14 @@ class BaseV2ComputeAdminTest(BaseV2ComputeTest):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(BaseV2ComputeAdminTest, cls).setUpClass() super(BaseV2ComputeAdminTest, cls).setUpClass()
admin_username = cls.config.compute_admin.username admin_username = CONF.compute_admin.username
admin_password = cls.config.compute_admin.password admin_password = CONF.compute_admin.password
admin_tenant = cls.config.compute_admin.tenant_name admin_tenant = CONF.compute_admin.tenant_name
if not (admin_username and admin_password and admin_tenant): if not (admin_username and admin_password and admin_tenant):
msg = ("Missing Compute Admin API credentials " msg = ("Missing Compute Admin API credentials "
"in configuration.") "in configuration.")
raise cls.skipException(msg) 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): cls.force_tenant_isolation is True):
creds = cls.isolated_creds.get_admin_creds() creds = cls.isolated_creds.get_admin_creds()
admin_username, admin_tenant_name, admin_password = creds admin_username, admin_tenant_name, admin_password = creds
@@ -265,7 +267,7 @@ class BaseV3ComputeTest(BaseComputeTest):
cls.set_network_resources() cls.set_network_resources()
super(BaseV3ComputeTest, cls).setUpClass() super(BaseV3ComputeTest, cls).setUpClass()
if not cls.config.compute_feature_enabled.api_v3: if not CONF.compute_feature_enabled.api_v3:
cls.tearDownClass() cls.tearDownClass()
skip_msg = ("%s skipped as nova v3 api is not available" % skip_msg = ("%s skipped as nova v3 api is not available" %
cls.__name__) cls.__name__)
@@ -330,14 +332,14 @@ class BaseV3ComputeAdminTest(BaseV3ComputeTest):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(BaseV3ComputeAdminTest, cls).setUpClass() super(BaseV3ComputeAdminTest, cls).setUpClass()
admin_username = cls.config.compute_admin.username admin_username = CONF.compute_admin.username
admin_password = cls.config.compute_admin.password admin_password = CONF.compute_admin.password
admin_tenant = cls.config.compute_admin.tenant_name admin_tenant = CONF.compute_admin.tenant_name
if not (admin_username and admin_password and admin_tenant): if not (admin_username and admin_password and admin_tenant):
msg = ("Missing Compute Admin API credentials " msg = ("Missing Compute Admin API credentials "
"in configuration.") "in configuration.")
raise cls.skipException(msg) raise cls.skipException(msg)
if cls.config.compute.allow_tenant_isolation: if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_admin_creds() creds = cls.isolated_creds.get_admin_creds()
admin_username, admin_tenant_name, admin_password = creds admin_username, admin_tenant_name, admin_password = creds
os_adm = clients.Manager(username=admin_username, os_adm = clients.Manager(username=admin_username,

View File

@@ -17,9 +17,12 @@ import uuid
from tempest.api.compute.floating_ips import base from tempest.api.compute.floating_ips import base
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest): class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest):
_interface = 'json' _interface = 'json'
@@ -40,7 +43,7 @@ class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest):
cls.floating_ip_ids.append(body[i]['id']) cls.floating_ip_ids.append(body[i]['id'])
while True: while True:
cls.non_exist_id = data_utils.rand_int_id(start=999) 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()) cls.non_exist_id = str(uuid.uuid4())
if cls.non_exist_id not in cls.floating_ip_ids: if cls.non_exist_id not in cls.floating_ip_ids:
break break

View File

@@ -17,9 +17,12 @@ import uuid
from tempest.api.compute import base from tempest.api.compute import base
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class FloatingIPDetailsNegativeTestJSON(base.BaseV2ComputeTest): class FloatingIPDetailsNegativeTestJSON(base.BaseV2ComputeTest):
_interface = 'json' _interface = 'json'
@@ -34,7 +37,7 @@ class FloatingIPDetailsNegativeTestJSON(base.BaseV2ComputeTest):
# Negative test:Should not be able to GET the details # Negative test:Should not be able to GET the details
# of non-existent floating IP # of non-existent floating IP
# Creating a non-existent floatingIP id # Creating a non-existent floatingIP id
if self.config.service_available.neutron: if CONF.service_available.neutron:
non_exist_id = str(uuid.uuid4()) non_exist_id = str(uuid.uuid4())
else: else:
non_exist_id = data_utils.rand_int_id(start=999) non_exist_id = data_utils.rand_int_id(start=999)

View File

@@ -15,9 +15,12 @@
from tempest.api.compute import base from tempest.api.compute import base
from tempest import clients from tempest import clients
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class ImagesTestJSON(base.BaseV2ComputeTest): class ImagesTestJSON(base.BaseV2ComputeTest):
_interface = 'json' _interface = 'json'
@@ -25,7 +28,7 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(ImagesTestJSON, cls).setUpClass() 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__) skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg) raise cls.skipException(skip_msg)
cls.client = cls.images_client cls.client = cls.images_client
@@ -34,7 +37,7 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
cls.image_ids = [] cls.image_ids = []
if cls.multi_user: if cls.multi_user:
if cls.config.compute.allow_tenant_isolation: if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_alt_creds() creds = cls.isolated_creds.get_alt_creds()
username, tenant_name, password = creds username, tenant_name, password = creds
cls.alt_manager = clients.Manager(username=username, cls.alt_manager = clients.Manager(username=username,

View File

@@ -55,7 +55,7 @@ class ImagesOneServerTestJSON(base.BaseV2ComputeTest):
def setUpClass(cls): def setUpClass(cls):
super(ImagesOneServerTestJSON, cls).setUpClass() super(ImagesOneServerTestJSON, cls).setUpClass()
cls.client = cls.images_client 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__) skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg) raise cls.skipException(skip_msg)
@@ -69,7 +69,7 @@ class ImagesOneServerTestJSON(base.BaseV2ComputeTest):
cls.image_ids = [] cls.image_ids = []
if cls.multi_user: if cls.multi_user:
if cls.config.compute.allow_tenant_isolation: if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_alt_creds() creds = cls.isolated_creds.get_alt_creds()
username, tenant_name, password = creds username, tenant_name, password = creds
cls.alt_manager = clients.Manager(username=username, cls.alt_manager = clients.Manager(username=username,

View File

@@ -17,11 +17,14 @@
from tempest.api.compute import base from tempest.api.compute import base
from tempest import clients from tempest import clients
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.openstack.common import log as logging from tempest.openstack.common import log as logging
from tempest.test import attr from tempest.test import attr
from tempest.test import skip_because from tempest.test import skip_because
CONF = config.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@@ -57,7 +60,7 @@ class ImagesOneServerNegativeTestJSON(base.BaseV2ComputeTest):
def setUpClass(cls): def setUpClass(cls):
super(ImagesOneServerNegativeTestJSON, cls).setUpClass() super(ImagesOneServerNegativeTestJSON, cls).setUpClass()
cls.client = cls.images_client 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__) skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg) raise cls.skipException(skip_msg)
@@ -71,7 +74,7 @@ class ImagesOneServerNegativeTestJSON(base.BaseV2ComputeTest):
cls.image_ids = [] cls.image_ids = []
if cls.multi_user: if cls.multi_user:
if cls.config.compute.allow_tenant_isolation: if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_alt_creds() creds = cls.isolated_creds.get_alt_creds()
username, tenant_name, password = creds username, tenant_name, password = creds
cls.alt_manager = clients.Manager(username=username, cls.alt_manager = clients.Manager(username=username,

View File

@@ -14,10 +14,12 @@
# under the License. # under the License.
from tempest.api.compute import base from tempest.api.compute import base
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.openstack.common import log as logging from tempest.openstack.common import log as logging
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@@ -28,7 +30,7 @@ class ListImageFiltersTestJSON(base.BaseV2ComputeTest):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(ListImageFiltersTestJSON, cls).setUpClass() 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__) skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg) raise cls.skipException(skip_msg)
cls.client = cls.images_client cls.client = cls.images_client

View File

@@ -14,8 +14,11 @@
# under the License. # under the License.
from tempest.api.compute import base from tempest.api.compute import base
from tempest import config
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class ListImagesTestJSON(base.BaseV2ComputeTest): class ListImagesTestJSON(base.BaseV2ComputeTest):
_interface = 'json' _interface = 'json'
@@ -23,7 +26,7 @@ class ListImagesTestJSON(base.BaseV2ComputeTest):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(ListImagesTestJSON, cls).setUpClass() 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__) skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg) raise cls.skipException(skip_msg)
cls.client = cls.images_client cls.client = cls.images_client

View File

@@ -15,8 +15,11 @@
from tempest.api.compute.security_groups import base from tempest.api.compute.security_groups import base
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest): class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest):
_interface = 'json' _interface = 'json'
@@ -25,7 +28,7 @@ class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest):
def setUpClass(cls): def setUpClass(cls):
super(SecurityGroupRulesTestJSON, cls).setUpClass() super(SecurityGroupRulesTestJSON, cls).setUpClass()
cls.client = cls.security_groups_client cls.client = cls.security_groups_client
cls.neutron_available = cls.config.service_available.neutron cls.neutron_available = CONF.service_available.neutron
@attr(type='smoke') @attr(type='smoke')
def test_security_group_rules_create(self): def test_security_group_rules_create(self):

View File

@@ -31,7 +31,7 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest):
def setUpClass(cls): def setUpClass(cls):
super(SecurityGroupsNegativeTestJSON, cls).setUpClass() super(SecurityGroupsNegativeTestJSON, cls).setUpClass()
cls.client = cls.security_groups_client 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): def _delete_security_group(self, securitygroup_id):
resp, _ = self.client.delete_security_group(securitygroup_id) resp, _ = self.client.delete_security_group(securitygroup_id)

View File

@@ -14,18 +14,21 @@
# under the License. # under the License.
from tempest.api.compute import base from tempest.api.compute import base
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.test import attr from tempest.test import attr
import time import time
CONF = config.CONF
class AttachInterfacesTestJSON(base.BaseV2ComputeTest): class AttachInterfacesTestJSON(base.BaseV2ComputeTest):
_interface = 'json' _interface = 'json'
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
if not cls.config.service_available.neutron: if not CONF.service_available.neutron:
raise cls.skipException("Neutron is required") raise cls.skipException("Neutron is required")
# This test class requires network and subnet # This test class requires network and subnet
cls.set_network_resources(network=True, subnet=True) cls.set_network_resources(network=True, subnet=True)

View File

@@ -71,7 +71,7 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
flavor=cls.flavor_ref_alt, flavor=cls.flavor_ref_alt,
wait_until='ACTIVE') 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') @utils.skip_unless_attr('multiple_images', 'Only one image found')
@attr(type='gate') @attr(type='gate')

View File

@@ -369,7 +369,7 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
resp, server = self.client.shelve_server(self.server_id) resp, server = self.client.shelve_server(self.server_id)
self.assertEqual(202, resp.status) self.assertEqual(202, resp.status)
offload_time = self.config.compute.shelved_offload_time offload_time = CONF.compute.shelved_offload_time
if offload_time >= 0: if offload_time >= 0:
self.client.wait_for_server_status(self.server_id, self.client.wait_for_server_status(self.server_id,
'SHELVED_OFFLOADED', 'SHELVED_OFFLOADED',

View File

@@ -19,9 +19,12 @@ import sys
from tempest.api.compute import base from tempest.api.compute import base
from tempest import clients from tempest import clients
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest import test from tempest import test
CONF = config.CONF
class ServersNegativeTestJSON(base.BaseV2ComputeTest): class ServersNegativeTestJSON(base.BaseV2ComputeTest):
_interface = 'json' _interface = 'json'
@@ -408,7 +411,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
self.assertEqual(202, resp.status) self.assertEqual(202, resp.status)
self.addCleanup(self.client.unshelve_server, self.server_id) 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: if offload_time >= 0:
self.client.wait_for_server_status(self.server_id, self.client.wait_for_server_status(self.server_id,
'SHELVED_OFFLOADED', 'SHELVED_OFFLOADED',

View File

@@ -19,12 +19,12 @@ from tempest.api.compute import base
from tempest import config from tempest import config
from tempest import test from tempest import test
CONF = config.CONF
class VirtualInterfacesTestJSON(base.BaseV2ComputeTest): class VirtualInterfacesTestJSON(base.BaseV2ComputeTest):
_interface = 'json' _interface = 'json'
CONF = config.CONF
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
# This test needs a network and a subnet # This test needs a network and a subnet

View File

@@ -16,10 +16,13 @@
from tempest.api.compute import base from tempest.api.compute import base
from tempest import clients from tempest import clients
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.openstack.common import log as logging from tempest.openstack.common import log as logging
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@@ -39,7 +42,7 @@ class AuthorizationTestJSON(base.BaseV2ComputeTest):
cls.keypairs_client = cls.os.keypairs_client cls.keypairs_client = cls.os.keypairs_client
cls.security_client = cls.os.security_groups_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() creds = cls.isolated_creds.get_alt_creds()
username, tenant_name, password = creds username, tenant_name, password = creds
cls.alt_manager = clients.Manager(username=username, cls.alt_manager = clients.Manager(username=username,

View File

@@ -15,9 +15,12 @@
from tempest.api.compute import base from tempest.api.compute import base
from tempest import config
from tempest.openstack.common import log as logging from tempest.openstack.common import log as logging
from tempest import test from tempest import test
CONF = config.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@@ -28,11 +31,11 @@ class ExtensionsTestJSON(base.BaseV2ComputeTest):
@test.attr(type='gate') @test.attr(type='gate')
def test_list_extensions(self): def test_list_extensions(self):
# List of all extensions # 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') raise self.skipException('There are not any extensions configured')
resp, extensions = self.extensions_client.list_extensions() resp, extensions = self.extensions_client.list_extensions()
self.assertEqual(200, resp.status) 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': if ext == 'all':
self.assertIn('Hosts', map(lambda x: x['name'], extensions)) self.assertIn('Hosts', map(lambda x: x['name'], extensions))
elif ext: elif ext:

View File

@@ -23,13 +23,13 @@ from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest): class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
_host_key = 'OS-EXT-SRV-ATTR:host' _host_key = 'OS-EXT-SRV-ATTR:host'
_interface = 'json' _interface = 'json'
CONF = config.CONF
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(LiveBlockMigrationTestJSON, cls).setUpClass() super(LiveBlockMigrationTestJSON, cls).setUpClass()
@@ -57,8 +57,7 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
def _migrate_server_to(self, server_id, dest_host): def _migrate_server_to(self, server_id, dest_host):
_resp, body = self.admin_servers_client.live_migrate_server( _resp, body = self.admin_servers_client.live_migrate_server(
server_id, dest_host, server_id, dest_host,
self.config.compute_feature_enabled. CONF.compute_feature_enabled.block_migration_for_live_migration)
block_migration_for_live_migration)
return body return body
def _get_host_other_than(self, host): def _get_host_other_than(self, host):

View File

@@ -15,9 +15,12 @@
from tempest.api.compute import base from tempest.api.compute import base
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest import test from tempest import test
CONF = config.CONF
class QuotasAdminV3TestJSON(base.BaseV3ComputeAdminTest): class QuotasAdminV3TestJSON(base.BaseV3ComputeAdminTest):
_interface = 'json' _interface = 'json'
@@ -26,7 +29,7 @@ class QuotasAdminV3TestJSON(base.BaseV3ComputeAdminTest):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(QuotasAdminV3TestJSON, cls).setUpClass() super(QuotasAdminV3TestJSON, cls).setUpClass()
cls.auth_url = cls.config.identity.uri cls.auth_url = CONF.identity.uri
cls.client = cls.quotas_client cls.client = cls.quotas_client
cls.adm_client = cls.quotas_admin_client cls.adm_client = cls.quotas_admin_client
cls.identity_admin_client = cls._get_identity_admin_client() cls.identity_admin_client = cls._get_identity_admin_client()

View File

@@ -15,8 +15,11 @@
from tempest.api.compute import base from tempest.api.compute import base
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class ImagesMetadataTestJSON(base.BaseV2ComputeTest): class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
_interface = 'json' _interface = 'json'
@@ -24,7 +27,7 @@ class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(ImagesMetadataTestJSON, cls).setUpClass() 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__) skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg) raise cls.skipException(skip_msg)

View File

@@ -15,9 +15,12 @@
from tempest.api.compute import base from tempest.api.compute import base
from tempest import clients from tempest import clients
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class ImagesV3TestJSON(base.BaseV3ComputeTest): class ImagesV3TestJSON(base.BaseV3ComputeTest):
_interface = 'json' _interface = 'json'
@@ -25,14 +28,14 @@ class ImagesV3TestJSON(base.BaseV3ComputeTest):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(ImagesV3TestJSON, cls).setUpClass() 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__) skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg) raise cls.skipException(skip_msg)
cls.client = cls.images_client cls.client = cls.images_client
cls.servers_client = cls.servers_client cls.servers_client = cls.servers_client
if cls.multi_user: if cls.multi_user:
if cls.config.compute.allow_tenant_isolation: if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_alt_creds() creds = cls.isolated_creds.get_alt_creds()
username, tenant_name, password = creds username, tenant_name, password = creds
cls.alt_manager = clients.Manager(username=username, cls.alt_manager = clients.Manager(username=username,

View File

@@ -55,7 +55,7 @@ class ImagesOneServerTestJSON(base.BaseV2ComputeTest):
def setUpClass(cls): def setUpClass(cls):
super(ImagesOneServerTestJSON, cls).setUpClass() super(ImagesOneServerTestJSON, cls).setUpClass()
cls.client = cls.images_client 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__) skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg) raise cls.skipException(skip_msg)
@@ -69,7 +69,7 @@ class ImagesOneServerTestJSON(base.BaseV2ComputeTest):
cls.image_ids = [] cls.image_ids = []
if cls.multi_user: if cls.multi_user:
if cls.config.compute.allow_tenant_isolation: if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_alt_creds() creds = cls.isolated_creds.get_alt_creds()
username, tenant_name, password = creds username, tenant_name, password = creds
cls.alt_manager = clients.Manager(username=username, cls.alt_manager = clients.Manager(username=username,

View File

@@ -17,11 +17,14 @@
from tempest.api.compute import base from tempest.api.compute import base
from tempest import clients from tempest import clients
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.openstack.common import log as logging from tempest.openstack.common import log as logging
from tempest.test import attr from tempest.test import attr
from tempest.test import skip_because from tempest.test import skip_because
CONF = config.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@@ -57,7 +60,7 @@ class ImagesOneServerNegativeTestJSON(base.BaseV2ComputeTest):
def setUpClass(cls): def setUpClass(cls):
super(ImagesOneServerNegativeTestJSON, cls).setUpClass() super(ImagesOneServerNegativeTestJSON, cls).setUpClass()
cls.client = cls.images_client 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__) skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg) raise cls.skipException(skip_msg)
@@ -71,7 +74,7 @@ class ImagesOneServerNegativeTestJSON(base.BaseV2ComputeTest):
cls.image_ids = [] cls.image_ids = []
if cls.multi_user: if cls.multi_user:
if cls.config.compute.allow_tenant_isolation: if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_alt_creds() creds = cls.isolated_creds.get_alt_creds()
username, tenant_name, password = creds username, tenant_name, password = creds
cls.alt_manager = clients.Manager(username=username, cls.alt_manager = clients.Manager(username=username,

View File

@@ -14,10 +14,12 @@
# under the License. # under the License.
from tempest.api.compute import base from tempest.api.compute import base
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.openstack.common import log as logging from tempest.openstack.common import log as logging
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@@ -28,7 +30,7 @@ class ListImageFiltersTestJSON(base.BaseV2ComputeTest):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(ListImageFiltersTestJSON, cls).setUpClass() 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__) skip_msg = ("%s skipped as glance is not available" % cls.__name__)
raise cls.skipException(skip_msg) raise cls.skipException(skip_msg)
cls.client = cls.images_client cls.client = cls.images_client

View File

@@ -14,18 +14,21 @@
# under the License. # under the License.
from tempest.api.compute import base from tempest.api.compute import base
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.test import attr from tempest.test import attr
import time import time
CONF = config.CONF
class AttachInterfacesV3TestJSON(base.BaseV3ComputeTest): class AttachInterfacesV3TestJSON(base.BaseV3ComputeTest):
_interface = 'json' _interface = 'json'
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
if not cls.config.service_available.neutron: if not CONF.service_available.neutron:
raise cls.skipException("Neutron is required") raise cls.skipException("Neutron is required")
# This test class requires network and subnet # This test class requires network and subnet
cls.set_network_resources(network=True, subnet=True) cls.set_network_resources(network=True, subnet=True)

View File

@@ -36,8 +36,8 @@ class AttachVolumeV3TestJSON(base.BaseV3ComputeTest):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(AttachVolumeV3TestJSON, cls).setUpClass() super(AttachVolumeV3TestJSON, cls).setUpClass()
cls.device = cls.config.compute.volume_device_name cls.device = CONF.compute.volume_device_name
if not cls.config.service_available.cinder: if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__) skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg) raise cls.skipException(skip_msg)

View File

@@ -71,7 +71,7 @@ class ListServerFiltersV3TestJSON(base.BaseV3ComputeTest):
flavor=cls.flavor_ref_alt, flavor=cls.flavor_ref_alt,
wait_until='ACTIVE') 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') @utils.skip_unless_attr('multiple_images', 'Only one image found')
@attr(type='gate') @attr(type='gate')

View File

@@ -359,7 +359,7 @@ class ServerActionsV3TestJSON(base.BaseV3ComputeTest):
resp, server = self.client.shelve_server(self.server_id) resp, server = self.client.shelve_server(self.server_id)
self.assertEqual(202, resp.status) self.assertEqual(202, resp.status)
offload_time = self.config.compute.shelved_offload_time offload_time = CONF.compute.shelved_offload_time
if offload_time >= 0: if offload_time >= 0:
self.client.wait_for_server_status(self.server_id, self.client.wait_for_server_status(self.server_id,
'SHELVED_OFFLOADED', 'SHELVED_OFFLOADED',

View File

@@ -19,9 +19,12 @@ import sys
from tempest.api.compute import base from tempest.api.compute import base
from tempest import clients from tempest import clients
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest import test from tempest import test
CONF = config.CONF
class ServersNegativeV3TestJSON(base.BaseV3ComputeTest): class ServersNegativeV3TestJSON(base.BaseV3ComputeTest):
_interface = 'json' _interface = 'json'
@@ -396,7 +399,7 @@ class ServersNegativeV3TestJSON(base.BaseV3ComputeTest):
self.assertEqual(202, resp.status) self.assertEqual(202, resp.status)
self.addCleanup(self.client.unshelve_server, self.server_id) 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: if offload_time >= 0:
self.client.wait_for_server_status(self.server_id, self.client.wait_for_server_status(self.server_id,
'SHELVED_OFFLOADED', 'SHELVED_OFFLOADED',

View File

@@ -15,9 +15,11 @@
from tempest.api.compute import base from tempest.api.compute import base
from tempest import config
from tempest.openstack.common import log as logging from tempest.openstack.common import log as logging
from tempest import test from tempest import test
CONF = config.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@@ -28,11 +30,11 @@ class ExtensionsV3TestJSON(base.BaseV3ComputeTest):
@test.attr(type='gate') @test.attr(type='gate')
def test_list_extensions(self): def test_list_extensions(self):
# List of all extensions # 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') raise self.skipException('There are not any extensions configured')
resp, extensions = self.extensions_client.list_extensions() resp, extensions = self.extensions_client.list_extensions()
self.assertEqual(200, resp.status) 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': if ext == 'all':
self.assertIn('Hosts', map(lambda x: x['name'], extensions)) self.assertIn('Hosts', map(lambda x: x['name'], extensions))
elif ext: elif ext:

View File

@@ -23,13 +23,13 @@ from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class LiveBlockMigrationV3TestJSON(base.BaseV3ComputeAdminTest): class LiveBlockMigrationV3TestJSON(base.BaseV3ComputeAdminTest):
_host_key = 'os-extended-server-attributes:host' _host_key = 'os-extended-server-attributes:host'
_interface = 'json' _interface = 'json'
CONF = config.CONF
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(LiveBlockMigrationV3TestJSON, cls).setUpClass() super(LiveBlockMigrationV3TestJSON, cls).setUpClass()
@@ -57,7 +57,7 @@ class LiveBlockMigrationV3TestJSON(base.BaseV3ComputeAdminTest):
def _migrate_server_to(self, server_id, dest_host): def _migrate_server_to(self, server_id, dest_host):
_resp, body = self.admin_servers_client.live_migrate_server( _resp, body = self.admin_servers_client.live_migrate_server(
server_id, dest_host, server_id, dest_host,
self.config.compute_feature_enabled. CONF.compute_feature_enabled.
block_migration_for_live_migration) block_migration_for_live_migration)
return body return body

View File

@@ -36,8 +36,8 @@ class AttachVolumeTestJSON(base.BaseV2ComputeTest):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(AttachVolumeTestJSON, cls).setUpClass() super(AttachVolumeTestJSON, cls).setUpClass()
cls.device = cls.config.compute.volume_device_name cls.device = CONF.compute.volume_device_name
if not cls.config.service_available.cinder: if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__) skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg) raise cls.skipException(skip_msg)

View File

@@ -15,8 +15,11 @@
from tempest.api.compute import base from tempest.api.compute import base
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class VolumesTestJSON(base.BaseV2ComputeTest): class VolumesTestJSON(base.BaseV2ComputeTest):
@@ -34,7 +37,7 @@ class VolumesTestJSON(base.BaseV2ComputeTest):
def setUpClass(cls): def setUpClass(cls):
super(VolumesTestJSON, cls).setUpClass() super(VolumesTestJSON, cls).setUpClass()
cls.client = cls.volumes_extensions_client 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__) skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg) raise cls.skipException(skip_msg)
# Create 3 Volumes # Create 3 Volumes

View File

@@ -17,9 +17,12 @@ import uuid
from tempest.api.compute import base from tempest.api.compute import base
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions from tempest import exceptions
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class VolumesNegativeTest(base.BaseV2ComputeTest): class VolumesNegativeTest(base.BaseV2ComputeTest):
_interface = 'json' _interface = 'json'
@@ -28,7 +31,7 @@ class VolumesNegativeTest(base.BaseV2ComputeTest):
def setUpClass(cls): def setUpClass(cls):
super(VolumesNegativeTest, cls).setUpClass() super(VolumesNegativeTest, cls).setUpClass()
cls.client = cls.volumes_extensions_client 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__) skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg) raise cls.skipException(skip_msg)