moving to global lazy loaded config
one of the problems we've got with tempest is the fact that config loading is tied into the class hierarchy. However there is no reason why it should be. If we instead create a config proxy object we can lazy load the actual config when we are executing, and not do it at import time. This could use future iteration, but it does a huge job in removing config from the object inheritance tree which massively simplifies our ability to use config variables throughout the code. Change-Id: I9b1bbfe231c85c01938bd68be4e5974bd24130d6
This commit is contained in:
parent
9ac0da7fb8
commit
86bd8427e3
|
@ -15,13 +15,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from tempest import config
|
||||
# from tempest import config
|
||||
from tempest.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
CONFIG = config.TempestConfig()
|
||||
CREATE_IMAGE_ENABLED = CONFIG.compute_feature_enabled.create_image
|
||||
RESIZE_AVAILABLE = CONFIG.compute_feature_enabled.resize
|
||||
CHANGE_PASSWORD_AVAILABLE = CONFIG.compute_feature_enabled.change_password
|
||||
DISK_CONFIG_ENABLED = CONFIG.compute_feature_enabled.disk_config
|
||||
# CONFIG = config.CONF
|
||||
# CREATE_IMAGE_ENABLED = CONFIG.compute_feature_enabled.create_image
|
||||
# RESIZE_AVAILABLE = CONFIG.compute_feature_enabled.resize
|
||||
# CHANGE_PASSWORD_AVAILABLE = CONFIG.compute_feature_enabled.change_password
|
||||
# DISK_CONFIG_ENABLED = CONFIG.compute_feature_enabled.disk_config
|
||||
|
|
|
@ -22,6 +22,8 @@ from tempest import exceptions
|
|||
from tempest.test import attr
|
||||
from tempest.test import skip_because
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class QuotasAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
_interface = 'json'
|
||||
|
@ -156,7 +158,7 @@ class QuotasAdminTestJSON(base.BaseV2ComputeAdminTest):
|
|||
self.assertRaises(exceptions.OverLimit, self.create_test_server)
|
||||
|
||||
@skip_because(bug="1186354",
|
||||
condition=config.TempestConfig().service_available.neutron)
|
||||
condition=CONF.service_available.neutron)
|
||||
@attr(type=['negative', 'gate'])
|
||||
def test_security_groups_exceed_limit(self):
|
||||
# Negative test: Creation Security Groups over limit should FAIL
|
||||
|
@ -180,7 +182,7 @@ class QuotasAdminTestJSON(base.BaseV2ComputeAdminTest):
|
|||
"sg-overlimit", "sg-desc")
|
||||
|
||||
@skip_because(bug="1186354",
|
||||
condition=config.TempestConfig().service_available.neutron)
|
||||
condition=CONF.service_available.neutron)
|
||||
@attr(type=['negative', 'gate'])
|
||||
def test_security_groups_rules_exceed_limit(self):
|
||||
# Negative test: Creation of Security Group Rules should FAIL
|
||||
|
|
|
@ -22,6 +22,8 @@ from tempest.common.utils import data_utils
|
|||
from tempest import config
|
||||
from tempest.test import attr
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class SecurityGroupsTestAdminJSON(base.BaseV2ComputeAdminTest):
|
||||
_interface = 'json'
|
||||
|
@ -40,7 +42,7 @@ class SecurityGroupsTestAdminJSON(base.BaseV2ComputeAdminTest):
|
|||
|
||||
self.assertEqual(202, resp.status)
|
||||
|
||||
@testtools.skipIf(config.TempestConfig().service_available.neutron,
|
||||
@testtools.skipIf(CONF.service_available.neutron,
|
||||
"Skipped because neutron do not support all_tenants"
|
||||
"search filter.")
|
||||
@attr(type='smoke')
|
||||
|
|
|
@ -17,13 +17,14 @@
|
|||
|
||||
import testtools
|
||||
|
||||
from tempest.api import compute
|
||||
from tempest.api.compute import base
|
||||
from tempest import clients
|
||||
from tempest.common.utils import data_utils
|
||||
from tempest import config
|
||||
from tempest.openstack.common import log as logging
|
||||
from tempest.test import attr
|
||||
|
||||
CONF = config.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -84,7 +85,7 @@ class ImagesOneServerTestJSON(base.BaseV2ComputeTest):
|
|||
resp, flavor = self.flavors_client.get_flavor_details(flavor_id)
|
||||
return flavor['disk']
|
||||
|
||||
@testtools.skipUnless(compute.CREATE_IMAGE_ENABLED,
|
||||
@testtools.skipUnless(CONF.compute_feature_enabled.create_image,
|
||||
'Environment unable to create images.')
|
||||
@attr(type='smoke')
|
||||
def test_create_delete_image(self):
|
||||
|
|
|
@ -24,6 +24,8 @@ from tempest import exceptions
|
|||
from tempest.test import attr
|
||||
from tempest.test import skip_because
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class SecurityGroupRulesNegativeTestJSON(base.BaseV2ComputeTest):
|
||||
_interface = 'json'
|
||||
|
@ -34,7 +36,7 @@ class SecurityGroupRulesNegativeTestJSON(base.BaseV2ComputeTest):
|
|||
cls.client = cls.security_groups_client
|
||||
|
||||
@skip_because(bug="1182384",
|
||||
condition=config.TempestConfig().service_available.neutron)
|
||||
condition=CONF.service_available.neutron)
|
||||
@attr(type=['negative', 'smoke'])
|
||||
def test_create_security_group_rule_with_non_existent_id(self):
|
||||
# Negative test: Creation of Security Group rule should FAIL
|
||||
|
@ -48,7 +50,7 @@ class SecurityGroupRulesNegativeTestJSON(base.BaseV2ComputeTest):
|
|||
self.client.create_security_group_rule,
|
||||
parent_group_id, ip_protocol, from_port, to_port)
|
||||
|
||||
@testtools.skipIf(config.TempestConfig().service_available.neutron,
|
||||
@testtools.skipIf(CONF.service_available.neutron,
|
||||
"Neutron not check the security_group_id")
|
||||
@attr(type=['negative', 'smoke'])
|
||||
def test_create_security_group_rule_with_invalid_id(self):
|
||||
|
@ -168,7 +170,7 @@ class SecurityGroupRulesNegativeTestJSON(base.BaseV2ComputeTest):
|
|||
secgroup_id, ip_protocol, from_port, to_port)
|
||||
|
||||
@skip_because(bug="1182384",
|
||||
condition=config.TempestConfig().service_available.neutron)
|
||||
condition=CONF.service_available.neutron)
|
||||
@attr(type=['negative', 'smoke'])
|
||||
def test_delete_security_group_rule_with_non_existent_id(self):
|
||||
# Negative test: Deletion of Security Group rule should be FAIL
|
||||
|
|
|
@ -25,6 +25,8 @@ from tempest import exceptions
|
|||
from tempest.test import attr
|
||||
from tempest.test import skip_because
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class SecurityGroupsTestJSON(base.BaseV2ComputeTest):
|
||||
_interface = 'json'
|
||||
|
@ -129,7 +131,7 @@ class SecurityGroupsTestJSON(base.BaseV2ComputeTest):
|
|||
non_exist_id)
|
||||
|
||||
@skip_because(bug="1161411",
|
||||
condition=config.TempestConfig().service_available.neutron)
|
||||
condition=CONF.service_available.neutron)
|
||||
@attr(type=['negative', 'gate'])
|
||||
def test_security_group_create_with_invalid_group_name(self):
|
||||
# Negative test: Security Group should not be created with group name
|
||||
|
@ -149,7 +151,7 @@ class SecurityGroupsTestJSON(base.BaseV2ComputeTest):
|
|||
s_description)
|
||||
|
||||
@skip_because(bug="1161411",
|
||||
condition=config.TempestConfig().service_available.neutron)
|
||||
condition=CONF.service_available.neutron)
|
||||
@attr(type=['negative', 'gate'])
|
||||
def test_security_group_create_with_invalid_group_description(self):
|
||||
# Negative test:Security Group should not be created with description
|
||||
|
@ -167,7 +169,7 @@ class SecurityGroupsTestJSON(base.BaseV2ComputeTest):
|
|||
self.client.create_security_group, s_name,
|
||||
s_description)
|
||||
|
||||
@testtools.skipIf(config.TempestConfig().service_available.neutron,
|
||||
@testtools.skipIf(CONF.service_available.neutron,
|
||||
"Neutron allows duplicate names for security groups")
|
||||
@attr(type=['negative', 'gate'])
|
||||
def test_security_group_create_with_duplicate_name(self):
|
||||
|
|
|
@ -20,17 +20,18 @@ import base64
|
|||
import netaddr
|
||||
import testtools
|
||||
|
||||
from tempest.api import compute
|
||||
from tempest.api.compute import base
|
||||
from tempest.common.utils import data_utils
|
||||
from tempest.common.utils.linux.remote_client import RemoteClient
|
||||
import tempest.config
|
||||
from tempest import config
|
||||
from tempest.test import attr
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ServersTestJSON(base.BaseV2ComputeTest):
|
||||
_interface = 'json'
|
||||
run_ssh = tempest.config.TempestConfig().compute.run_ssh
|
||||
run_ssh = CONF.compute.run_ssh
|
||||
disk_config = 'AUTO'
|
||||
|
||||
@classmethod
|
||||
|
@ -113,7 +114,7 @@ class ServersTestManualDisk(ServersTestJSON):
|
|||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
if not compute.DISK_CONFIG_ENABLED:
|
||||
if not CONF.compute_feature_enabled.disk_config:
|
||||
msg = "DiskConfig extension not enabled."
|
||||
raise cls.skipException(msg)
|
||||
super(ServersTestManualDisk, cls).setUpClass()
|
||||
|
|
|
@ -17,17 +17,19 @@
|
|||
|
||||
import testtools
|
||||
|
||||
from tempest.api import compute
|
||||
from tempest.api.compute import base
|
||||
from tempest import config
|
||||
from tempest.test import attr
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ServerDiskConfigTestJSON(base.BaseV2ComputeTest):
|
||||
_interface = 'json'
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
if not compute.DISK_CONFIG_ENABLED:
|
||||
if not CONF.compute_feature_enabled.disk_config:
|
||||
msg = "DiskConfig extension not enabled."
|
||||
raise cls.skipException(msg)
|
||||
super(ServerDiskConfigTestJSON, cls).setUpClass()
|
||||
|
@ -85,7 +87,8 @@ class ServerDiskConfigTestJSON(base.BaseV2ComputeTest):
|
|||
else:
|
||||
return self.flavor_ref
|
||||
|
||||
@testtools.skipUnless(compute.RESIZE_AVAILABLE, 'Resize not available.')
|
||||
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
|
||||
'Resize not available.')
|
||||
@attr(type='gate')
|
||||
def test_resize_server_from_manual_to_auto(self):
|
||||
# A server should be resized from manual to auto disk config
|
||||
|
@ -101,7 +104,8 @@ class ServerDiskConfigTestJSON(base.BaseV2ComputeTest):
|
|||
resp, server = self.client.get_server(self.server_id)
|
||||
self.assertEqual('AUTO', server['OS-DCF:diskConfig'])
|
||||
|
||||
@testtools.skipUnless(compute.RESIZE_AVAILABLE, 'Resize not available.')
|
||||
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
|
||||
'Resize not available.')
|
||||
@attr(type='gate')
|
||||
def test_resize_server_from_auto_to_manual(self):
|
||||
# A server should be resized from auto to manual disk config
|
||||
|
|
|
@ -23,6 +23,8 @@ from tempest import exceptions
|
|||
from tempest.test import attr
|
||||
from tempest.test import skip_because
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
|
||||
_interface = 'json'
|
||||
|
@ -210,7 +212,7 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
|
|||
self.assertNotIn(self.s3_name, map(lambda x: x['name'], servers))
|
||||
|
||||
@skip_because(bug="1182883",
|
||||
condition=config.TempestConfig().service_available.neutron)
|
||||
condition=CONF.service_available.neutron)
|
||||
@attr(type='gate')
|
||||
def test_list_servers_filtered_by_ip_regex(self):
|
||||
# Filter servers by regex ip
|
||||
|
|
|
@ -20,21 +20,21 @@ import time
|
|||
|
||||
import testtools
|
||||
|
||||
from tempest.api import compute
|
||||
from tempest.api.compute import base
|
||||
from tempest.common.utils import data_utils
|
||||
from tempest.common.utils.linux.remote_client import RemoteClient
|
||||
import tempest.config
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.test import attr
|
||||
from tempest.test import skip_because
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ServerActionsTestJSON(base.BaseV2ComputeTest):
|
||||
_interface = 'json'
|
||||
resize_available = tempest.config.TempestConfig().\
|
||||
compute_feature_enabled.resize
|
||||
run_ssh = tempest.config.TempestConfig().compute.run_ssh
|
||||
resize_available = CONF.compute_feature_enabled.resize
|
||||
run_ssh = CONF.compute.run_ssh
|
||||
|
||||
def setUp(self):
|
||||
# NOTE(afazekas): Normally we use the same server with all test cases,
|
||||
|
@ -53,7 +53,7 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
|
|||
cls.client = cls.servers_client
|
||||
cls.server_id = cls.rebuild_server(None)
|
||||
|
||||
@testtools.skipUnless(compute.CHANGE_PASSWORD_AVAILABLE,
|
||||
@testtools.skipUnless(CONF.compute_feature_enabled.change_password,
|
||||
'Change password not available.')
|
||||
@attr(type='gate')
|
||||
def test_change_server_password(self):
|
||||
|
|
|
@ -28,7 +28,7 @@ from tempest.test import skip_because
|
|||
class VirtualInterfacesTestJSON(base.BaseV2ComputeTest):
|
||||
_interface = 'json'
|
||||
|
||||
CONF = config.TempestConfig()
|
||||
CONF = config.CONF
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
|
|
@ -18,6 +18,8 @@ import testtools
|
|||
from tempest.api.compute import base
|
||||
import tempest.config as config
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class AuthTokenTestJSON(base.BaseV2ComputeTest):
|
||||
_interface = 'json'
|
||||
|
@ -37,7 +39,7 @@ class AuthTokenTestJSON(base.BaseV2ComputeTest):
|
|||
# picking list_servers because it's easy.
|
||||
self.servers_v2.list_servers()
|
||||
|
||||
@testtools.skipIf(not config.TempestConfig().identity.uri_v3,
|
||||
@testtools.skipIf(not CONF.identity.uri_v3,
|
||||
'v3 auth client not configured')
|
||||
def test_v3_token(self):
|
||||
# Can get a token using v3 of the identity API and use that to perform
|
||||
|
|
|
@ -30,7 +30,7 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
|
|||
_host_key = 'OS-EXT-SRV-ATTR:host'
|
||||
_interface = 'json'
|
||||
|
||||
CONF = config.TempestConfig()
|
||||
CONF = config.CONF
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
|
|
@ -22,6 +22,8 @@ from tempest import exceptions
|
|||
from tempest.test import attr
|
||||
from tempest.test import skip_because
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class QuotasAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
_interface = 'json'
|
||||
|
@ -156,7 +158,7 @@ class QuotasAdminTestJSON(base.BaseV2ComputeAdminTest):
|
|||
self.assertRaises(exceptions.OverLimit, self.create_test_server)
|
||||
|
||||
@skip_because(bug="1186354",
|
||||
condition=config.TempestConfig().service_available.neutron)
|
||||
condition=CONF.service_available.neutron)
|
||||
@attr(type=['negative', 'gate'])
|
||||
def test_security_groups_exceed_limit(self):
|
||||
# Negative test: Creation Security Groups over limit should FAIL
|
||||
|
@ -180,7 +182,7 @@ class QuotasAdminTestJSON(base.BaseV2ComputeAdminTest):
|
|||
"sg-overlimit", "sg-desc")
|
||||
|
||||
@skip_because(bug="1186354",
|
||||
condition=config.TempestConfig().service_available.neutron)
|
||||
condition=CONF.service_available.neutron)
|
||||
@attr(type=['negative', 'gate'])
|
||||
def test_security_groups_rules_exceed_limit(self):
|
||||
# Negative test: Creation of Security Group Rules should FAIL
|
||||
|
|
|
@ -20,17 +20,18 @@ import base64
|
|||
import netaddr
|
||||
import testtools
|
||||
|
||||
from tempest.api import compute
|
||||
from tempest.api.compute import base
|
||||
from tempest.common.utils import data_utils
|
||||
from tempest.common.utils.linux.remote_client import RemoteClient
|
||||
import tempest.config
|
||||
from tempest import config
|
||||
from tempest.test import attr
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ServersTestJSON(base.BaseV2ComputeTest):
|
||||
_interface = 'json'
|
||||
run_ssh = tempest.config.TempestConfig().compute.run_ssh
|
||||
run_ssh = CONF.compute.run_ssh
|
||||
disk_config = 'AUTO'
|
||||
|
||||
@classmethod
|
||||
|
@ -120,7 +121,7 @@ class ServersTestManualDisk(ServersTestJSON):
|
|||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
if not compute.DISK_CONFIG_ENABLED:
|
||||
if not CONF.compute_feature_enabled.disk_config:
|
||||
msg = "DiskConfig extension not enabled."
|
||||
raise cls.skipException(msg)
|
||||
super(ServersTestManualDisk, cls).setUpClass()
|
||||
|
|
|
@ -23,6 +23,8 @@ from tempest import exceptions
|
|||
from tempest.test import attr
|
||||
from tempest.test import skip_because
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ListServerFiltersV3TestJSON(base.BaseV3ComputeTest):
|
||||
_interface = 'json'
|
||||
|
@ -211,7 +213,7 @@ class ListServerFiltersV3TestJSON(base.BaseV3ComputeTest):
|
|||
self.assertNotIn(self.s3_name, map(lambda x: x['name'], servers))
|
||||
|
||||
@skip_because(bug="1182883",
|
||||
condition=config.TempestConfig().service_available.neutron)
|
||||
condition=CONF.service_available.neutron)
|
||||
@attr(type='gate')
|
||||
def test_list_servers_filtered_by_ip_regex(self):
|
||||
# Filter servers by regex ip
|
||||
|
|
|
@ -20,21 +20,21 @@ import time
|
|||
|
||||
import testtools
|
||||
|
||||
from tempest.api import compute
|
||||
from tempest.api.compute import base
|
||||
from tempest.common.utils import data_utils
|
||||
from tempest.common.utils.linux.remote_client import RemoteClient
|
||||
import tempest.config
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.test import attr
|
||||
from tempest.test import skip_because
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ServerActionsV3TestJSON(base.BaseV3ComputeTest):
|
||||
_interface = 'json'
|
||||
resize_available = tempest.config.TempestConfig().\
|
||||
compute_feature_enabled.resize
|
||||
run_ssh = tempest.config.TempestConfig().compute.run_ssh
|
||||
resize_available = CONF.compute_feature_enabled.resize
|
||||
run_ssh = CONF.compute.run_ssh
|
||||
|
||||
def setUp(self):
|
||||
# NOTE(afazekas): Normally we use the same server with all test cases,
|
||||
|
@ -53,7 +53,7 @@ class ServerActionsV3TestJSON(base.BaseV3ComputeTest):
|
|||
cls.client = cls.servers_client
|
||||
cls.server_id = cls.rebuild_server(None)
|
||||
|
||||
@testtools.skipUnless(compute.CHANGE_PASSWORD_AVAILABLE,
|
||||
@testtools.skipUnless(CONF.compute_feature_enabled.change_password,
|
||||
'Change password not available.')
|
||||
@attr(type='gate')
|
||||
def test_change_server_password(self):
|
||||
|
|
|
@ -19,13 +19,15 @@ import testtools
|
|||
|
||||
from tempest.api.compute import base
|
||||
from tempest.common.utils.linux.remote_client import RemoteClient
|
||||
import tempest.config
|
||||
from tempest import config
|
||||
from tempest.test import attr
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class AttachVolumeTestJSON(base.BaseV2ComputeTest):
|
||||
_interface = 'json'
|
||||
run_ssh = tempest.config.TempestConfig().compute.run_ssh
|
||||
run_ssh = CONF.compute.run_ssh
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(AttachVolumeTestJSON, self).__init__(*args, **kwargs)
|
||||
|
|
|
@ -23,10 +23,12 @@ from tempest import config
|
|||
from tempest import exceptions
|
||||
from tempest.test import attr
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class AccountQuotasTest(base.BaseObjectTest):
|
||||
accounts_quotas_available = \
|
||||
config.TempestConfig().object_storage_feature_enabled.accounts_quotas
|
||||
CONF.object_storage_feature_enabled.accounts_quotas
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
|
|
@ -24,6 +24,7 @@ from tempest import exceptions
|
|||
from tempest.test import attr
|
||||
from tempest.test import HTTP_SUCCESS
|
||||
|
||||
CONF = config.CONF
|
||||
QUOTA_BYTES = 10
|
||||
QUOTA_COUNT = 3
|
||||
SKIP_MSG = "Container quotas middleware not available."
|
||||
|
@ -32,7 +33,7 @@ SKIP_MSG = "Container quotas middleware not available."
|
|||
class ContainerQuotasTest(base.BaseObjectTest):
|
||||
"""Attemps to test the perfect behavior of quotas in a container."""
|
||||
container_quotas_available = \
|
||||
config.TempestConfig().object_storage_feature_enabled.container_quotas
|
||||
CONF.object_storage_feature_enabled.container_quotas
|
||||
|
||||
def setUp(self):
|
||||
"""Creates and sets a container with quotas.
|
||||
|
|
|
@ -23,10 +23,12 @@ from tempest import config
|
|||
from tempest.test import attr
|
||||
from tempest.test import HTTP_SUCCESS
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class CrossdomainTest(base.BaseObjectTest):
|
||||
crossdomain_available = \
|
||||
config.TempestConfig().object_storage_feature_enabled.crossdomain
|
||||
CONF.object_storage_feature_enabled.crossdomain
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
|
|
@ -27,11 +27,13 @@ from tempest import exceptions
|
|||
from tempest.test import attr
|
||||
from tempest.test import HTTP_SUCCESS
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ObjectTempUrlTest(base.BaseObjectTest):
|
||||
|
||||
tempurl_available = \
|
||||
config.TempestConfig().object_storage_feature_enabled.tempurl
|
||||
CONF.object_storage_feature_enabled.tempurl
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
|
|
@ -18,18 +18,17 @@ import testtools
|
|||
from tempest.api.orchestration import base
|
||||
from tempest.common.utils import data_utils
|
||||
from tempest.common.utils.linux.remote_client import RemoteClient
|
||||
import tempest.config
|
||||
from tempest import config
|
||||
from tempest.openstack.common import log as logging
|
||||
from tempest.test import attr
|
||||
|
||||
|
||||
CONF = config.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ServerCfnInitTestJSON(base.BaseOrchestrationTest):
|
||||
_interface = 'json'
|
||||
existing_keypair = (tempest.config.TempestConfig().
|
||||
orchestration.keypair_name is not None)
|
||||
existing_keypair = CONF.orchestration.keypair_name is not None
|
||||
|
||||
template = """
|
||||
HeatTemplateFormatVersion: '2012-12-12'
|
||||
|
|
|
@ -162,6 +162,7 @@ from tempest.services.volume.xml.extensions_client import \
|
|||
from tempest.services.volume.xml.snapshots_client import SnapshotsClientXML
|
||||
from tempest.services.volume.xml.volumes_client import VolumesClientXML
|
||||
|
||||
CONF = config.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -182,13 +183,12 @@ class Manager(object):
|
|||
:param password: Override of the password
|
||||
:param tenant_name: Override of the tenant name
|
||||
"""
|
||||
self.config = config.TempestConfig()
|
||||
|
||||
self.config = CONF
|
||||
# If no creds are provided, we fall back on the defaults
|
||||
# in the config file for the Compute API.
|
||||
self.username = username or self.config.identity.username
|
||||
self.password = password or self.config.identity.password
|
||||
self.tenant_name = tenant_name or self.config.identity.tenant_name
|
||||
self.username = username or CONF.identity.username
|
||||
self.password = password or CONF.identity.password
|
||||
self.tenant_name = tenant_name or CONF.identity.tenant_name
|
||||
|
||||
if None in (self.username, self.password, self.tenant_name):
|
||||
msg = ("Missing required credentials. "
|
||||
|
@ -197,15 +197,15 @@ class Manager(object):
|
|||
{'u': username, 'p': password, 't': tenant_name})
|
||||
raise exceptions.InvalidConfiguration(msg)
|
||||
|
||||
self.auth_url = self.config.identity.uri
|
||||
self.auth_url_v3 = self.config.identity.uri_v3
|
||||
self.auth_url = CONF.identity.uri
|
||||
self.auth_url_v3 = CONF.identity.uri_v3
|
||||
|
||||
client_args = (self.config, self.username, self.password,
|
||||
client_args = (CONF, self.username, self.password,
|
||||
self.auth_url, self.tenant_name)
|
||||
|
||||
if self.auth_url_v3:
|
||||
auth_version = 'v3'
|
||||
client_args_v3_auth = (self.config, self.username,
|
||||
client_args_v3_auth = (CONF, self.username,
|
||||
self.password, self.auth_url_v3,
|
||||
self.tenant_name, auth_version)
|
||||
else:
|
||||
|
@ -233,7 +233,7 @@ class Manager(object):
|
|||
self.volume_types_client = VolumeTypesClientXML(*client_args)
|
||||
self.identity_client = IdentityClientXML(*client_args)
|
||||
self.identity_v3_client = IdentityV3ClientXML(*client_args)
|
||||
self.token_client = TokenClientXML(self.config)
|
||||
self.token_client = TokenClientXML(CONF)
|
||||
self.security_groups_client = SecurityGroupsClientXML(
|
||||
*client_args)
|
||||
self.interfaces_v3_client = InterfacesV3ClientXML(*client_args)
|
||||
|
@ -288,7 +288,7 @@ class Manager(object):
|
|||
self.volume_types_client = VolumeTypesClientJSON(*client_args)
|
||||
self.identity_client = IdentityClientJSON(*client_args)
|
||||
self.identity_v3_client = IdentityV3ClientJSON(*client_args)
|
||||
self.token_client = TokenClientJSON(self.config)
|
||||
self.token_client = TokenClientJSON(CONF)
|
||||
self.security_groups_client = SecurityGroupsClientJSON(
|
||||
*client_args)
|
||||
self.interfaces_v3_client = InterfacesV3ClientJSON(*client_args)
|
||||
|
@ -328,7 +328,7 @@ class Manager(object):
|
|||
# common clients
|
||||
self.hosts_client = HostsClientJSON(*client_args)
|
||||
self.account_client = AccountClient(*client_args)
|
||||
if self.config.service_available.glance:
|
||||
if CONF.service_available.glance:
|
||||
self.image_client = ImageClientJSON(*client_args)
|
||||
self.image_client_v2 = ImageClientV2JSON(*client_args)
|
||||
self.container_client = ContainerClient(*client_args)
|
||||
|
@ -350,10 +350,9 @@ class AltManager(Manager):
|
|||
"""
|
||||
|
||||
def __init__(self, interface='json'):
|
||||
conf = config.TempestConfig()
|
||||
super(AltManager, self).__init__(conf.identity.alt_username,
|
||||
conf.identity.alt_password,
|
||||
conf.identity.alt_tenant_name,
|
||||
super(AltManager, self).__init__(CONF.identity.alt_username,
|
||||
CONF.identity.alt_password,
|
||||
CONF.identity.alt_tenant_name,
|
||||
interface=interface)
|
||||
|
||||
|
||||
|
@ -365,10 +364,9 @@ class AdminManager(Manager):
|
|||
"""
|
||||
|
||||
def __init__(self, interface='json'):
|
||||
conf = config.TempestConfig()
|
||||
super(AdminManager, self).__init__(conf.identity.admin_username,
|
||||
conf.identity.admin_password,
|
||||
conf.identity.admin_tenant_name,
|
||||
super(AdminManager, self).__init__(CONF.identity.admin_username,
|
||||
CONF.identity.admin_password,
|
||||
CONF.identity.admin_tenant_name,
|
||||
interface=interface)
|
||||
|
||||
|
||||
|
@ -380,11 +378,10 @@ class ComputeAdminManager(Manager):
|
|||
"""
|
||||
|
||||
def __init__(self, interface='json'):
|
||||
conf = config.TempestConfig()
|
||||
base = super(ComputeAdminManager, self)
|
||||
base.__init__(conf.compute_admin.username,
|
||||
conf.compute_admin.password,
|
||||
conf.compute_admin.tenant_name,
|
||||
base.__init__(CONF.compute_admin.username,
|
||||
CONF.compute_admin.password,
|
||||
CONF.compute_admin.tenant_name,
|
||||
interface=interface)
|
||||
|
||||
|
||||
|
@ -394,9 +391,8 @@ class OrchestrationManager(Manager):
|
|||
so that heat templates can create users
|
||||
"""
|
||||
def __init__(self, interface='json'):
|
||||
conf = config.TempestConfig()
|
||||
base = super(OrchestrationManager, self)
|
||||
base.__init__(conf.identity.admin_username,
|
||||
conf.identity.admin_password,
|
||||
conf.identity.tenant_name,
|
||||
base.__init__(CONF.identity.admin_username,
|
||||
CONF.identity.admin_password,
|
||||
CONF.identity.tenant_name,
|
||||
interface=interface)
|
||||
|
|
|
@ -19,13 +19,14 @@ from tempest import config
|
|||
|
||||
from tempest.openstack.common import log as logging
|
||||
|
||||
CONF = config.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
tables = ['filter', 'nat', 'mangle']
|
||||
|
||||
|
||||
def log_ip_ns():
|
||||
if not config.TempestConfig().debug.enable:
|
||||
if not CONF.debug.enable:
|
||||
return
|
||||
LOG.info("Host Addr:\n" + commands.ip_addr_raw())
|
||||
LOG.info("Host Route:\n" + commands.ip_route_raw())
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
import sys
|
||||
|
||||
from tempest import config
|
||||
import tempest.config
|
||||
from tempest.openstack.common.config import generator
|
||||
|
||||
# NOTE(mtreinish): This hack is needed because of how oslo config is used in
|
||||
|
@ -31,5 +31,7 @@ from tempest.openstack.common.config import generator
|
|||
# the issue by manually loading the config file (which may or may not exist)
|
||||
# which will populate all the options before running the generator.
|
||||
|
||||
config.TempestConfig()
|
||||
generator.generate(sys.argv[1:])
|
||||
|
||||
if __name__ == "__main__":
|
||||
CONF = tempest.config.TempestConfig()
|
||||
generator.generate(sys.argv[1:])
|
||||
|
|
|
@ -25,6 +25,7 @@ from tempest import config
|
|||
from tempest import exceptions
|
||||
from tempest.openstack.common import log as logging
|
||||
|
||||
CONF = config.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -36,7 +37,7 @@ class IsolatedCreds(object):
|
|||
self.isolated_net_resources = {}
|
||||
self.ports = []
|
||||
self.name = name
|
||||
self.config = config.TempestConfig()
|
||||
self.config = CONF
|
||||
self.tempest_client = tempest_client
|
||||
self.interface = interface
|
||||
self.password = password
|
||||
|
@ -44,11 +45,11 @@ class IsolatedCreds(object):
|
|||
self._get_admin_clients())
|
||||
|
||||
def _get_official_admin_clients(self):
|
||||
username = self.config.identity.admin_username
|
||||
password = self.config.identity.admin_password
|
||||
tenant_name = self.config.identity.admin_tenant_name
|
||||
auth_url = self.config.identity.uri
|
||||
dscv = self.config.identity.disable_ssl_certificate_validation
|
||||
username = CONF.identity.admin_username
|
||||
password = CONF.identity.admin_password
|
||||
tenant_name = CONF.identity.admin_tenant_name
|
||||
auth_url = CONF.identity.uri
|
||||
dscv = CONF.identity.disable_ssl_certificate_validation
|
||||
identity_client = keystoneclient.Client(username=username,
|
||||
password=password,
|
||||
tenant_name=tenant_name,
|
||||
|
@ -164,7 +165,7 @@ class IsolatedCreds(object):
|
|||
role = None
|
||||
try:
|
||||
roles = self._list_roles()
|
||||
admin_role = self.config.identity.admin_role
|
||||
admin_role = CONF.identity.admin_role
|
||||
if self.tempest_client:
|
||||
role = next(r for r in roles if r['name'] == admin_role)
|
||||
else:
|
||||
|
@ -229,8 +230,8 @@ class IsolatedCreds(object):
|
|||
if not self.tempest_client:
|
||||
body = {'subnet': {'name': subnet_name, 'tenant_id': tenant_id,
|
||||
'network_id': network_id, 'ip_version': 4}}
|
||||
base_cidr = netaddr.IPNetwork(self.config.network.tenant_network_cidr)
|
||||
mask_bits = self.config.network.tenant_network_mask_bits
|
||||
base_cidr = netaddr.IPNetwork(CONF.network.tenant_network_cidr)
|
||||
mask_bits = CONF.network.tenant_network_mask_bits
|
||||
for subnet_cidr in base_cidr.subnet(mask_bits):
|
||||
try:
|
||||
if self.tempest_client:
|
||||
|
@ -252,7 +253,7 @@ class IsolatedCreds(object):
|
|||
|
||||
def _create_router(self, router_name, tenant_id):
|
||||
external_net_id = dict(
|
||||
network_id=self.config.network.public_network_id)
|
||||
network_id=CONF.network.public_network_id)
|
||||
if self.tempest_client:
|
||||
resp, resp_body = self.network_admin_client.create_router(
|
||||
router_name,
|
||||
|
@ -328,7 +329,7 @@ class IsolatedCreds(object):
|
|||
self.isolated_creds['primary'] = (user, tenant)
|
||||
LOG.info("Acquired isolated creds:\n user: %s, tenant: %s"
|
||||
% (username, tenant_name))
|
||||
if self.config.service_available.neutron:
|
||||
if CONF.service_available.neutron:
|
||||
network, subnet, router = self._create_network_resources(
|
||||
self._get_tenant_id(tenant))
|
||||
self.isolated_net_resources['primary'] = (
|
||||
|
@ -347,7 +348,7 @@ class IsolatedCreds(object):
|
|||
self.isolated_creds['admin'] = (user, tenant)
|
||||
LOG.info("Acquired admin isolated creds:\n user: %s, tenant: %s"
|
||||
% (username, tenant_name))
|
||||
if self.config.service_available.neutron:
|
||||
if CONF.service_available.neutron:
|
||||
network, subnet, router = self._create_network_resources(
|
||||
self._get_tenant_id(tenant))
|
||||
self.isolated_net_resources['admin'] = (
|
||||
|
@ -366,7 +367,7 @@ class IsolatedCreds(object):
|
|||
self.isolated_creds['alt'] = (user, tenant)
|
||||
LOG.info("Acquired alt isolated creds:\n user: %s, tenant: %s"
|
||||
% (username, tenant_name))
|
||||
if self.config.service_available.neutron:
|
||||
if CONF.service_available.neutron:
|
||||
network, subnet, router = self._create_network_resources(
|
||||
self._get_tenant_id(tenant))
|
||||
self.isolated_net_resources['alt'] = (
|
||||
|
|
|
@ -17,18 +17,20 @@ import time
|
|||
|
||||
from tempest.common.ssh import Client
|
||||
from tempest.common import utils
|
||||
from tempest.config import TempestConfig
|
||||
from tempest import config
|
||||
from tempest.exceptions import ServerUnreachable
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class RemoteClient():
|
||||
|
||||
# NOTE(afazekas): It should always get an address instead of server
|
||||
def __init__(self, server, username, password=None, pkey=None):
|
||||
ssh_timeout = TempestConfig().compute.ssh_timeout
|
||||
network = TempestConfig().compute.network_for_ssh
|
||||
ip_version = TempestConfig().compute.ip_version_for_ssh
|
||||
ssh_channel_timeout = TempestConfig().compute.ssh_channel_timeout
|
||||
ssh_timeout = CONF.compute.ssh_timeout
|
||||
network = CONF.compute.network_for_ssh
|
||||
ip_version = CONF.compute.ip_version_for_ssh
|
||||
ssh_channel_timeout = CONF.compute.ssh_channel_timeout
|
||||
if isinstance(server, basestring):
|
||||
ip_address = server
|
||||
else:
|
||||
|
|
|
@ -19,7 +19,7 @@ from tempest import config
|
|||
from tempest import exceptions
|
||||
from tempest.openstack.common import log as logging
|
||||
|
||||
CONFIG = config.TempestConfig()
|
||||
CONF = config.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ def wait_for_server_status(client, server_id, status, ready_wait=True,
|
|||
# responses
|
||||
if str(task_state) == "None":
|
||||
# without state api extension 3 sec usually enough
|
||||
time.sleep(CONFIG.compute.ready_wait)
|
||||
time.sleep(CONF.compute.ready_wait)
|
||||
return
|
||||
else:
|
||||
return
|
||||
|
|
|
@ -20,10 +20,8 @@ from __future__ import print_function
|
|||
import os
|
||||
import sys
|
||||
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from tempest.common.utils.misc import singleton
|
||||
from tempest.openstack.common import log as logging
|
||||
|
||||
|
||||
|
@ -646,8 +644,7 @@ DebugGroup = [
|
|||
]
|
||||
|
||||
|
||||
@singleton
|
||||
class TempestConfig:
|
||||
class TempestConfig(object):
|
||||
"""Provides OpenStack configuration information."""
|
||||
|
||||
DEFAULT_CONFIG_DIR = os.path.join(
|
||||
|
@ -658,6 +655,7 @@ class TempestConfig:
|
|||
|
||||
def __init__(self):
|
||||
"""Initialize a configuration from a conf directory and conf file."""
|
||||
super(TempestConfig, self).__init__()
|
||||
config_files = []
|
||||
failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE
|
||||
|
||||
|
@ -735,3 +733,16 @@ class TempestConfig:
|
|||
self.compute_admin.username = self.identity.admin_username
|
||||
self.compute_admin.password = self.identity.admin_password
|
||||
self.compute_admin.tenant_name = self.identity.admin_tenant_name
|
||||
|
||||
|
||||
class TempestConfigProxy(object):
|
||||
_config = None
|
||||
|
||||
def __getattr__(self, attr):
|
||||
if not self._config:
|
||||
self._config = TempestConfig()
|
||||
|
||||
return getattr(self._config, attr)
|
||||
|
||||
|
||||
CONF = TempestConfigProxy()
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import tempest.config
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ class Manager(object):
|
|||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.config = tempest.config.TempestConfig()
|
||||
self.config = config.CONF
|
||||
self.client_attr_names = []
|
||||
|
||||
# we do this everywhere, have it be part of the super class
|
||||
|
|
|
@ -27,6 +27,7 @@ import tempest.test
|
|||
from tempest.test import attr
|
||||
from tempest.test import services
|
||||
|
||||
CONF = config.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -142,8 +143,6 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
|
|||
|
||||
"""
|
||||
|
||||
CONF = config.TempestConfig()
|
||||
|
||||
@classmethod
|
||||
def check_preconditions(cls):
|
||||
super(TestNetworkBasicOps, cls).check_preconditions()
|
||||
|
@ -215,13 +214,13 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
|
|||
self._create_server(name, network)
|
||||
|
||||
def _check_tenant_network_connectivity(self):
|
||||
if not self.config.network.tenant_networks_reachable:
|
||||
if not CONF.network.tenant_networks_reachable:
|
||||
msg = 'Tenant networks not configured to be reachable.'
|
||||
LOG.info(msg)
|
||||
return
|
||||
# The target login is assumed to have been configured for
|
||||
# key-based authentication by cloud-init.
|
||||
ssh_login = self.config.compute.image_ssh_user
|
||||
ssh_login = CONF.compute.image_ssh_user
|
||||
try:
|
||||
for server, key in self.servers.items():
|
||||
for net_name, ip_addresses in server.networks.iteritems():
|
||||
|
@ -239,13 +238,13 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
|
|||
|
||||
self.assertTrue(
|
||||
tempest.test.call_until_true(
|
||||
ip_tracker.run_checks, self.config.compute.build_timeout,
|
||||
self.config.compute.build_interval),
|
||||
ip_tracker.run_checks, CONF.compute.build_timeout,
|
||||
CONF.compute.build_interval),
|
||||
"Timed out while waiting for the floating IP assignments "
|
||||
"to propagate")
|
||||
|
||||
def _create_and_associate_floating_ips(self):
|
||||
public_network_id = self.config.network.public_network_id
|
||||
public_network_id = CONF.network.public_network_id
|
||||
for server in self.servers.keys():
|
||||
floating_ip = self._create_floating_ip(server, public_network_id)
|
||||
self.floating_ips[floating_ip] = server
|
||||
|
@ -253,7 +252,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
|
|||
def _check_public_network_connectivity(self, should_connect=True):
|
||||
# The target login is assumed to have been configured for
|
||||
# key-based authentication by cloud-init.
|
||||
ssh_login = self.config.compute.image_ssh_user
|
||||
ssh_login = CONF.compute.image_ssh_user
|
||||
try:
|
||||
for floating_ip, server in self.floating_ips.iteritems():
|
||||
ip_address = floating_ip.floating_ip_address
|
||||
|
|
|
@ -33,6 +33,8 @@ from tempest.openstack.common import log as logging
|
|||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
# All the successful HTTP status codes from RFC 2616
|
||||
HTTP_SUCCESS = (200, 201, 202, 203, 204, 205, 206)
|
||||
|
||||
|
@ -146,7 +148,7 @@ def is_extension_enabled(extension_name, service):
|
|||
"""A function that will check the list of enabled extensions from config
|
||||
|
||||
"""
|
||||
configs = config.TempestConfig()
|
||||
configs = CONF
|
||||
config_dict = {
|
||||
'compute': configs.compute_feature_enabled.api_extensions,
|
||||
'compute_v3': configs.compute_feature_enabled.api_v3_extensions,
|
||||
|
@ -214,7 +216,7 @@ class BaseTestCase(testtools.TestCase,
|
|||
testtools.testcase.WithAttributes,
|
||||
testresources.ResourcedTestCase):
|
||||
|
||||
config = config.TempestConfig()
|
||||
config = CONF
|
||||
|
||||
setUpClassCalled = False
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import keystoneclient.exceptions
|
|||
|
||||
import tempest.clients
|
||||
from tempest.common.utils.file_utils import have_effective_read_access
|
||||
import tempest.config
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.openstack.common import log as logging
|
||||
import tempest.test
|
||||
|
@ -37,6 +37,7 @@ from tempest.thirdparty.boto.utils.wait import re_search_wait
|
|||
from tempest.thirdparty.boto.utils.wait import state_wait
|
||||
from tempest.thirdparty.boto.utils.wait import wait_exception
|
||||
|
||||
CONF = config.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -50,11 +51,10 @@ def decision_maker():
|
|||
def all_read(*args):
|
||||
return all(map(have_effective_read_access, args))
|
||||
|
||||
config = tempest.config.TempestConfig()
|
||||
materials_path = config.boto.s3_materials_path
|
||||
ami_path = materials_path + os.sep + config.boto.ami_manifest
|
||||
aki_path = materials_path + os.sep + config.boto.aki_manifest
|
||||
ari_path = materials_path + os.sep + config.boto.ari_manifest
|
||||
materials_path = CONF.boto.s3_materials_path
|
||||
ami_path = materials_path + os.sep + CONF.boto.ami_manifest
|
||||
aki_path = materials_path + os.sep + CONF.boto.aki_manifest
|
||||
ari_path = materials_path + os.sep + CONF.boto.ari_manifest
|
||||
|
||||
A_I_IMAGES_READY = all_read(ami_path, aki_path, ari_path)
|
||||
boto_logger = logging.getLogger('boto')
|
||||
|
@ -70,7 +70,7 @@ def decision_maker():
|
|||
raise Exception("Unknown (Authentication?) Error")
|
||||
openstack = tempest.clients.Manager()
|
||||
try:
|
||||
if urlparse.urlparse(config.boto.ec2_url).hostname is None:
|
||||
if urlparse.urlparse(CONF.boto.ec2_url).hostname is None:
|
||||
raise Exception("Failed to get hostname from the ec2_url")
|
||||
ec2client = openstack.ec2api_client
|
||||
try:
|
||||
|
@ -87,7 +87,7 @@ def decision_maker():
|
|||
EC2_CAN_CONNECT_ERROR = str(exc)
|
||||
|
||||
try:
|
||||
if urlparse.urlparse(config.boto.s3_url).hostname is None:
|
||||
if urlparse.urlparse(CONF.boto.s3_url).hostname is None:
|
||||
raise Exception("Failed to get hostname from the s3_url")
|
||||
s3client = openstack.s3_client
|
||||
try:
|
||||
|
|
|
@ -21,17 +21,12 @@ import time
|
|||
import boto.exception
|
||||
from testtools import TestCase
|
||||
|
||||
import tempest.config
|
||||
from tempest import config
|
||||
from tempest.openstack.common import log as logging
|
||||
|
||||
CONF = config.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
_boto_config = tempest.config.TempestConfig().boto
|
||||
|
||||
default_timeout = _boto_config.build_timeout
|
||||
|
||||
default_check_interval = _boto_config.build_interval
|
||||
|
||||
|
||||
def state_wait(lfunction, final_set=set(), valid_set=None):
|
||||
# TODO(afazekas): evaluate using ABC here
|
||||
|
@ -50,12 +45,12 @@ def state_wait(lfunction, final_set=set(), valid_set=None):
|
|||
if valid_set is not None and status not in valid_set:
|
||||
return status
|
||||
dtime = time.time() - start_time
|
||||
if dtime > default_timeout:
|
||||
if dtime > CONF.boto.build_timeout:
|
||||
raise TestCase.failureException("State change timeout exceeded!"
|
||||
'(%ds) While waiting'
|
||||
'for %s at "%s"' %
|
||||
(dtime, final_set, status))
|
||||
time.sleep(default_check_interval)
|
||||
time.sleep(CONF.boto.build_interval)
|
||||
old_status = status
|
||||
status = lfunction()
|
||||
|
||||
|
@ -73,12 +68,12 @@ def re_search_wait(lfunction, regexp):
|
|||
text)
|
||||
return result
|
||||
dtime = time.time() - start_time
|
||||
if dtime > default_timeout:
|
||||
if dtime > CONF.boto.build_timeout:
|
||||
raise TestCase.failureException('Pattern find timeout exceeded!'
|
||||
'(%ds) While waiting for'
|
||||
'"%s" pattern in "%s"' %
|
||||
(dtime, regexp, text))
|
||||
time.sleep(default_check_interval)
|
||||
time.sleep(CONF.boto.build_interval)
|
||||
|
||||
|
||||
def wait_no_exception(lfunction, exc_class=None, exc_matcher=None):
|
||||
|
@ -104,10 +99,10 @@ def wait_no_exception(lfunction, exc_class=None, exc_matcher=None):
|
|||
raise exc
|
||||
# Let the other exceptions propagate
|
||||
dtime = time.time() - start_time
|
||||
if dtime > default_timeout:
|
||||
if dtime > CONF.boto.build_timeout:
|
||||
raise TestCase.failureException("Wait timeout exceeded! (%ds)" %
|
||||
dtime)
|
||||
time.sleep(default_check_interval)
|
||||
time.sleep(CONF.boto.build_interval)
|
||||
|
||||
|
||||
# NOTE(afazekas): EC2/boto normally raise exception instead of empty list
|
||||
|
@ -122,9 +117,9 @@ def wait_exception(lfunction):
|
|||
time.time() - start_time)
|
||||
return exc
|
||||
dtime = time.time() - start_time
|
||||
if dtime > default_timeout:
|
||||
if dtime > CONF.boto.build_timeout:
|
||||
raise TestCase.failureException("Wait timeout exceeded! (%ds)" %
|
||||
dtime)
|
||||
time.sleep(default_check_interval)
|
||||
time.sleep(CONF.boto.build_interval)
|
||||
|
||||
# TODO(afazekas): consider strategy design pattern..
|
||||
|
|
|
@ -21,7 +21,7 @@ from tempest import clients
|
|||
from tempest import config
|
||||
|
||||
|
||||
CONF = config.TempestConfig()
|
||||
CONF = config.CONF
|
||||
|
||||
#Dicts matching extension names to config options
|
||||
NOVA_EXTENSIONS = {
|
||||
|
|
Loading…
Reference in New Issue