Merge "Remove last uses of config without global CONF object"

This commit is contained in:
Jenkins 2014-01-31 17:34:03 +00:00 committed by Gerrit Code Review
commit 3e6dfe79b7
5 changed files with 18 additions and 24 deletions

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.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
from testtools.matchers import ContainsAll from testtools.matchers import ContainsAll
CONF = config.CONF
class VolumesGetTestJSON(base.BaseV2ComputeTest): class VolumesGetTestJSON(base.BaseV2ComputeTest):
@ -27,7 +30,7 @@ class VolumesGetTestJSON(base.BaseV2ComputeTest):
def setUpClass(cls): def setUpClass(cls):
super(VolumesGetTestJSON, cls).setUpClass() super(VolumesGetTestJSON, 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)

View File

@ -16,8 +16,11 @@
import cStringIO as StringIO import cStringIO as StringIO
from tempest.api.image import base from tempest.api.image import base
from tempest import config
from tempest.test import attr from tempest.test import attr
CONF = config.CONF
class CreateRegisterImagesTest(base.BaseV1ImageTest): class CreateRegisterImagesTest(base.BaseV1ImageTest):
"""Here we test the registration and creation of images.""" """Here we test the registration and creation of images."""
@ -68,7 +71,7 @@ class CreateRegisterImagesTest(base.BaseV1ImageTest):
resp, body = self.create_image(name='New Http Image', resp, body = self.create_image(name='New Http Image',
container_format='bare', container_format='bare',
disk_format='raw', is_public=True, disk_format='raw', is_public=True,
copy_from=self.config.images.http_image) copy_from=CONF.images.http_image)
self.assertIn('id', body) self.assertIn('id', body)
image_id = body.get('id') image_id = body.get('id')
self.assertEqual('New Http Image', body.get('name')) self.assertEqual('New Http Image', body.get('name'))

View File

@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from tempest import config
from tempest import exceptions from tempest import exceptions
@ -27,7 +26,6 @@ class Manager(object):
""" """
def __init__(self): def __init__(self):
self.config = config.CONF
self.client_attr_names = [] self.client_attr_names = []
# we do this everywhere, have it be part of the super class # we do this everywhere, have it be part of the super class

View File

@ -155,13 +155,12 @@ def is_extension_enabled(extension_name, service):
"""A function that will check the list of enabled extensions from config """A function that will check the list of enabled extensions from config
""" """
configs = CONF
config_dict = { config_dict = {
'compute': configs.compute_feature_enabled.api_extensions, 'compute': CONF.compute_feature_enabled.api_extensions,
'compute_v3': configs.compute_feature_enabled.api_v3_extensions, 'compute_v3': CONF.compute_feature_enabled.api_v3_extensions,
'volume': configs.volume_feature_enabled.api_extensions, 'volume': CONF.volume_feature_enabled.api_extensions,
'network': configs.network_feature_enabled.api_extensions, 'network': CONF.network_feature_enabled.api_extensions,
'object': configs.object_storage_feature_enabled.discoverable_apis, 'object': CONF.object_storage_feature_enabled.discoverable_apis,
} }
if config_dict[service][0] == 'all': if config_dict[service][0] == 'all':
return True return True
@ -224,8 +223,6 @@ class BaseTestCase(testtools.TestCase,
testtools.testcase.WithAttributes, testtools.testcase.WithAttributes,
testresources.ResourcedTestCase): testresources.ResourcedTestCase):
config = CONF
setUpClassCalled = False setUpClassCalled = False
network_resources = {} network_resources = {}
@ -281,7 +278,7 @@ class BaseTestCase(testtools.TestCase,
cls.__name__, network_resources=cls.network_resources) cls.__name__, network_resources=cls.network_resources)
force_tenant_isolation = getattr(cls, 'force_tenant_isolation', None) force_tenant_isolation = getattr(cls, 'force_tenant_isolation', None)
if (cls.config.compute.allow_tenant_isolation or if (CONF.compute.allow_tenant_isolation or
force_tenant_isolation): force_tenant_isolation):
creds = cls.isolated_creds.get_primary_creds() creds = cls.isolated_creds.get_primary_creds()
username, tenant_name, password = creds username, tenant_name, password = creds
@ -310,16 +307,6 @@ class BaseTestCase(testtools.TestCase,
admin_client = os.identity_client admin_client = os.identity_client
return admin_client 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 @classmethod
def set_network_resources(self, network=False, router=False, subnet=False, def set_network_resources(self, network=False, router=False, subnet=False,
dhcp=False): dhcp=False):