Merge "Move InvalidConfiguration exception to tempest.lib"
This commit is contained in:
commit
aa11f58cec
|
@ -17,7 +17,7 @@ import netaddr
|
|||
|
||||
from tempest.api.compute import base
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.lib import exceptions
|
||||
from tempest import test
|
||||
|
||||
CONF = config.CONF
|
||||
|
|
|
@ -23,7 +23,7 @@ from tempest.common import image as common_image
|
|||
from tempest.common.utils import data_utils
|
||||
from tempest.common import waiters
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.lib import exceptions
|
||||
from tempest import test
|
||||
|
||||
CONF = config.CONF
|
||||
|
|
|
@ -24,7 +24,6 @@ from tempest.common.utils import data_utils
|
|||
from tempest.common.utils.linux import remote_client
|
||||
from tempest.common import waiters
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
from tempest import test
|
||||
|
@ -331,7 +330,7 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
|
|||
elif CONF.image_feature_enabled.api_v2:
|
||||
glance_client = self.os.image_client_v2
|
||||
else:
|
||||
raise exceptions.InvalidConfiguration(
|
||||
raise lib_exc.InvalidConfiguration(
|
||||
'Either api_v1 or api_v2 must be True in '
|
||||
'[image-feature-enabled].')
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ from tempest.common import image as common_image
|
|||
from tempest.common.utils import data_utils
|
||||
from tempest.common import waiters
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.lib import exceptions
|
||||
from tempest import test
|
||||
|
||||
CONF = config.CONF
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
from tempest.api.network import base
|
||||
from tempest.common.utils import data_utils
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.lib import exceptions
|
||||
from tempest import test
|
||||
|
||||
CONF = config.CONF
|
||||
|
|
|
@ -23,7 +23,7 @@ from tempest.api.network import base_security_groups as sec_base
|
|||
from tempest.common import custom_matchers
|
||||
from tempest.common.utils import data_utils
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.lib import exceptions
|
||||
from tempest import test
|
||||
|
||||
CONF = config.CONF
|
||||
|
|
|
@ -17,8 +17,8 @@ from tempest.common import compute
|
|||
from tempest.common.utils import data_utils
|
||||
from tempest.common import waiters
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import exceptions
|
||||
import tempest.test
|
||||
|
||||
CONF = config.CONF
|
||||
|
|
|
@ -18,8 +18,8 @@ from tempest.api.volume import base
|
|||
from tempest.common.utils import data_utils
|
||||
from tempest.common import waiters
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import exceptions
|
||||
from tempest import test
|
||||
|
||||
CONF = config.CONF
|
||||
|
|
|
@ -267,14 +267,14 @@ class Manager(clients.ServiceClients):
|
|||
CONF.identity.uri, **self.default_params)
|
||||
else:
|
||||
msg = 'Identity v2 API enabled, but no identity.uri set'
|
||||
raise exceptions.InvalidConfiguration(msg)
|
||||
raise lib_exc.InvalidConfiguration(msg)
|
||||
if CONF.identity_feature_enabled.api_v3:
|
||||
if CONF.identity.uri_v3:
|
||||
self.token_v3_client = identity.v3.V3TokenClient(
|
||||
CONF.identity.uri_v3, **self.default_params)
|
||||
else:
|
||||
msg = 'Identity v3 API enabled, but no identity.uri_v3 set'
|
||||
raise exceptions.InvalidConfiguration(msg)
|
||||
raise lib_exc.InvalidConfiguration(msg)
|
||||
|
||||
def _set_volume_clients(self):
|
||||
# Mandatory parameters (always defined)
|
||||
|
|
|
@ -17,8 +17,8 @@ from tempest import clients
|
|||
from tempest.common import dynamic_creds
|
||||
from tempest.common import preprov_creds
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.lib import auth
|
||||
from tempest.lib import exceptions
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import six
|
|||
|
||||
from tempest import clients
|
||||
from tempest.common import cred_client
|
||||
from tempest import exceptions
|
||||
from tempest.lib.common import cred_provider
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
@ -219,14 +218,14 @@ class DynamicCredentialProvider(cred_provider.CredentialProvider):
|
|||
if self.network_resources['router']:
|
||||
if (not self.network_resources['subnet'] or
|
||||
not self.network_resources['network']):
|
||||
raise exceptions.InvalidConfiguration(
|
||||
raise lib_exc.InvalidConfiguration(
|
||||
'A router requires a subnet and network')
|
||||
elif self.network_resources['subnet']:
|
||||
if not self.network_resources['network']:
|
||||
raise exceptions.InvalidConfiguration(
|
||||
raise lib_exc.InvalidConfiguration(
|
||||
'A subnet requires a network')
|
||||
elif self.network_resources['dhcp']:
|
||||
raise exceptions.InvalidConfiguration('DHCP requires a subnet')
|
||||
raise lib_exc.InvalidConfiguration('DHCP requires a subnet')
|
||||
|
||||
rand_name_root = data_utils.rand_name(
|
||||
self.name, prefix=self.resource_prefix)
|
||||
|
|
|
@ -35,7 +35,7 @@ def read_accounts_yaml(path):
|
|||
with open(path, 'r') as yaml_file:
|
||||
accounts = yaml.load(yaml_file)
|
||||
except IOError:
|
||||
raise exceptions.InvalidConfiguration(
|
||||
raise lib_exc.InvalidConfiguration(
|
||||
'The path for the test accounts file: %s '
|
||||
'could not be found' % path)
|
||||
return accounts
|
||||
|
|
|
@ -19,7 +19,6 @@ import time
|
|||
from oslo_log import log as logging
|
||||
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.lib.common import ssh
|
||||
from tempest.lib.common.utils import test_utils
|
||||
import tempest.lib.exceptions
|
||||
|
@ -218,8 +217,8 @@ class RemoteClient(object):
|
|||
supported_clients = ['udhcpc', 'dhclient']
|
||||
dhcp_client = CONF.scenario.dhcp_client
|
||||
if dhcp_client not in supported_clients:
|
||||
raise exceptions.InvalidConfiguration('%s DHCP client unsupported'
|
||||
% dhcp_client)
|
||||
raise tempest.lib.exceptions.InvalidConfiguration(
|
||||
'%s DHCP client unsupported' % dhcp_client)
|
||||
if dhcp_client == 'udhcpc' and not fixed_ip:
|
||||
raise ValueError("need to set 'fixed_ip' for udhcpc client")
|
||||
return getattr(self, '_renew_lease_' + dhcp_client)(fixed_ip=fixed_ip)
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
from tempest.lib import exceptions
|
||||
|
||||
|
||||
class InvalidConfiguration(exceptions.TempestException):
|
||||
message = "Invalid Configuration"
|
||||
|
||||
|
||||
class InvalidServiceTag(exceptions.TempestException):
|
||||
message = "Invalid service tag"
|
||||
|
||||
|
|
|
@ -149,6 +149,10 @@ class UnexpectedResponseCode(OtherRestClientException):
|
|||
message = "Unexpected response code received"
|
||||
|
||||
|
||||
class InvalidConfiguration(TempestException):
|
||||
message = "Invalid Configuration"
|
||||
|
||||
|
||||
class InvalidIdentityVersion(TempestException):
|
||||
message = "Invalid version %(identity_version)s of the identity service"
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
|||
elif CONF.image_feature_enabled.api_v2:
|
||||
cls.image_client = cls.manager.image_client_v2
|
||||
else:
|
||||
raise exceptions.InvalidConfiguration(
|
||||
raise lib_exc.InvalidConfiguration(
|
||||
'Either api_v1 or api_v2 must be True in '
|
||||
'[image-feature-enabled].')
|
||||
# Compute image client
|
||||
|
@ -639,7 +639,7 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
|||
return address['addr']
|
||||
raise exceptions.ServerUnreachable(server_id=server['id'])
|
||||
else:
|
||||
raise exceptions.InvalidConfiguration()
|
||||
raise lib_exc.InvalidConfiguration()
|
||||
|
||||
|
||||
class NetworkScenarioTest(ScenarioTest):
|
||||
|
@ -1177,7 +1177,7 @@ class NetworkScenarioTest(ScenarioTest):
|
|||
# https://blueprints.launchpad.net/tempest/+spec/test-accounts
|
||||
if not CONF.compute.fixed_network_name:
|
||||
m = 'fixed_network_name must be specified in config'
|
||||
raise exceptions.InvalidConfiguration(m)
|
||||
raise lib_exc.InvalidConfiguration(m)
|
||||
network = self._get_network_by_name(
|
||||
CONF.compute.fixed_network_name)
|
||||
router = None
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.lib import exceptions
|
||||
from tempest.scenario import manager
|
||||
from tempest import test
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ from oslotest import mockpatch
|
|||
from tempest.common import credentials_factory as credentials
|
||||
from tempest.common import dynamic_creds
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.lib.common import rest_client
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
from tempest.lib.services.identity.v2 import identity_client as v2_iden_client
|
||||
|
@ -572,7 +571,7 @@ class TestDynamicCredentialProvider(base.TestCase):
|
|||
self._mock_list_role()
|
||||
self._mock_user_create('1234', 'fake_prim_user')
|
||||
self._mock_tenant_create('1234', 'fake_prim_tenant')
|
||||
self.assertRaises(exceptions.InvalidConfiguration,
|
||||
self.assertRaises(lib_exc.InvalidConfiguration,
|
||||
creds.get_primary_creds)
|
||||
|
||||
@mock.patch('tempest.lib.common.rest_client.RestClient')
|
||||
|
@ -592,7 +591,7 @@ class TestDynamicCredentialProvider(base.TestCase):
|
|||
self._mock_list_role()
|
||||
self._mock_user_create('1234', 'fake_prim_user')
|
||||
self._mock_tenant_create('1234', 'fake_prim_tenant')
|
||||
self.assertRaises(exceptions.InvalidConfiguration,
|
||||
self.assertRaises(lib_exc.InvalidConfiguration,
|
||||
creds.get_primary_creds)
|
||||
|
||||
@mock.patch('tempest.lib.common.rest_client.RestClient')
|
||||
|
@ -612,7 +611,7 @@ class TestDynamicCredentialProvider(base.TestCase):
|
|||
self._mock_list_role()
|
||||
self._mock_user_create('1234', 'fake_prim_user')
|
||||
self._mock_tenant_create('1234', 'fake_prim_tenant')
|
||||
self.assertRaises(exceptions.InvalidConfiguration,
|
||||
self.assertRaises(lib_exc.InvalidConfiguration,
|
||||
creds.get_primary_creds)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue