Merge "Change tempest NotFound exc to tempest-lib exc"
diff --git a/tempest/api/baremetal/admin/base.py b/tempest/api/baremetal/admin/base.py
index 3b12b8e..1e9b308 100644
--- a/tempest/api/baremetal/admin/base.py
+++ b/tempest/api/baremetal/admin/base.py
@@ -11,11 +11,11 @@
# under the License.
import functools
+from tempest_lib import exceptions as lib_exc
from tempest import clients
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions as exc
from tempest import test
CONF = config.CONF
@@ -83,7 +83,7 @@
uuids = cls.created_objects[resource]
delete_method = getattr(cls.client, 'delete_%s' % resource)
for u in uuids:
- delete_method(u, ignore_errors=exc.NotFound)
+ delete_method(u, ignore_errors=lib_exc.NotFound)
finally:
super(BaseBaremetalTest, cls).resource_cleanup()
diff --git a/tempest/api/baremetal/admin/test_chassis.py b/tempest/api/baremetal/admin/test_chassis.py
index 6f83412..1cf22ae 100644
--- a/tempest/api/baremetal/admin/test_chassis.py
+++ b/tempest/api/baremetal/admin/test_chassis.py
@@ -11,9 +11,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.baremetal.admin import base
from tempest.common.utils import data_utils
-from tempest import exceptions as exc
from tempest import test
@@ -63,7 +64,7 @@
uuid = body['uuid']
self.delete_chassis(uuid)
- self.assertRaises(exc.NotFound, self.client.show_chassis, uuid)
+ self.assertRaises(lib_exc.NotFound, self.client.show_chassis, uuid)
@test.attr(type='smoke')
def test_update_chassis(self):
diff --git a/tempest/api/baremetal/admin/test_nodes.py b/tempest/api/baremetal/admin/test_nodes.py
index 41c12c6..96f4b43 100644
--- a/tempest/api/baremetal/admin/test_nodes.py
+++ b/tempest/api/baremetal/admin/test_nodes.py
@@ -11,11 +11,11 @@
# under the License.
import six
+from tempest_lib import exceptions as lib_exc
from tempest.api.baremetal.admin import base
from tempest.common.utils import data_utils
from tempest.common import waiters
-from tempest import exceptions as exc
from tempest import test
@@ -62,7 +62,8 @@
self.delete_node(node['uuid'])
- self.assertRaises(exc.NotFound, self.client.show_node, node['uuid'])
+ self.assertRaises(lib_exc.NotFound, self.client.show_node,
+ node['uuid'])
@test.attr(type='smoke')
def test_show_node(self):
diff --git a/tempest/api/baremetal/admin/test_ports.py b/tempest/api/baremetal/admin/test_ports.py
index 89447e0..0076dee 100644
--- a/tempest/api/baremetal/admin/test_ports.py
+++ b/tempest/api/baremetal/admin/test_ports.py
@@ -11,10 +11,10 @@
# under the License.
from tempest_lib import decorators
+from tempest_lib import exceptions as lib_exc
from tempest.api.baremetal.admin import base
from tempest.common.utils import data_utils
-from tempest import exceptions as exc
from tempest import test
@@ -81,7 +81,8 @@
self.delete_port(port['uuid'])
- self.assertRaises(exc.NotFound, self.client.show_port, port['uuid'])
+ self.assertRaises(lib_exc.NotFound, self.client.show_port,
+ port['uuid'])
@test.attr(type='smoke')
def test_show_port(self):
diff --git a/tempest/api/baremetal/admin/test_ports_negative.py b/tempest/api/baremetal/admin/test_ports_negative.py
index 07d0fac..dd19edc 100644
--- a/tempest/api/baremetal/admin/test_ports_negative.py
+++ b/tempest/api/baremetal/admin/test_ports_negative.py
@@ -49,7 +49,7 @@
@test.attr(type=['negative', 'smoke'])
def test_show_port_nonexistent_uuid(self):
- self.assertRaises(exc.NotFound, self.client.show_port,
+ self.assertRaises(lib_exc.NotFound, self.client.show_port,
data_utils.rand_uuid())
@test.attr(type=['negative', 'smoke'])
@@ -136,7 +136,7 @@
patch = [{'path': '/extra/key',
'op': 'replace',
'value': 'new-value'}]
- self.assertRaises(exc.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.update_port, port_id, patch)
@test.attr(type=['negative', 'smoke'])
diff --git a/tempest/api/compute/admin/test_agents.py b/tempest/api/compute/admin/test_agents.py
index 425ce13..b28b9e0 100644
--- a/tempest/api/compute/admin/test_agents.py
+++ b/tempest/api/compute/admin/test_agents.py
@@ -12,9 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest.openstack.common import log
from tempest import test
@@ -43,7 +44,7 @@
def tearDown(self):
try:
self.client.delete_agent(self.agent_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
except Exception:
LOG.exception('Exception raised deleting agent %s', self.agent_id)
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index a866ede..dd40145 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -13,10 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest.common import tempest_fixtures as fixtures
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -45,7 +46,7 @@
try:
self.client.delete_aggregate(aggregate_id)
# if aggregate not found, it depict it was deleted in the test
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
@test.attr(type='gate')
diff --git a/tempest/api/compute/admin/test_aggregates_negative.py b/tempest/api/compute/admin/test_aggregates_negative.py
index ccd294d..6868fa6 100644
--- a/tempest/api/compute/admin/test_aggregates_negative.py
+++ b/tempest/api/compute/admin/test_aggregates_negative.py
@@ -106,13 +106,13 @@
@test.attr(type=['negative', 'gate'])
def test_aggregate_delete_with_invalid_id(self):
# Delete an aggregate with invalid id should raise exceptions.
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.delete_aggregate, -1)
@test.attr(type=['negative', 'gate'])
def test_aggregate_get_details_with_invalid_id(self):
# Get aggregate details with invalid id should raise exceptions.
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.get_aggregate, -1)
@test.attr(type=['negative', 'gate'])
@@ -129,7 +129,7 @@
aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- self.assertRaises(exceptions.NotFound, self.client.add_host,
+ self.assertRaises(lib_exc.NotFound, self.client.add_host,
aggregate['id'], non_exist_host)
@test.attr(type=['negative', 'gate'])
@@ -177,5 +177,5 @@
aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- self.assertRaises(exceptions.NotFound, self.client.remove_host,
+ self.assertRaises(lib_exc.NotFound, self.client.remove_host,
aggregate['id'], non_exist_host)
diff --git a/tempest/api/compute/admin/test_fixed_ips_negative.py b/tempest/api/compute/admin/test_fixed_ips_negative.py
index e7022db..310b4dd 100644
--- a/tempest/api/compute/admin/test_fixed_ips_negative.py
+++ b/tempest/api/compute/admin/test_fixed_ips_negative.py
@@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest import config
from tempest import exceptions
@@ -71,7 +73,7 @@
# NOTE(eliqiao): in Juno, the exception is NotFound, but in master, we
# change the error code to BadRequest, both exceptions should be
# accepted by tempest
- self.assertRaises((exceptions.NotFound, exceptions.BadRequest),
+ self.assertRaises((lib_exc.NotFound, exceptions.BadRequest),
self.client.reserve_fixed_ip,
"my.invalid.ip", body)
diff --git a/tempest/api/compute/admin/test_flavors_access_negative.py b/tempest/api/compute/admin/test_flavors_access_negative.py
index 3487503..a31d163 100644
--- a/tempest/api/compute/admin/test_flavors_access_negative.py
+++ b/tempest/api/compute/admin/test_flavors_access_negative.py
@@ -54,7 +54,7 @@
new_flavor_id,
is_public='True')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.list_flavor_access,
new_flavor_id)
@@ -131,7 +131,7 @@
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
# An exception should be raised when flavor access is not found
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.remove_flavor_access,
new_flavor['id'],
str(uuid.uuid4()))
diff --git a/tempest/api/compute/admin/test_flavors_extra_specs_negative.py b/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
index 2663e25..5249c32 100644
--- a/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
+++ b/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
@@ -14,6 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import exceptions
@@ -93,14 +95,14 @@
@test.attr(type=['negative', 'gate'])
def test_flavor_unset_nonexistent_key(self):
nonexistent_key = data_utils.rand_name('flavor_key')
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.unset_flavor_extra_spec,
self.flavor['id'],
nonexistent_key)
@test.attr(type=['negative', 'gate'])
def test_flavor_get_nonexistent_key(self):
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.flavors_client.get_flavor_extra_spec_with_key,
self.flavor['id'],
"nonexistent_key")
diff --git a/tempest/api/compute/admin/test_hosts_negative.py b/tempest/api/compute/admin/test_hosts_negative.py
index fc918a3..51caef5 100644
--- a/tempest/api/compute/admin/test_hosts_negative.py
+++ b/tempest/api/compute/admin/test_hosts_negative.py
@@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import exceptions
@@ -44,7 +46,7 @@
@test.attr(type=['negative', 'gate'])
def test_show_host_detail_with_nonexistent_hostname(self):
nonexitent_hostname = data_utils.rand_name('rand_hostname')
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.show_host_detail, nonexitent_hostname)
@test.attr(type=['negative', 'gate'])
@@ -112,7 +114,7 @@
def test_update_nonexistent_host(self):
nonexitent_hostname = data_utils.rand_name('rand_hostname')
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.update_host,
nonexitent_hostname,
status='enable',
@@ -122,7 +124,7 @@
def test_startup_nonexistent_host(self):
nonexitent_hostname = data_utils.rand_name('rand_hostname')
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.startup_host,
nonexitent_hostname)
@@ -138,7 +140,7 @@
def test_shutdown_nonexistent_host(self):
nonexitent_hostname = data_utils.rand_name('rand_hostname')
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.shutdown_host,
nonexitent_hostname)
@@ -154,7 +156,7 @@
def test_reboot_nonexistent_host(self):
nonexitent_hostname = data_utils.rand_name('rand_hostname')
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.reboot_host,
nonexitent_hostname)
diff --git a/tempest/api/compute/admin/test_hypervisor_negative.py b/tempest/api/compute/admin/test_hypervisor_negative.py
index a137a61..cb973e1 100644
--- a/tempest/api/compute/admin/test_hypervisor_negative.py
+++ b/tempest/api/compute/admin/test_hypervisor_negative.py
@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
import uuid
from tempest.api.compute import base
@@ -43,7 +44,7 @@
nonexistent_hypervisor_id = str(uuid.uuid4())
self.assertRaises(
- exceptions.NotFound,
+ lib_exc.NotFound,
self.client.get_hypervisor_show_details,
nonexistent_hypervisor_id)
@@ -72,7 +73,7 @@
nonexistent_hypervisor_id = str(uuid.uuid4())
self.assertRaises(
- exceptions.NotFound,
+ lib_exc.NotFound,
self.client.get_hypervisor_servers,
nonexistent_hypervisor_id)
@@ -87,7 +88,7 @@
nonexistent_hypervisor_id = str(uuid.uuid4())
self.assertRaises(
- exceptions.NotFound,
+ lib_exc.NotFound,
self.client.get_hypervisor_uptime,
nonexistent_hypervisor_id)
@@ -120,7 +121,7 @@
nonexistent_hypervisor_name = data_utils.rand_name('test_hypervisor')
self.assertRaises(
- exceptions.NotFound,
+ lib_exc.NotFound,
self.client.search_hypervisor,
nonexistent_hypervisor_name)
diff --git a/tempest/api/compute/admin/test_security_group_default_rules.py b/tempest/api/compute/admin/test_security_group_default_rules.py
index 563d517..31103df 100644
--- a/tempest/api/compute/admin/test_security_group_default_rules.py
+++ b/tempest/api/compute/admin/test_security_group_default_rules.py
@@ -12,11 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
import testtools
from tempest.api.compute import base
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -59,7 +59,7 @@
rule = self._create_security_group_default_rules(ip_protocol)
# Delete Security Group default rule
self.adm_client.delete_security_group_default_rule(rule['id'])
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.adm_client.get_security_group_default_rule,
rule['id'])
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index 81dabb1..ab1ed81 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -51,7 +51,7 @@
while True:
try:
self.flavors_client.get_flavor_details(flavor_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
break
flavor_id = data_utils.rand_int_id(start=1000)
return flavor_id
@@ -112,7 +112,7 @@
@test.attr(type=['negative', 'gate'])
def test_reset_state_server_nonexistent_server(self):
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.reset_state, '999')
@test.attr(type=['negative', 'gate'])
@@ -125,7 +125,7 @@
@test.attr(type=['negative', 'gate'])
def test_migrate_non_existent_server(self):
# migrate a non existent server
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.migrate_server,
str(uuid.uuid4()))
diff --git a/tempest/api/compute/admin/test_simple_tenant_usage_negative.py b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
index 8c31d7c..da8ba35 100644
--- a/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
+++ b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
@@ -14,6 +14,7 @@
# under the License.
import datetime
+from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
from tempest import exceptions
@@ -42,7 +43,7 @@
# Get usage for a specific tenant empty
params = {'start': self.start,
'end': self.end}
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.adm_client.get_tenant_usage,
'', params)
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 3e80bf2..4ad6c1d 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
import time
from tempest import clients
@@ -107,7 +108,7 @@
for server in cls.servers:
try:
cls.servers_client.delete_server(server['id'])
- except exceptions.NotFound:
+ except lib_exc.NotFound:
# Something else already cleaned up the server, nothing to be
# worried about
pass
@@ -147,7 +148,7 @@
for image_id in cls.images:
try:
cls.images_client.delete_image(image_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
# The image may have already been deleted which is OK.
pass
except Exception:
@@ -160,7 +161,7 @@
for sg in cls.security_groups:
try:
cls.security_groups_client.delete_security_group(sg['id'])
- except exceptions.NotFound:
+ except lib_exc.NotFound:
# The security group may have already been deleted which is OK.
pass
except Exception as exc:
@@ -174,7 +175,7 @@
for server_group_id in cls.server_groups:
try:
cls.servers_client.delete_server_group(server_group_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
# The server-group may have already been deleted which is OK.
pass
except Exception:
@@ -274,7 +275,7 @@
# TODO(mriedem): We should move the wait_for_resource_deletion
# into the delete_volume method as a convenience to the caller.
volumes_client.wait_for_resource_deletion(volume_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
LOG.warn("Unable to delete volume '%s' since it was not found. "
"Maybe it was already deleted?" % volume_id)
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions.py b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
index a5990bc..089ee5a 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
@@ -17,7 +17,6 @@
from tempest.api.compute.floating_ips import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -51,7 +50,7 @@
try:
self.client.delete_floating_ip(floating_ip_id)
# if not found, it depicts it was deleted in the test
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
@test.attr(type='gate')
@@ -136,7 +135,7 @@
self.new_server_id)
# Make sure no longer associated with old server
- self.assertRaises((exceptions.NotFound,
+ self.assertRaises((lib_exc.NotFound,
lib_exc.UnprocessableEntity,
lib_exc.Conflict),
self.client.disassociate_floating_ip_from_server,
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
index b08df97..b4ea175 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
@@ -15,6 +15,8 @@
import uuid
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute.floating_ips import base
from tempest.common.utils import data_utils
from tempest import config
@@ -52,7 +54,7 @@
def test_allocate_floating_ip_from_nonexistent_pool(self):
# Negative test:Allocation of a new floating IP from a nonexistent_pool
# to a project should fail
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.create_floating_ip,
"non_exist_pool")
@@ -63,7 +65,7 @@
# from project should fail
# Deleting the non existent floating IP
- self.assertRaises(exceptions.NotFound, self.client.delete_floating_ip,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_floating_ip,
self.non_exist_id)
@test.attr(type=['negative', 'gate'])
@@ -72,7 +74,7 @@
# Negative test:Association of a non existent floating IP
# to specific server should fail
# Associating non existent floating IP
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.associate_floating_ip_to_server,
"0.0.0.0", self.server_id)
@@ -81,7 +83,7 @@
def test_dissociate_nonexistent_floating_ip(self):
# Negative test:Dissociation of a non existent floating IP should fail
# Dissociating non existent floating IP
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.disassociate_floating_ip_from_server,
"0.0.0.0", self.server_id)
@@ -90,6 +92,6 @@
def test_associate_ip_to_server_without_passing_floating_ip(self):
# Negative test:Association of empty floating IP to specific server
# should raise NotFound or BadRequest(In case of Nova V2.1) exception.
- self.assertRaises((exceptions.NotFound, exceptions.BadRequest),
+ self.assertRaises((lib_exc.NotFound, exceptions.BadRequest),
self.client.associate_floating_ip_to_server,
'', self.server_id)
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py b/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
index c343018..b3ff132 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
@@ -15,10 +15,11 @@
import uuid
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -41,5 +42,5 @@
non_exist_id = str(uuid.uuid4())
else:
non_exist_id = data_utils.rand_int_id(start=999)
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.get_floating_ip_details, non_exist_id)
diff --git a/tempest/api/compute/images/test_image_metadata_negative.py b/tempest/api/compute/images/test_image_metadata_negative.py
index 73412ff..0013714 100644
--- a/tempest/api/compute/images/test_image_metadata_negative.py
+++ b/tempest/api/compute/images/test_image_metadata_negative.py
@@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -30,21 +31,21 @@
def test_list_nonexistent_image_metadata(self):
# Negative test: List on nonexistent image
# metadata should not happen
- self.assertRaises(exceptions.NotFound, self.client.list_image_metadata,
+ self.assertRaises(lib_exc.NotFound, self.client.list_image_metadata,
data_utils.rand_uuid())
@test.attr(type=['negative', 'gate'])
def test_update_nonexistent_image_metadata(self):
# Negative test:An update should not happen for a non-existent image
meta = {'os_distro': 'alt1', 'os_version': 'alt2'}
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.update_image_metadata,
data_utils.rand_uuid(), meta)
@test.attr(type=['negative', 'gate'])
def test_get_nonexistent_image_metadata_item(self):
# Negative test: Get on non-existent image should not happen
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.get_image_metadata_item,
data_utils.rand_uuid(), 'os_version')
@@ -52,7 +53,7 @@
def test_set_nonexistent_image_metadata(self):
# Negative test: Metadata should not be set to a non-existent image
meta = {'os_distro': 'alt1', 'os_version': 'alt2'}
- self.assertRaises(exceptions.NotFound, self.client.set_image_metadata,
+ self.assertRaises(lib_exc.NotFound, self.client.set_image_metadata,
data_utils.rand_uuid(), meta)
@test.attr(type=['negative', 'gate'])
@@ -60,7 +61,7 @@
# Negative test: Metadata item should not be set to a
# nonexistent image
meta = {'os_distro': 'alt'}
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.set_image_metadata_item,
data_utils.rand_uuid(), 'os_distro',
meta)
@@ -69,6 +70,6 @@
def test_delete_nonexistent_image_metadata_item(self):
# Negative test: Shouldn't be able to delete metadata
# item from non-existent image
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.delete_image_metadata_item,
data_utils.rand_uuid(), 'os_distro')
diff --git a/tempest/api/compute/images/test_images_negative.py b/tempest/api/compute/images/test_images_negative.py
index 58fc20d..cf127ee 100644
--- a/tempest/api/compute/images/test_images_negative.py
+++ b/tempest/api/compute/images/test_images_negative.py
@@ -12,10 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -49,7 +50,7 @@
# Create a new image after server is deleted
name = data_utils.rand_name('image')
meta = {'image_type': 'test'}
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.create_image_from_server,
server['id'], name=name, meta=meta)
@@ -61,7 +62,7 @@
meta = {'image_type': 'test'}
resp = {}
resp['status'] = None
- self.assertRaises(exceptions.NotFound, self.create_image_from_server,
+ self.assertRaises(lib_exc.NotFound, self.create_image_from_server,
'!@#$%^&*()', name=name, meta=meta)
@test.attr(type=['negative', 'gate'])
@@ -84,7 +85,7 @@
# Return an error if Image ID passed is 35 characters or less
snapshot_name = data_utils.rand_name('test-snap-')
test_uuid = ('a' * 35)
- self.assertRaises(exceptions.NotFound, self.client.create_image,
+ self.assertRaises(lib_exc.NotFound, self.client.create_image,
test_uuid, snapshot_name)
@test.attr(type=['negative', 'gate'])
@@ -92,13 +93,13 @@
# Return an error if Image ID passed is 37 characters or more
snapshot_name = data_utils.rand_name('test-snap-')
test_uuid = ('a' * 37)
- self.assertRaises(exceptions.NotFound, self.client.create_image,
+ self.assertRaises(lib_exc.NotFound, self.client.create_image,
test_uuid, snapshot_name)
@test.attr(type=['negative', 'gate'])
def test_delete_image_with_invalid_image_id(self):
# An image should not be deleted with invalid image id
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image,
'!@$%^&*()')
@test.attr(type=['negative', 'gate'])
@@ -106,28 +107,28 @@
# Return an error while trying to delete a non-existent image
non_existent_image_id = '11a22b9-12a9-5555-cc11-00ab112223fa'
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image,
non_existent_image_id)
@test.attr(type=['negative', 'gate'])
def test_delete_image_blank_id(self):
# Return an error while trying to delete an image with blank Id
- self.assertRaises(exceptions.NotFound, self.client.delete_image, '')
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image, '')
@test.attr(type=['negative', 'gate'])
def test_delete_image_non_hex_string_id(self):
# Return an error while trying to delete an image with non hex id
image_id = '11a22b9-120q-5555-cc11-00ab112223gj'
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image,
image_id)
@test.attr(type=['negative', 'gate'])
def test_delete_image_negative_image_id(self):
# Return an error while trying to delete an image with negative id
- self.assertRaises(exceptions.NotFound, self.client.delete_image, -1)
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image, -1)
@test.attr(type=['negative', 'gate'])
def test_delete_image_id_is_over_35_character_limit(self):
# Return an error while trying to delete image with id over limit
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image,
'11a22b9-12a9-5555-cc11-00ab112223fa-3fac')
diff --git a/tempest/api/compute/images/test_images_oneserver_negative.py b/tempest/api/compute/images/test_images_oneserver_negative.py
index 700a62f..63f5b9e 100644
--- a/tempest/api/compute/images/test_images_oneserver_negative.py
+++ b/tempest/api/compute/images/test_images_oneserver_negative.py
@@ -129,4 +129,4 @@
self.client.delete_image(image_id)
self.image_ids.remove(image_id)
- self.assertRaises(exceptions.NotFound, self.client.get_image, image_id)
+ self.assertRaises(lib_exc.NotFound, self.client.get_image, image_id)
diff --git a/tempest/api/compute/images/test_list_image_filters_negative.py b/tempest/api/compute/images/test_list_image_filters_negative.py
index a8f2ae7..77c9459 100644
--- a/tempest/api/compute/images/test_list_image_filters_negative.py
+++ b/tempest/api/compute/images/test_list_image_filters_negative.py
@@ -12,10 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -35,5 +36,5 @@
def test_get_nonexistent_image(self):
# Check raises a NotFound
nonexistent_image = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound, self.client.get_image,
+ self.assertRaises(lib_exc.NotFound, self.client.get_image,
nonexistent_image)
diff --git a/tempest/api/compute/keypairs/test_keypairs_negative.py b/tempest/api/compute/keypairs/test_keypairs_negative.py
index 374b76c..1586405 100644
--- a/tempest/api/compute/keypairs/test_keypairs_negative.py
+++ b/tempest/api/compute/keypairs/test_keypairs_negative.py
@@ -45,7 +45,7 @@
def test_keypair_delete_nonexistent_key(self):
# Non-existent key deletion should throw a proper error
k_name = data_utils.rand_name("keypair-non-existent-")
- self.assertRaises(exceptions.NotFound, self.client.delete_keypair,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_keypair,
k_name)
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/compute/security_groups/test_security_group_rules_negative.py b/tempest/api/compute/security_groups/test_security_group_rules_negative.py
index d97c404..c8da63f 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules_negative.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules_negative.py
@@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute.security_groups import base
from tempest.common.utils import data_utils
from tempest import config
@@ -46,7 +48,7 @@
ip_protocol = 'tcp'
from_port = 22
to_port = 22
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
@@ -158,6 +160,6 @@
# Negative test: Deletion of Security Group rule should be FAIL
# with non existent id
non_existent_rule_id = not_existing_id()
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.delete_security_group_rule,
non_existent_rule_id)
diff --git a/tempest/api/compute/security_groups/test_security_groups_negative.py b/tempest/api/compute/security_groups/test_security_groups_negative.py
index ee9f78b..a083406 100644
--- a/tempest/api/compute/security_groups/test_security_groups_negative.py
+++ b/tempest/api/compute/security_groups/test_security_groups_negative.py
@@ -14,6 +14,7 @@
# under the License.
from tempest_lib import decorators
+from tempest_lib import exceptions as lib_exc
import testtools
from tempest.api.compute.security_groups import base
@@ -53,7 +54,7 @@
# Negative test:Should not be able to GET the details
# of non-existent Security Group
non_exist_id = self._generate_a_non_existent_security_group_id()
- self.assertRaises(exceptions.NotFound, self.client.get_security_group,
+ self.assertRaises(lib_exc.NotFound, self.client.get_security_group,
non_exist_id)
@decorators.skip_because(bug="1161411",
@@ -132,7 +133,7 @@
def test_delete_nonexistent_security_group(self):
# Negative test:Deletion of a non-existent Security Group should fail
non_exist_id = self._generate_a_non_existent_security_group_id()
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.delete_security_group, non_exist_id)
@test.attr(type=['negative', 'smoke'])
@@ -140,7 +141,7 @@
def test_delete_security_group_without_passing_id(self):
# Negative test:Deletion of a Security Group with out passing ID
# should Fail
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.delete_security_group, '')
@testtools.skipIf(CONF.service_available.neutron,
@@ -194,7 +195,7 @@
non_exist_id = self._generate_a_non_existent_security_group_id()
s_name = data_utils.rand_name('sg-')
s_description = data_utils.rand_name('description-')
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.update_security_group,
non_exist_id, name=s_name,
description=s_description)
diff --git a/tempest/api/compute/servers/test_instance_actions_negative.py b/tempest/api/compute/servers/test_instance_actions_negative.py
index e92f04c..116191c 100644
--- a/tempest/api/compute/servers/test_instance_actions_negative.py
+++ b/tempest/api/compute/servers/test_instance_actions_negative.py
@@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -32,12 +33,12 @@
def test_list_instance_actions_non_existent_server(self):
# List actions of the non-existent server id
non_existent_server_id = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.list_instance_actions,
non_existent_server_id)
@test.attr(type=['negative', 'gate'])
def test_get_instance_action_invalid_request(self):
# Get the action details of the provided server with invalid request
- self.assertRaises(exceptions.NotFound, self.client.get_instance_action,
+ self.assertRaises(lib_exc.NotFound, self.client.get_instance_action,
self.server_id, '999')
diff --git a/tempest/api/compute/servers/test_list_server_filters.py b/tempest/api/compute/servers/test_list_server_filters.py
index 375f441..cb90873 100644
--- a/tempest/api/compute/servers/test_list_server_filters.py
+++ b/tempest/api/compute/servers/test_list_server_filters.py
@@ -14,12 +14,12 @@
# under the License.
from tempest_lib import decorators
+from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
from tempest.api import utils
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -48,13 +48,13 @@
# not exist, fail early since the tests won't work...
try:
cls.images_client.get_image(cls.image_ref)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
raise RuntimeError("Image %s (image_ref) was not found!" %
cls.image_ref)
try:
cls.images_client.get_image(cls.image_ref_alt)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
raise RuntimeError("Image %s (image_ref_alt) was not found!" %
cls.image_ref_alt)
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index b32a73b..f948a3a 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -25,7 +25,6 @@
from tempest.common.utils import data_utils
from tempest.common.utils.linux import remote_client
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -263,7 +262,7 @@
if oldest_backup_exist:
try:
self.os.image_client.delete_image(oldest_backup)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
else:
LOG.warning("Deletion of oldest backup %s should not have "
diff --git a/tempest/api/compute/servers/test_server_addresses_negative.py b/tempest/api/compute/servers/test_server_addresses_negative.py
index 3087e59..77a041a 100644
--- a/tempest/api/compute/servers/test_server_addresses_negative.py
+++ b/tempest/api/compute/servers/test_server_addresses_negative.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
-from tempest import exceptions
from tempest import test
@@ -32,13 +33,13 @@
@test.services('network')
def test_list_server_addresses_invalid_server_id(self):
# List addresses request should fail if server id not in system
- self.assertRaises(exceptions.NotFound, self.client.list_addresses,
+ self.assertRaises(lib_exc.NotFound, self.client.list_addresses,
'999')
@test.attr(type=['negative', 'gate'])
@test.services('network')
def test_list_server_addresses_by_network_neg(self):
# List addresses by network should fail if network name not valid
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.list_addresses_by_network,
self.server['id'], 'invalid')
diff --git a/tempest/api/compute/servers/test_server_metadata_negative.py b/tempest/api/compute/servers/test_server_metadata_negative.py
index 17a1e28..7b488f9 100644
--- a/tempest/api/compute/servers/test_server_metadata_negative.py
+++ b/tempest/api/compute/servers/test_server_metadata_negative.py
@@ -60,7 +60,7 @@
def test_server_metadata_non_existent_server(self):
# GET on a non-existent server should not succeed
non_existent_server_id = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.get_server_metadata_item,
non_existent_server_id,
'test2')
@@ -69,7 +69,7 @@
def test_list_server_metadata_non_existent_server(self):
# List metadata on a non-existent server should not succeed
non_existent_server_id = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.list_server_metadata,
non_existent_server_id)
@@ -87,7 +87,7 @@
# Set metadata on a non-existent server should not succeed
non_existent_server_id = data_utils.rand_uuid()
meta = {'meta1': 'data1'}
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.set_server_metadata,
non_existent_server_id,
meta)
@@ -97,7 +97,7 @@
# An update should not happen for a non-existent server
non_existent_server_id = data_utils.rand_uuid()
meta = {'key1': 'value1', 'key2': 'value2'}
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.update_server_metadata,
non_existent_server_id,
meta)
@@ -114,7 +114,7 @@
def test_delete_metadata_non_existent_server(self):
# Should not be able to delete metadata item from a non-existent server
non_existent_server_id = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.delete_server_metadata_item,
non_existent_server_id,
'd')
diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py
index f2d3d9d..6780455 100644
--- a/tempest/api/compute/servers/test_server_rescue_negative.py
+++ b/tempest/api/compute/servers/test_server_rescue_negative.py
@@ -19,7 +19,6 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -96,7 +95,7 @@
def test_rescue_non_existent_server(self):
# Rescue a non-existing server
non_existent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.servers_client.rescue_server,
non_existent_server)
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index 27a3257..845a71e 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -109,7 +109,7 @@
def test_resize_nonexistent_server(self):
# Resize a non-existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.resize,
nonexistent_server, self.flavor_ref)
@@ -134,7 +134,7 @@
def test_reboot_non_existent_server(self):
# Reboot a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound, self.client.reboot,
+ self.assertRaises(lib_exc.NotFound, self.client.reboot,
nonexistent_server, 'SOFT')
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
@@ -156,17 +156,17 @@
self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.rebuild,
server['id'], self.image_ref_alt)
- self.assertRaises(exceptions.NotFound, self.client.reboot,
+ self.assertRaises(lib_exc.NotFound, self.client.reboot,
server['id'], 'SOFT')
@test.attr(type=['negative', 'gate'])
def test_rebuild_non_existent_server(self):
# Rebuild a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.rebuild,
nonexistent_server,
self.image_ref_alt)
@@ -222,7 +222,7 @@
server_name = data_utils.rand_name('server')
new_name = data_utils.rand_name('server') + '_updated'
- self.assertRaises(exceptions.NotFound, self.client.update_server,
+ self.assertRaises(lib_exc.NotFound, self.client.update_server,
server_name, name=new_name)
@test.attr(type=['negative', 'gate'])
@@ -240,7 +240,7 @@
# Update name of a server that belongs to another tenant
new_name = self.server_id + '_new'
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_client.update_server, self.server_id,
name=new_name)
@@ -259,13 +259,13 @@
# Delete a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound, self.client.delete_server,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_server,
nonexistent_server)
@test.attr(type=['negative', 'gate'])
def test_delete_a_server_of_another_tenant(self):
# Delete a server that belongs to another tenant
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_client.delete_server,
self.server_id)
@@ -273,13 +273,13 @@
def test_delete_server_pass_negative_id(self):
# Pass an invalid string parameter to delete server
- self.assertRaises(exceptions.NotFound, self.client.delete_server, -1)
+ self.assertRaises(lib_exc.NotFound, self.client.delete_server, -1)
@test.attr(type=['negative', 'gate'])
def test_delete_server_pass_id_exceeding_length_limit(self):
# Pass a server ID that exceeds length limit to delete server
- self.assertRaises(exceptions.NotFound, self.client.delete_server,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_server,
sys.maxint + 1)
@test.attr(type=['negative', 'gate'])
@@ -295,14 +295,14 @@
def test_get_non_existent_server(self):
# Get a non existent server details
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound, self.client.get_server,
+ self.assertRaises(lib_exc.NotFound, self.client.get_server,
nonexistent_server)
@test.attr(type=['negative', 'gate'])
def test_stop_non_existent_server(self):
# Stop a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound, self.servers_client.stop,
+ self.assertRaises(lib_exc.NotFound, self.servers_client.stop,
nonexistent_server)
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
@@ -311,7 +311,7 @@
def test_pause_non_existent_server(self):
# pause a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound, self.client.pause_server,
+ self.assertRaises(lib_exc.NotFound, self.client.pause_server,
nonexistent_server)
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
@@ -320,7 +320,7 @@
def test_unpause_non_existent_server(self):
# unpause a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound, self.client.unpause_server,
+ self.assertRaises(lib_exc.NotFound, self.client.unpause_server,
nonexistent_server)
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
@@ -338,7 +338,7 @@
def test_suspend_non_existent_server(self):
# suspend a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound, self.client.suspend_server,
+ self.assertRaises(lib_exc.NotFound, self.client.suspend_server,
nonexistent_server)
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,
@@ -360,7 +360,7 @@
def test_resume_non_existent_server(self):
# resume a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound, self.client.resume_server,
+ self.assertRaises(lib_exc.NotFound, self.client.resume_server,
nonexistent_server)
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,
@@ -376,7 +376,7 @@
def test_get_console_output_of_non_existent_server(self):
# get the console output for a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.get_console_output,
nonexistent_server, 10)
@@ -384,7 +384,7 @@
def test_force_delete_nonexistent_server_id(self):
# force-delete a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.force_delete_server,
nonexistent_server)
@@ -392,7 +392,7 @@
def test_restore_nonexistent_server_id(self):
# restore-delete a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.restore_soft_deleted_server,
nonexistent_server)
@@ -409,7 +409,7 @@
def test_shelve_non_existent_server(self):
# shelve a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound, self.client.shelve_server,
+ self.assertRaises(lib_exc.NotFound, self.client.shelve_server,
nonexistent_server)
@testtools.skipUnless(CONF.compute_feature_enabled.shelve,
@@ -448,7 +448,7 @@
def test_unshelve_non_existent_server(self):
# unshelve a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound, self.client.unshelve_server,
+ self.assertRaises(lib_exc.NotFound, self.client.unshelve_server,
nonexistent_server)
@testtools.skipUnless(CONF.compute_feature_enabled.shelve,
diff --git a/tempest/api/compute/servers/test_virtual_interfaces_negative.py b/tempest/api/compute/servers/test_virtual_interfaces_negative.py
index e81ccc6..d66b7ba 100644
--- a/tempest/api/compute/servers/test_virtual_interfaces_negative.py
+++ b/tempest/api/compute/servers/test_virtual_interfaces_negative.py
@@ -15,8 +15,9 @@
import uuid
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
-from tempest import exceptions
from tempest import test
@@ -35,6 +36,6 @@
# Negative test: Should not be able to GET virtual interfaces
# for an invalid server_id
invalid_server_id = str(uuid.uuid4())
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.list_virtual_interfaces,
invalid_server_id)
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index cdbaee8..16b7ed2 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -15,6 +15,8 @@
import StringIO
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest import clients
from tempest.common.utils import data_utils
@@ -93,32 +95,32 @@
@test.attr(type='gate')
def test_get_server_for_alt_account_fails(self):
# A GET request for a server on another user's account should fail
- self.assertRaises(exceptions.NotFound, self.alt_client.get_server,
+ self.assertRaises(lib_exc.NotFound, self.alt_client.get_server,
self.server['id'])
@test.attr(type='gate')
def test_delete_server_for_alt_account_fails(self):
# A DELETE request for another user's server should fail
- self.assertRaises(exceptions.NotFound, self.alt_client.delete_server,
+ self.assertRaises(lib_exc.NotFound, self.alt_client.delete_server,
self.server['id'])
@test.attr(type='gate')
def test_update_server_for_alt_account_fails(self):
# An update server request for another user's server should fail
- self.assertRaises(exceptions.NotFound, self.alt_client.update_server,
+ self.assertRaises(lib_exc.NotFound, self.alt_client.update_server,
self.server['id'], name='test')
@test.attr(type='gate')
def test_list_server_addresses_for_alt_account_fails(self):
# A list addresses request for another user's server should fail
- self.assertRaises(exceptions.NotFound, self.alt_client.list_addresses,
+ self.assertRaises(lib_exc.NotFound, self.alt_client.list_addresses,
self.server['id'])
@test.attr(type='gate')
def test_list_server_addresses_by_network_for_alt_account_fails(self):
# A list address/network request for another user's server should fail
server_id = self.server['id']
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_client.list_addresses_by_network, server_id,
'public')
@@ -135,31 +137,31 @@
@test.attr(type='gate')
def test_change_password_for_alt_account_fails(self):
# A change password request for another user's server should fail
- self.assertRaises(exceptions.NotFound, self.alt_client.change_password,
+ self.assertRaises(lib_exc.NotFound, self.alt_client.change_password,
self.server['id'], 'newpass')
@test.attr(type='gate')
def test_reboot_server_for_alt_account_fails(self):
# A reboot request for another user's server should fail
- self.assertRaises(exceptions.NotFound, self.alt_client.reboot,
+ self.assertRaises(lib_exc.NotFound, self.alt_client.reboot,
self.server['id'], 'HARD')
@test.attr(type='gate')
def test_rebuild_server_for_alt_account_fails(self):
# A rebuild request for another user's server should fail
- self.assertRaises(exceptions.NotFound, self.alt_client.rebuild,
+ self.assertRaises(lib_exc.NotFound, self.alt_client.rebuild,
self.server['id'], self.image_ref_alt)
@test.attr(type='gate')
def test_resize_server_for_alt_account_fails(self):
# A resize request for another user's server should fail
- self.assertRaises(exceptions.NotFound, self.alt_client.resize,
+ self.assertRaises(lib_exc.NotFound, self.alt_client.resize,
self.server['id'], self.flavor_ref_alt)
@test.attr(type='gate')
def test_create_image_for_alt_account_fails(self):
# A create image request for another user's server should fail
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_images_client.create_image,
self.server['id'], 'testImage')
@@ -208,27 +210,27 @@
@test.attr(type='gate')
def test_get_keypair_of_alt_account_fails(self):
# A GET request for another user's keypair should fail
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_keypairs_client.get_keypair,
self.keypairname)
@test.attr(type='gate')
def test_delete_keypair_of_alt_account_fails(self):
# A DELETE request for another user's keypair should fail
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_keypairs_client.delete_keypair,
self.keypairname)
@test.attr(type='gate')
def test_get_image_for_alt_account_fails(self):
# A GET request for an image on another user's account should fail
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_images_client.get_image, self.image['id'])
@test.attr(type='gate')
def test_delete_image_for_alt_account_fails(self):
# A DELETE request for another user's image should fail
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_images_client.delete_image,
self.image['id'])
@@ -260,14 +262,14 @@
@test.attr(type='gate')
def test_get_security_group_of_alt_account_fails(self):
# A GET request for another user's security group should fail
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_security_client.get_security_group,
self.security_group['id'])
@test.attr(type='gate')
def test_delete_security_group_of_alt_account_fails(self):
# A DELETE request for another user's security group should fail
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_security_client.delete_security_group,
self.security_group['id'])
@@ -305,7 +307,7 @@
def test_delete_security_group_rule_of_alt_account_fails(self):
# A DELETE request for another user's security group rule
# should fail
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_security_client.delete_security_group_rule,
self.rule['id'])
@@ -313,7 +315,7 @@
def test_set_metadata_of_alt_account_server_fails(self):
# A set metadata for another user's server should fail
req_metadata = {'meta1': 'data1', 'meta2': 'data2'}
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_client.set_server_metadata,
self.server['id'],
req_metadata)
@@ -322,7 +324,7 @@
def test_set_metadata_of_alt_account_image_fails(self):
# A set metadata for another user's image should fail
req_metadata = {'meta1': 'value1', 'meta2': 'value2'}
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_images_client.set_image_metadata,
self.image['id'], req_metadata)
@@ -333,7 +335,7 @@
self.client.set_server_metadata(self.server['id'], req_metadata)
self.addCleanup(self.client.delete_server_metadata_item,
self.server['id'], 'meta1')
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_client.get_server_metadata_item,
self.server['id'], 'meta1')
@@ -345,7 +347,7 @@
self.image['id'], 'meta1')
self.images_client.set_image_metadata(self.image['id'],
req_metadata)
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_images_client.get_image_metadata_item,
self.image['id'], 'meta1')
@@ -356,7 +358,7 @@
self.addCleanup(self.client.delete_server_metadata_item,
self.server['id'], 'meta1')
self.client.set_server_metadata(self.server['id'], req_metadata)
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_client.delete_server_metadata_item,
self.server['id'], 'meta1')
@@ -368,13 +370,13 @@
self.image['id'], 'meta1')
self.images_client.set_image_metadata(self.image['id'],
req_metadata)
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_images_client.delete_image_metadata_item,
self.image['id'], 'meta1')
@test.attr(type='gate')
def test_get_console_output_of_alt_account_server_fails(self):
# A Get Console Output for another user's server should fail
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_client.get_console_output,
self.server['id'], 10)
diff --git a/tempest/api/compute/volumes/test_volumes_negative.py b/tempest/api/compute/volumes/test_volumes_negative.py
index f0f9879..53253c9 100644
--- a/tempest/api/compute/volumes/test_volumes_negative.py
+++ b/tempest/api/compute/volumes/test_volumes_negative.py
@@ -15,6 +15,8 @@
import uuid
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
@@ -39,7 +41,7 @@
# Negative: Should not be able to get details of nonexistent volume
# Creating a nonexistent volume id
# Trying to GET a non existent volume
- self.assertRaises(exceptions.NotFound, self.client.get_volume,
+ self.assertRaises(lib_exc.NotFound, self.client.get_volume,
str(uuid.uuid4()))
@test.attr(type=['negative', 'gate'])
@@ -47,7 +49,7 @@
# Negative: Should not be able to delete nonexistent Volume
# Creating nonexistent volume id
# Trying to DELETE a non existent volume
- self.assertRaises(exceptions.NotFound, self.client.delete_volume,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_volume,
str(uuid.uuid4()))
@test.attr(type=['negative', 'gate'])
@@ -79,22 +81,22 @@
@test.attr(type=['negative', 'gate'])
def test_get_invalid_volume_id(self):
# Negative: Should not be able to get volume with invalid id
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.get_volume, '#$%%&^&^')
@test.attr(type=['negative', 'gate'])
def test_get_volume_without_passing_volume_id(self):
# Negative: Should not be able to get volume when empty ID is passed
- self.assertRaises(exceptions.NotFound, self.client.get_volume, '')
+ self.assertRaises(lib_exc.NotFound, self.client.get_volume, '')
@test.attr(type=['negative', 'gate'])
def test_delete_invalid_volume_id(self):
# Negative: Should not be able to delete volume when invalid ID is
# passed
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.delete_volume, '!@#$%^&*()')
@test.attr(type=['negative', 'gate'])
def test_delete_volume_without_passing_volume_id(self):
# Negative: Should not be able to delete volume when empty ID is passed
- self.assertRaises(exceptions.NotFound, self.client.delete_volume, '')
+ self.assertRaises(lib_exc.NotFound, self.client.delete_volume, '')
diff --git a/tempest/api/data_processing/base.py b/tempest/api/data_processing/base.py
index 45c8488..4c53a57 100644
--- a/tempest/api/data_processing/base.py
+++ b/tempest/api/data_processing/base.py
@@ -12,8 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest import config
-from tempest import exceptions
import tempest.test
@@ -63,7 +64,7 @@
for resource_id in resource_id_list:
try:
method(resource_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
# ignore errors while auto removing created resource
pass
diff --git a/tempest/api/database/flavors/test_flavors_negative.py b/tempest/api/database/flavors/test_flavors_negative.py
index 9f14cce..c6acacf 100644
--- a/tempest/api/database/flavors/test_flavors_negative.py
+++ b/tempest/api/database/flavors/test_flavors_negative.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.database import base
-from tempest import exceptions
from tempest import test
@@ -28,5 +29,5 @@
@test.attr(type=['negative', 'gate'])
def test_get_non_existent_db_flavor(self):
# flavor details are not returned for non-existent flavors
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.get_db_flavor_details, -1)
diff --git a/tempest/api/identity/admin/test_roles_negative.py b/tempest/api/identity/admin/test_roles_negative.py
index 8dc0350..679db13 100644
--- a/tempest/api/identity/admin/test_roles_negative.py
+++ b/tempest/api/identity/admin/test_roles_negative.py
@@ -107,7 +107,7 @@
def test_delete_role_non_existent(self):
# Attempt to delete a non existent role should fail
non_existent_role = str(uuid.uuid4().hex)
- self.assertRaises(exceptions.NotFound, self.client.delete_role,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_role,
non_existent_role)
@test.attr(type=['negative', 'gate'])
@@ -135,7 +135,7 @@
# Attempt to assign a non existent role to user should fail
(user, tenant, role) = self._get_role_params()
non_existent_role = str(uuid.uuid4().hex)
- self.assertRaises(exceptions.NotFound, self.client.assign_user_role,
+ self.assertRaises(lib_exc.NotFound, self.client.assign_user_role,
tenant['id'], user['id'], non_existent_role)
@test.attr(type=['negative', 'gate'])
@@ -143,7 +143,7 @@
# Attempt to assign a role on a non existent tenant should fail
(user, tenant, role) = self._get_role_params()
non_existent_tenant = str(uuid.uuid4().hex)
- self.assertRaises(exceptions.NotFound, self.client.assign_user_role,
+ self.assertRaises(lib_exc.NotFound, self.client.assign_user_role,
non_existent_tenant, user['id'], role['id'])
@test.attr(type=['negative', 'gate'])
@@ -188,7 +188,7 @@
user['id'],
role['id'])
non_existent_role = str(uuid.uuid4().hex)
- self.assertRaises(exceptions.NotFound, self.client.remove_user_role,
+ self.assertRaises(lib_exc.NotFound, self.client.remove_user_role,
tenant['id'], user['id'], non_existent_role)
@test.attr(type=['negative', 'gate'])
@@ -199,7 +199,7 @@
user['id'],
role['id'])
non_existent_tenant = str(uuid.uuid4().hex)
- self.assertRaises(exceptions.NotFound, self.client.remove_user_role,
+ self.assertRaises(lib_exc.NotFound, self.client.remove_user_role,
non_existent_tenant, user['id'], role['id'])
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/identity/admin/test_services.py b/tempest/api/identity/admin/test_services.py
index 03d6e35..30e0058 100644
--- a/tempest/api/identity/admin/test_services.py
+++ b/tempest/api/identity/admin/test_services.py
@@ -14,10 +14,10 @@
# under the License.
from six import moves
+from tempest_lib import exceptions as lib_exc
from tempest.api.identity import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -28,7 +28,7 @@
# Deleting the service created in this method
self.client.delete_service(service_id)
# Checking whether service is deleted successfully
- self.assertRaises(exceptions.NotFound, self.client.get_service,
+ self.assertRaises(lib_exc.NotFound, self.client.get_service,
service_id)
@test.attr(type='smoke')
diff --git a/tempest/api/identity/admin/test_tenant_negative.py b/tempest/api/identity/admin/test_tenant_negative.py
index 0a62993..81ba6ff 100644
--- a/tempest/api/identity/admin/test_tenant_negative.py
+++ b/tempest/api/identity/admin/test_tenant_negative.py
@@ -63,7 +63,7 @@
@test.attr(type=['negative', 'gate'])
def test_delete_non_existent_tenant(self):
# Attempt to delete a non existent tenant should fail
- self.assertRaises(exceptions.NotFound, self.client.delete_tenant,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_tenant,
str(uuid.uuid4().hex))
@test.attr(type=['negative', 'gate'])
@@ -113,7 +113,7 @@
@test.attr(type=['negative', 'gate'])
def test_update_non_existent_tenant(self):
# Attempt to update a non existent tenant should fail
- self.assertRaises(exceptions.NotFound, self.client.update_tenant,
+ self.assertRaises(lib_exc.NotFound, self.client.update_tenant,
str(uuid.uuid4().hex))
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/identity/admin/test_users_negative.py b/tempest/api/identity/admin/test_users_negative.py
index 71bb9f8..a3a3e24 100644
--- a/tempest/api/identity/admin/test_users_negative.py
+++ b/tempest/api/identity/admin/test_users_negative.py
@@ -68,7 +68,7 @@
@test.attr(type=['negative', 'gate'])
def test_create_user_for_non_existent_tenant(self):
# Attempt to create a user in a non-existent tenant should fail
- self.assertRaises(exceptions.NotFound, self.client.create_user,
+ self.assertRaises(lib_exc.NotFound, self.client.create_user,
self.alt_user, self.alt_password, '49ffgg99999',
self.alt_email)
@@ -102,7 +102,7 @@
# Attempt to update a user non-existent user should fail
user_name = data_utils.rand_name('user-')
non_existent_id = str(uuid.uuid4())
- self.assertRaises(exceptions.NotFound, self.client.update_user,
+ self.assertRaises(lib_exc.NotFound, self.client.update_user,
non_existent_id, name=user_name)
@test.attr(type=['negative', 'gate'])
@@ -137,7 +137,7 @@
@test.attr(type=['negative', 'gate'])
def test_delete_non_existent_user(self):
# Attempt to delete a non-existent user should fail
- self.assertRaises(exceptions.NotFound, self.client.delete_user,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_user,
'junk12345123')
@test.attr(type=['negative', 'gate'])
@@ -226,5 +226,5 @@
invalid_id.append('!@#()$%^&*?<>{}[]')
# List the users with invalid tenant id
for invalid in invalid_id:
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.list_users_for_tenant, invalid)
diff --git a/tempest/api/identity/admin/v3/test_projects_negative.py b/tempest/api/identity/admin/v3/test_projects_negative.py
index 9b0da6c..8bb7d50 100644
--- a/tempest/api/identity/admin/v3/test_projects_negative.py
+++ b/tempest/api/identity/admin/v3/test_projects_negative.py
@@ -74,5 +74,5 @@
@test.attr(type=['negative', 'gate'])
def test_delete_non_existent_project(self):
# Attempt to delete a non existent project should fail
- self.assertRaises(exceptions.NotFound, self.client.delete_project,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_project,
data_utils.rand_uuid_hex())
diff --git a/tempest/api/identity/admin/v3/test_regions.py b/tempest/api/identity/admin/v3/test_regions.py
index c71cbf3..2ca3538 100644
--- a/tempest/api/identity/admin/v3/test_regions.py
+++ b/tempest/api/identity/admin/v3/test_regions.py
@@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.identity import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -40,7 +41,7 @@
def _delete_region(self, region_id):
self.client.delete_region(region_id)
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.get_region, region_id)
@test.attr(type='gate')
diff --git a/tempest/api/identity/admin/v3/test_services.py b/tempest/api/identity/admin/v3/test_services.py
index 9e45b50..c060094 100644
--- a/tempest/api/identity/admin/v3/test_services.py
+++ b/tempest/api/identity/admin/v3/test_services.py
@@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.identity import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -26,7 +27,7 @@
# Used for deleting the services created in this class
self.service_client.delete_service(service_id)
# Checking whether service is deleted successfully
- self.assertRaises(exceptions.NotFound, self.service_client.get_service,
+ self.assertRaises(lib_exc.NotFound, self.service_client.get_service,
service_id)
@test.attr(type='smoke')
diff --git a/tempest/api/identity/admin/v3/test_tokens.py b/tempest/api/identity/admin/v3/test_tokens.py
index f0acfdf..de142e0 100644
--- a/tempest/api/identity/admin/v3/test_tokens.py
+++ b/tempest/api/identity/admin/v3/test_tokens.py
@@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.identity import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -44,7 +45,7 @@
self.assertEqual(token_details['user']['name'], u_name)
# Perform Delete Token
self.client.delete_token(subject_token)
- self.assertRaises(exceptions.NotFound, self.client.get_token,
+ self.assertRaises(lib_exc.NotFound, self.client.get_token,
subject_token)
@test.attr(type='gate')
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index cd28e96..13c47eb 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -13,6 +13,8 @@
import datetime
import re
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.identity import base
from tempest import auth
from tempest import clients
@@ -166,19 +168,19 @@
self.trust_id, self.delegated_role_id)
# And that we don't find not_delegated_role
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.trustor_client.get_trust_role,
self.trust_id,
self.not_delegated_role_id)
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.trustor_client.check_trust_role,
self.trust_id,
self.not_delegated_role_id)
def delete_trust(self):
self.trustor_client.delete_trust(self.trust_id)
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.trustor_client.get_trust,
self.trust_id)
self.trust_id = None
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 08bfd4f..90e1a9e 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -13,12 +13,12 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
from tempest import auth
from tempest import clients
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest.openstack.common import log as logging
import tempest.test
@@ -226,7 +226,7 @@
func(item['id'], **kwargs)
else:
func(item['id'])
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
except Exception:
LOG.exception("Unexpected exception occurred in %s deletion."
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 12f3fdd..4d33d37 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -13,12 +13,12 @@
# under the License.
import cStringIO as StringIO
+from tempest_lib import exceptions as lib_exc
from tempest import clients
from tempest.common import credentials
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest.openstack.common import log as logging
import tempest.test
@@ -48,7 +48,7 @@
for image_id in cls.created_images:
try:
cls.client.delete_image(image_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
for image_id in cls.created_images:
diff --git a/tempest/api/image/v1/test_image_members_negative.py b/tempest/api/image/v1/test_image_members_negative.py
index aac63b4..1622791 100644
--- a/tempest/api/image/v1/test_image_members_negative.py
+++ b/tempest/api/image/v1/test_image_members_negative.py
@@ -12,10 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
from tempest.api.image import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -25,14 +25,14 @@
def test_add_member_with_non_existing_image(self):
# Add member with non existing image.
non_exist_image = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound, self.client.add_member,
+ self.assertRaises(lib_exc.NotFound, self.client.add_member,
self.alt_tenant_id, non_exist_image)
@test.attr(type=['negative', 'gate'])
def test_delete_member_with_non_existing_image(self):
# Delete member with non existing image.
non_exist_image = data_utils.rand_uuid()
- self.assertRaises(exceptions.NotFound, self.client.delete_member,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_member,
self.alt_tenant_id, non_exist_image)
@test.attr(type=['negative', 'gate'])
@@ -40,13 +40,13 @@
# Delete member with non existing tenant.
image_id = self._create_image()
non_exist_tenant = data_utils.rand_uuid_hex()
- self.assertRaises(exceptions.NotFound, self.client.delete_member,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_member,
non_exist_tenant, image_id)
@test.attr(type=['negative', 'gate'])
def test_get_image_without_membership(self):
# Image is hidden from another tenants.
image_id = self._create_image()
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.alt_img_cli.get_image,
image_id)
diff --git a/tempest/api/image/v1/test_images_negative.py b/tempest/api/image/v1/test_images_negative.py
index 66556e0..b144a83 100644
--- a/tempest/api/image/v1/test_images_negative.py
+++ b/tempest/api/image/v1/test_images_negative.py
@@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.image import base
from tempest import exceptions
from tempest import test
@@ -35,7 +37,7 @@
@test.attr(type=['negative', 'gate'])
def test_delete_image_with_invalid_image_id(self):
# An image should not be deleted with invalid image id
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image,
'!@$%^&*()')
@test.attr(type=['negative', 'gate'])
@@ -43,28 +45,28 @@
# Return an error while trying to delete a non-existent image
non_existent_image_id = '11a22b9-12a9-5555-cc11-00ab112223fa'
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image,
non_existent_image_id)
@test.attr(type=['negative', 'gate'])
def test_delete_image_blank_id(self):
# Return an error while trying to delete an image with blank Id
- self.assertRaises(exceptions.NotFound, self.client.delete_image, '')
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image, '')
@test.attr(type=['negative', 'gate'])
def test_delete_image_non_hex_string_id(self):
# Return an error while trying to delete an image with non hex id
image_id = '11a22b9-120q-5555-cc11-00ab112223gj'
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image,
image_id)
@test.attr(type=['negative', 'gate'])
def test_delete_image_negative_image_id(self):
# Return an error while trying to delete an image with negative id
- self.assertRaises(exceptions.NotFound, self.client.delete_image, -1)
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image, -1)
@test.attr(type=['negative', 'gate'])
def test_delete_image_id_is_over_35_character_limit(self):
# Return an error while trying to delete image with id over limit
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image,
'11a22b9-12a9-5555-cc11-00ab112223fa-3fac')
diff --git a/tempest/api/image/v2/test_images_negative.py b/tempest/api/image/v2/test_images_negative.py
index fc781b1..d32fc3b 100644
--- a/tempest/api/image/v2/test_images_negative.py
+++ b/tempest/api/image/v2/test_images_negative.py
@@ -16,6 +16,8 @@
import uuid
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.image import base
from tempest import exceptions
from tempest import test
@@ -39,14 +41,14 @@
def test_get_non_existent_image(self):
# get the non-existent image
non_existent_id = str(uuid.uuid4())
- self.assertRaises(exceptions.NotFound, self.client.get_image,
+ self.assertRaises(lib_exc.NotFound, self.client.get_image,
non_existent_id)
@test.attr(type=['negative', 'gate'])
def test_get_image_null_id(self):
# get image with image_id = NULL
image_id = ""
- self.assertRaises(exceptions.NotFound, self.client.get_image, image_id)
+ self.assertRaises(lib_exc.NotFound, self.client.get_image, image_id)
@test.attr(type=['negative', 'gate'])
def test_get_delete_deleted_image(self):
@@ -60,24 +62,24 @@
self.client.wait_for_resource_deletion(image_id)
# get the deleted image
- self.assertRaises(exceptions.NotFound, self.client.get_image, image_id)
+ self.assertRaises(lib_exc.NotFound, self.client.get_image, image_id)
# delete the deleted image
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image,
image_id)
@test.attr(type=['negative', 'gate'])
def test_delete_non_existing_image(self):
# delete non-existent image
non_existent_image_id = str(uuid.uuid4())
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image,
non_existent_image_id)
@test.attr(type=['negative', 'gate'])
def test_delete_image_null_id(self):
# delete image with image_id=NULL
image_id = ""
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image,
image_id)
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/image/v2/test_images_tags_negative.py b/tempest/api/image/v2/test_images_tags_negative.py
index aa0a214..5b18862 100644
--- a/tempest/api/image/v2/test_images_tags_negative.py
+++ b/tempest/api/image/v2/test_images_tags_negative.py
@@ -14,9 +14,10 @@
import uuid
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.image import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -27,7 +28,7 @@
# Update tag with non existing image.
tag = data_utils.rand_name('tag-')
non_exist_image = str(uuid.uuid4())
- self.assertRaises(exceptions.NotFound, self.client.add_image_tag,
+ self.assertRaises(lib_exc.NotFound, self.client.add_image_tag,
non_exist_image, tag)
@test.attr(type=['negative', 'gate'])
@@ -40,5 +41,5 @@
image_id = body['id']
tag = data_utils.rand_name('non-exist-tag-')
self.addCleanup(self.client.delete_image, image_id)
- self.assertRaises(exceptions.NotFound, self.client.delete_image_tag,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_image_tag,
image_id, tag)
diff --git a/tempest/api/messaging/test_queues.py b/tempest/api/messaging/test_queues.py
index accbd17..04ba8a3 100644
--- a/tempest/api/messaging/test_queues.py
+++ b/tempest/api/messaging/test_queues.py
@@ -16,11 +16,11 @@
import logging
from six import moves
+from tempest_lib import exceptions as lib_exc
from testtools import matchers
from tempest.api.messaging import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -42,7 +42,7 @@
self.assertEqual('', body)
self.delete_queue(queue_name)
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.get_queue,
queue_name)
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 10cda53..520bec7 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -14,6 +14,7 @@
# under the License.
import netaddr
+from tempest_lib import exceptions as lib_exc
from tempest import clients
from tempest.common.utils import data_utils
@@ -177,7 +178,7 @@
try:
delete_callable(*args, **kwargs)
# if resource is not found, this means it was deleted in the test
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
@classmethod
@@ -399,7 +400,7 @@
try:
cls.client.remove_router_interface_with_subnet_id(
router['id'], i['fixed_ips'][0]['subnet_id'])
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
cls.client.delete_router(router['id'])
diff --git a/tempest/api/network/test_floating_ips_negative.py b/tempest/api/network/test_floating_ips_negative.py
index 82f0519..7e91ba2 100644
--- a/tempest/api/network/test_floating_ips_negative.py
+++ b/tempest/api/network/test_floating_ips_negative.py
@@ -14,6 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.network import base
from tempest.common.utils import data_utils
from tempest import config
@@ -49,7 +51,7 @@
@test.attr(type=['negative', 'smoke'])
def test_create_floatingip_with_port_ext_net_unreachable(self):
- self.assertRaises(exceptions.NotFound, self.client.create_floatingip,
+ self.assertRaises(lib_exc.NotFound, self.client.create_floatingip,
floating_network_id=self.ext_net_id,
port_id=self.port['id'],
fixed_ip_address=self.port['fixed_ips'][0]
@@ -72,7 +74,7 @@
floating_ip = body['floatingip']
self.addCleanup(self.client.delete_floatingip, floating_ip['id'])
# Associate floating IP to the other port
- self.assertRaises(exceptions.NotFound, self.client.update_floatingip,
+ self.assertRaises(lib_exc.NotFound, self.client.update_floatingip,
floating_ip['id'], port_id=self.port['id'],
fixed_ip_address=self.port['fixed_ips'][0]
['ip_address'])
diff --git a/tempest/api/network/test_fwaas_extensions.py b/tempest/api/network/test_fwaas_extensions.py
index 8104567..b0318c9 100644
--- a/tempest/api/network/test_fwaas_extensions.py
+++ b/tempest/api/network/test_fwaas_extensions.py
@@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.network import base
from tempest.common.utils import data_utils
from tempest import config
@@ -63,7 +65,7 @@
try:
self.client.delete_firewall_policy(policy_id)
# if policy is not found, this means it was deleted in the test
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
def _try_delete_rule(self, rule_id):
@@ -71,7 +73,7 @@
try:
self.client.delete_firewall_rule(rule_id)
# if rule is not found, this means it was deleted in the test
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
def _try_delete_firewall(self, fw_id):
@@ -79,7 +81,7 @@
try:
self.client.delete_firewall(fw_id)
# if firewall is not found, this means it was deleted in the test
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
self.client.wait_for_resource_deletion('firewall', fw_id)
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index 4160bd5..a5f9667 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -21,7 +21,6 @@
from tempest.common import custom_matchers
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -281,7 +280,7 @@
try:
self.client.delete_network(net_id)
# if network is not found, this means it was deleted in the test
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
@test.attr(type='smoke')
@@ -301,7 +300,7 @@
body = self.client.delete_network(net_id)
# Verify that the subnet got automatically deleted.
- self.assertRaises(exceptions.NotFound, self.client.show_subnet,
+ self.assertRaises(lib_exc.NotFound, self.client.show_subnet,
subnet_id)
# Since create_subnet adds the subnet to the delete list, and it is
diff --git a/tempest/api/network/test_networks_negative.py b/tempest/api/network/test_networks_negative.py
index bc3ab68..b694728 100644
--- a/tempest/api/network/test_networks_negative.py
+++ b/tempest/api/network/test_networks_negative.py
@@ -14,9 +14,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.network import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -26,29 +27,29 @@
@test.attr(type=['negative', 'smoke'])
def test_show_non_existent_network(self):
non_exist_id = data_utils.rand_name('network')
- self.assertRaises(exceptions.NotFound, self.client.show_network,
+ self.assertRaises(lib_exc.NotFound, self.client.show_network,
non_exist_id)
@test.attr(type=['negative', 'smoke'])
def test_show_non_existent_subnet(self):
non_exist_id = data_utils.rand_name('subnet')
- self.assertRaises(exceptions.NotFound, self.client.show_subnet,
+ self.assertRaises(lib_exc.NotFound, self.client.show_subnet,
non_exist_id)
@test.attr(type=['negative', 'smoke'])
def test_show_non_existent_port(self):
non_exist_id = data_utils.rand_name('port')
- self.assertRaises(exceptions.NotFound, self.client.show_port,
+ self.assertRaises(lib_exc.NotFound, self.client.show_port,
non_exist_id)
@test.attr(type=['negative', 'smoke'])
def test_update_non_existent_network(self):
non_exist_id = data_utils.rand_name('network')
- self.assertRaises(exceptions.NotFound, self.client.update_network,
+ self.assertRaises(lib_exc.NotFound, self.client.update_network,
non_exist_id, name="new_name")
@test.attr(type=['negative', 'smoke'])
def test_delete_non_existent_network(self):
non_exist_id = data_utils.rand_name('network')
- self.assertRaises(exceptions.NotFound, self.client.delete_network,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_network,
non_exist_id)
diff --git a/tempest/api/network/test_routers_negative.py b/tempest/api/network/test_routers_negative.py
index 8409f8d..32dcf74 100644
--- a/tempest/api/network/test_routers_negative.py
+++ b/tempest/api/network/test_routers_negative.py
@@ -43,7 +43,7 @@
@test.attr(type=['negative', 'smoke'])
def test_router_add_gateway_invalid_network_returns_404(self):
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.update_router,
self.router['id'],
external_gateway_info={
@@ -87,19 +87,19 @@
@test.attr(type=['negative', 'smoke'])
def test_show_non_existent_router_returns_404(self):
router = data_utils.rand_name('non_exist_router')
- self.assertRaises(exceptions.NotFound, self.client.show_router,
+ self.assertRaises(lib_exc.NotFound, self.client.show_router,
router)
@test.attr(type=['negative', 'smoke'])
def test_update_non_existent_router_returns_404(self):
router = data_utils.rand_name('non_exist_router')
- self.assertRaises(exceptions.NotFound, self.client.update_router,
+ self.assertRaises(lib_exc.NotFound, self.client.update_router,
router, name="new_name")
@test.attr(type=['negative', 'smoke'])
def test_delete_non_existent_router_returns_404(self):
router = data_utils.rand_name('non_exist_router')
- self.assertRaises(exceptions.NotFound, self.client.delete_router,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_router,
router)
diff --git a/tempest/api/network/test_security_groups_negative.py b/tempest/api/network/test_security_groups_negative.py
index b98f6dd..0398c66 100644
--- a/tempest/api/network/test_security_groups_negative.py
+++ b/tempest/api/network/test_security_groups_negative.py
@@ -39,20 +39,20 @@
@test.attr(type=['negative', 'gate'])
def test_show_non_existent_security_group(self):
non_exist_id = str(uuid.uuid4())
- self.assertRaises(exceptions.NotFound, self.client.show_security_group,
+ self.assertRaises(lib_exc.NotFound, self.client.show_security_group,
non_exist_id)
@test.attr(type=['negative', 'gate'])
def test_show_non_existent_security_group_rule(self):
non_exist_id = str(uuid.uuid4())
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.show_security_group_rule,
non_exist_id)
@test.attr(type=['negative', 'gate'])
def test_delete_non_existent_security_group(self):
non_exist_id = str(uuid.uuid4())
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.delete_security_group,
non_exist_id
)
@@ -90,7 +90,7 @@
group_ids = ['bad_group_id', non_exist_id]
for remote_group_id in group_ids:
self.assertRaises(
- exceptions.NotFound, self.client.create_security_group_rule,
+ lib_exc.NotFound, self.client.create_security_group_rule,
security_group_id=group_create_body['security_group']['id'],
protocol='tcp', direction='ingress', ethertype=self.ethertype,
remote_group_id=remote_group_id)
@@ -186,7 +186,7 @@
def test_create_security_group_rule_with_non_existent_security_group(self):
# Create security group rules with not existing security group.
non_existent_sg = str(uuid.uuid4())
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.create_security_group_rule,
security_group_id=non_existent_sg,
direction='ingress', ethertype=self.ethertype)
diff --git a/tempest/api/network/test_vpnaas_extensions.py b/tempest/api/network/test_vpnaas_extensions.py
index 56e1a05..9ff406c 100644
--- a/tempest/api/network/test_vpnaas_extensions.py
+++ b/tempest/api/network/test_vpnaas_extensions.py
@@ -13,10 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.network import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -74,7 +75,7 @@
try:
self.client.delete_ipsecpolicy(ipsec_policy_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
def _assertExpected(self, expected, actual):
@@ -304,7 +305,7 @@
self._assertExpected(new_ipsec, updated_ipsec_policy)
# Verification of ipsec policy delete
self.client.delete_ipsecpolicy(ipsecpolicy['id'])
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.delete_ipsecpolicy, ipsecpolicy['id'])
@test.attr(type='smoke')
diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py
index 36c9f5a..79a1960 100644
--- a/tempest/api/object_storage/base.py
+++ b/tempest/api/object_storage/base.py
@@ -13,13 +13,13 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
from tempest.api.identity import base
from tempest import clients
from tempest.common import credentials
from tempest.common import custom_matchers
from tempest import config
-from tempest import exceptions
import tempest.test
CONF = config.CONF
@@ -93,10 +93,10 @@
for obj in objlist:
try:
object_client.delete_object(cont, obj['name'])
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
container_client.delete_container(cont)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
def assertHeaders(self, resp, target, method):
@@ -126,7 +126,7 @@
return next(r['id'] for r in roles if r['name'] == role_name)
except StopIteration:
msg = "Role name '%s' is not found" % role_name
- raise exceptions.NotFound(msg)
+ raise lib_exc.NotFound(msg)
def _assign_role(self, role_id):
self.client.assign_user_role(self.tenant['id'],
diff --git a/tempest/api/object_storage/test_container_staticweb.py b/tempest/api/object_storage/test_container_staticweb.py
index a8e5f9a..8a61911 100644
--- a/tempest/api/object_storage/test_container_staticweb.py
+++ b/tempest/api/object_storage/test_container_staticweb.py
@@ -14,10 +14,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.object_storage import base
from tempest.common import custom_matchers
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -161,5 +162,5 @@
# Request non-existing object
self.assertRaises(
- exceptions.NotFound, self.object_client.get_object,
+ lib_exc.NotFound, self.object_client.get_object,
self.container_name, "notexisting")
diff --git a/tempest/api/object_storage/test_object_expiry.py b/tempest/api/object_storage/test_object_expiry.py
index 5fa209d..be5d50e 100644
--- a/tempest/api/object_storage/test_object_expiry.py
+++ b/tempest/api/object_storage/test_object_expiry.py
@@ -13,11 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
import time
from tempest.api.object_storage import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -66,7 +66,7 @@
time.sleep(sleepy_time + 3)
# object should not be there anymore
- self.assertRaises(exceptions.NotFound, self.object_client.get_object,
+ self.assertRaises(lib_exc.NotFound, self.object_client.get_object,
self.container_name, self.object_name)
@test.attr(type='gate')
diff --git a/tempest/api/object_storage/test_object_slo.py b/tempest/api/object_storage/test_object_slo.py
index 6622349..7b85201 100644
--- a/tempest/api/object_storage/test_object_slo.py
+++ b/tempest/api/object_storage/test_object_slo.py
@@ -15,10 +15,11 @@
import hashlib
import json
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.object_storage import base
from tempest.common import custom_matchers
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
# Each segment, except for the final one, must be at least 1 megabyte
@@ -39,7 +40,7 @@
self.object_client.delete_object(
self.container_name,
obj)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
self.container_client.delete_container(self.container_name)
super(ObjectSloTest, self).tearDown()
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index 97777db..2a99630 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -12,12 +12,12 @@
import os.path
+from tempest_lib import exceptions as lib_exc
import yaml
from tempest import clients
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest.openstack.common import log as logging
import tempest.test
@@ -84,14 +84,14 @@
for stack_identifier in cls.stacks:
try:
cls.client.delete_stack(stack_identifier)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
for stack_identifier in cls.stacks:
try:
cls.client.wait_for_stack_status(
stack_identifier, 'DELETE_COMPLETE')
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
@classmethod
@@ -125,7 +125,7 @@
for image_id in cls.images:
try:
cls.images_v2_client.delete_image(image_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
@classmethod
diff --git a/tempest/api/orchestration/stacks/test_soft_conf.py b/tempest/api/orchestration/stacks/test_soft_conf.py
index 8903d4c..220054e 100644
--- a/tempest/api/orchestration/stacks/test_soft_conf.py
+++ b/tempest/api/orchestration/stacks/test_soft_conf.py
@@ -10,10 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest import test
@@ -70,14 +71,14 @@
self.client.delete_software_deploy(deploy_id)
# Testing that it is really gone
self.assertRaises(
- exceptions.NotFound, self.client.get_software_deploy,
+ lib_exc.NotFound, self.client.get_software_deploy,
self.deployment_id)
def _config_delete(self, config_id):
self.client.delete_software_config(config_id)
# Testing that it is really gone
self.assertRaises(
- exceptions.NotFound, self.client.get_software_config, config_id)
+ lib_exc.NotFound, self.client.get_software_config, config_id)
@test.attr(type='smoke')
def test_get_software_config(self):
diff --git a/tempest/api/orchestration/stacks/test_volumes.py b/tempest/api/orchestration/stacks/test_volumes.py
index 6fddb21..322bdf1 100644
--- a/tempest/api/orchestration/stacks/test_volumes.py
+++ b/tempest/api/orchestration/stacks/test_volumes.py
@@ -12,10 +12,11 @@
import logging
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
@@ -73,7 +74,7 @@
# Delete the stack and ensure the volume is gone
self.client.delete_stack(stack_identifier)
self.client.wait_for_stack_status(stack_identifier, 'DELETE_COMPLETE')
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.volumes_client.get_volume,
volume_id)
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index 8885187..dc7a8f5 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -12,6 +12,8 @@
import time
+from tempest_lib import exceptions as lib_exc
+
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
@@ -80,7 +82,7 @@
for resource_id in list_of_ids:
try:
method(resource_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
@classmethod
diff --git a/tempest/api/telemetry/test_telemetry_alarming_api.py b/tempest/api/telemetry/test_telemetry_alarming_api.py
index 97eb4eb..2457438 100644
--- a/tempest/api/telemetry/test_telemetry_alarming_api.py
+++ b/tempest/api/telemetry/test_telemetry_alarming_api.py
@@ -10,9 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.telemetry import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -70,7 +71,7 @@
self.assertDictContainsSubset(new_rule, body['threshold_rule'])
# Delete alarm and verify if deleted
self.telemetry_client.delete_alarm(alarm_id)
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.telemetry_client.get_alarm, alarm_id)
@test.attr(type="gate")
@@ -101,5 +102,5 @@
self.assertDictContainsSubset(rule, body['combination_rule'])
# Verify alarm delete
self.telemetry_client.delete_alarm(alarm_id)
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.telemetry_client.get_alarm, alarm_id)
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
index fff0199..2e2cfd2 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
@@ -15,6 +15,8 @@
import uuid
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import exceptions
@@ -83,7 +85,7 @@
# type id.
extra_specs = {"spec2": "val1"}
self.assertRaises(
- exceptions.NotFound,
+ lib_exc.NotFound,
self.volume_types_client.create_volume_type_extra_specs,
str(uuid.uuid4()), extra_specs)
@@ -109,7 +111,7 @@
# type id.
extra_specs = {"spec1": "val1"}
self.assertRaises(
- exceptions.NotFound,
+ lib_exc.NotFound,
self.volume_types_client.delete_volume_type_extra_specs,
str(uuid.uuid4()), extra_specs.keys()[0])
@@ -117,7 +119,7 @@
def test_list_nonexistent_volume_type_id(self):
# Should not list volume type extra spec for nonexistent type id.
self.assertRaises(
- exceptions.NotFound,
+ lib_exc.NotFound,
self.volume_types_client.list_volume_types_extra_specs,
str(uuid.uuid4()))
@@ -126,7 +128,7 @@
# Should not get volume type extra spec for nonexistent type id.
extra_specs = {"spec1": "val1"}
self.assertRaises(
- exceptions.NotFound,
+ lib_exc.NotFound,
self.volume_types_client.get_volume_type_extra_specs,
str(uuid.uuid4()), extra_specs.keys()[0])
@@ -135,7 +137,7 @@
# Should not get volume type extra spec for nonexistent extra spec
# id.
self.assertRaises(
- exceptions.NotFound,
+ lib_exc.NotFound,
self.volume_types_client.get_volume_type_extra_specs,
self.volume_type['id'], str(uuid.uuid4()))
diff --git a/tempest/api/volume/admin/test_volume_types_negative.py b/tempest/api/volume/admin/test_volume_types_negative.py
index 4144270..18d54fa 100644
--- a/tempest/api/volume/admin/test_volume_types_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_negative.py
@@ -15,6 +15,8 @@
import uuid
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.volume import base
from tempest import exceptions
from tempest import test
@@ -29,7 +31,7 @@
self.name_field = self.special_fields['name_field']
params = {self.name_field: str(uuid.uuid4()),
'volume_type': str(uuid.uuid4())}
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.volumes_client.create_volume, size=1,
**params)
@@ -42,14 +44,14 @@
@test.attr(type='gate')
def test_get_nonexistent_type_id(self):
# Should not be able to get volume type with nonexistent type id.
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.volume_types_client.get_volume_type,
str(uuid.uuid4()))
@test.attr(type='gate')
def test_delete_nonexistent_type_id(self):
# Should not be able to delete volume type with nonexistent type id.
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.volume_types_client.delete_volume_type,
str(uuid.uuid4()))
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 127a216..a1858de 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest import clients
from tempest.common.utils import data_utils
from tempest import config
@@ -208,13 +210,13 @@
for qos_id in cls.qos_specs:
try:
cls.volume_qos_client.delete_qos(qos_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
# The qos_specs may have already been deleted which is OK.
pass
for qos_id in cls.qos_specs:
try:
cls.volume_qos_client.wait_for_resource_deletion(qos_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
# The qos_specs may have already been deleted which is OK.
pass
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index dc8d8e2..57fcaee 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -15,6 +15,8 @@
import uuid
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import exceptions
@@ -37,13 +39,13 @@
@test.attr(type=['negative', 'gate'])
def test_volume_get_nonexistent_volume_id(self):
# Should not be able to get a non-existent volume
- self.assertRaises(exceptions.NotFound, self.client.get_volume,
+ self.assertRaises(lib_exc.NotFound, self.client.get_volume,
str(uuid.uuid4()))
@test.attr(type=['negative', 'gate'])
def test_volume_delete_nonexistent_volume_id(self):
# Should not be able to delete a non-existent Volume
- self.assertRaises(exceptions.NotFound, self.client.delete_volume,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_volume,
str(uuid.uuid4()))
@test.attr(type=['negative', 'gate'])
@@ -85,7 +87,7 @@
# Should not be able to create volume with non-existent volume type
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.NotFound, self.client.create_volume,
+ self.assertRaises(lib_exc.NotFound, self.client.create_volume,
size='1', volume_type=str(uuid.uuid4()),
display_name=v_name, metadata=metadata)
@@ -94,7 +96,7 @@
# Should not be able to create volume with non-existent snapshot
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.NotFound, self.client.create_volume,
+ self.assertRaises(lib_exc.NotFound, self.client.create_volume,
size='1', snapshot_id=str(uuid.uuid4()),
display_name=v_name, metadata=metadata)
@@ -103,7 +105,7 @@
# Should not be able to create volume with non-existent source volume
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.NotFound, self.client.create_volume,
+ self.assertRaises(lib_exc.NotFound, self.client.create_volume,
size='1', source_volid=str(uuid.uuid4()),
display_name=v_name, metadata=metadata)
@@ -111,7 +113,7 @@
def test_update_volume_with_nonexistent_volume_id(self):
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.NotFound, self.client.update_volume,
+ self.assertRaises(lib_exc.NotFound, self.client.update_volume,
volume_id=str(uuid.uuid4()), display_name=v_name,
metadata=metadata)
@@ -119,7 +121,7 @@
def test_update_volume_with_invalid_volume_id(self):
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.NotFound, self.client.update_volume,
+ self.assertRaises(lib_exc.NotFound, self.client.update_volume,
volume_id='#$%%&^&^', display_name=v_name,
metadata=metadata)
@@ -127,31 +129,31 @@
def test_update_volume_with_empty_volume_id(self):
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.NotFound, self.client.update_volume,
+ self.assertRaises(lib_exc.NotFound, self.client.update_volume,
volume_id='', display_name=v_name,
metadata=metadata)
@test.attr(type=['negative', 'gate'])
def test_get_invalid_volume_id(self):
# Should not be able to get volume with invalid id
- self.assertRaises(exceptions.NotFound, self.client.get_volume,
+ self.assertRaises(lib_exc.NotFound, self.client.get_volume,
'#$%%&^&^')
@test.attr(type=['negative', 'gate'])
def test_get_volume_without_passing_volume_id(self):
# Should not be able to get volume when empty ID is passed
- self.assertRaises(exceptions.NotFound, self.client.get_volume, '')
+ self.assertRaises(lib_exc.NotFound, self.client.get_volume, '')
@test.attr(type=['negative', 'gate'])
def test_delete_invalid_volume_id(self):
# Should not be able to delete volume when invalid ID is passed
- self.assertRaises(exceptions.NotFound, self.client.delete_volume,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_volume,
'!@#$%^&*()')
@test.attr(type=['negative', 'gate'])
def test_delete_volume_without_passing_volume_id(self):
# Should not be able to delete volume when empty ID is passed
- self.assertRaises(exceptions.NotFound, self.client.delete_volume, '')
+ self.assertRaises(lib_exc.NotFound, self.client.delete_volume, '')
@test.attr(type=['negative', 'gate'])
@test.services('compute')
@@ -162,7 +164,7 @@
self.flavor_ref)
self.addCleanup(self.servers_client.delete_server, server['id'])
self.servers_client.wait_for_server_status(server['id'], 'ACTIVE')
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.attach_volume,
str(uuid.uuid4()),
server['id'],
@@ -170,7 +172,7 @@
@test.attr(type=['negative', 'gate'])
def test_detach_volumes_with_invalid_volume_id(self):
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.detach_volume,
'xxx')
@@ -199,25 +201,25 @@
def test_volume_extend_with_nonexistent_volume_id(self):
# Extend volume size when volume is nonexistent.
extend_size = int(self.volume['size']) + 1
- self.assertRaises(exceptions.NotFound, self.client.extend_volume,
+ self.assertRaises(lib_exc.NotFound, self.client.extend_volume,
str(uuid.uuid4()), extend_size)
@test.attr(type=['negative', 'gate'])
def test_volume_extend_without_passing_volume_id(self):
# Extend volume size when passing volume id is None.
extend_size = int(self.volume['size']) + 1
- self.assertRaises(exceptions.NotFound, self.client.extend_volume,
+ self.assertRaises(lib_exc.NotFound, self.client.extend_volume,
None, extend_size)
@test.attr(type=['negative', 'gate'])
def test_reserve_volume_with_nonexistent_volume_id(self):
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.reserve_volume,
str(uuid.uuid4()))
@test.attr(type=['negative', 'gate'])
def test_unreserve_volume_with_nonexistent_volume_id(self):
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.unreserve_volume,
str(uuid.uuid4()))
diff --git a/tempest/api/volume/test_volumes_snapshots_negative.py b/tempest/api/volume/test_volumes_snapshots_negative.py
index 2d7b6de..8b68ea9 100644
--- a/tempest/api/volume/test_volumes_snapshots_negative.py
+++ b/tempest/api/volume/test_volumes_snapshots_negative.py
@@ -12,10 +12,11 @@
import uuid
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -34,7 +35,7 @@
def test_create_snapshot_with_nonexistent_volume_id(self):
# Create a snapshot with nonexistent volume id
s_name = data_utils.rand_name('snap')
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.snapshots_client.create_snapshot,
str(uuid.uuid4()), display_name=s_name)
@@ -42,7 +43,7 @@
def test_create_snapshot_without_passing_volume_id(self):
# Create a snapshot without passing volume id
s_name = data_utils.rand_name('snap')
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.snapshots_client.create_snapshot,
None, display_name=s_name)
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 094f37e..4af2108 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -314,14 +314,14 @@
for u in users:
try:
tenant = admin.identity.get_tenant_by_name(u['tenant'])
- except exceptions.NotFound:
+ except lib_exc.NotFound:
LOG.error("Tenant: %s - not found" % u['tenant'])
continue
try:
admin.identity.get_user_by_username(tenant['id'], u['name'])
LOG.warn("User '%s' already exists in this environment"
% u['name'])
- except exceptions.NotFound:
+ except lib_exc.NotFound:
admin.identity.create_user(
u['name'], u['pass'], tenant['id'],
"%s@%s" % (u['name'], tenant['id']),
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index a663931..5c2fa58 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -13,6 +13,7 @@
# under the License.
import netaddr
+from tempest_lib import exceptions as lib_exc
from tempest import auth
from tempest import clients
@@ -81,7 +82,7 @@
role = next(r for r in roles if r['name'] == role_name)
except StopIteration:
msg = 'No "%s" role found' % role_name
- raise exceptions.NotFound(msg)
+ raise lib_exc.NotFound(msg)
self.identity_admin_client.assign_user_role(tenant['id'], user['id'],
role['id'])
@@ -282,7 +283,7 @@
net_client = self.network_admin_client
try:
net_client.delete_router(router_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
LOG.warn('router with name: %s not found for delete' %
router_name)
@@ -290,7 +291,7 @@
net_client = self.network_admin_client
try:
net_client.delete_subnet(subnet_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
LOG.warn('subnet with name: %s not found for delete' %
subnet_name)
@@ -298,7 +299,7 @@
net_client = self.network_admin_client
try:
net_client.delete_network(network_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
LOG.warn('network with name: %s not found for delete' %
network_name)
@@ -310,7 +311,7 @@
for secgroup in secgroups_to_delete:
try:
net_client.delete_security_group(secgroup['id'])
- except exceptions.NotFound:
+ except lib_exc.NotFound:
LOG.warn('Security group %s, id %s not found for clean-up' %
(secgroup['name'], secgroup['id']))
@@ -326,7 +327,7 @@
try:
net_client.remove_router_interface_with_subnet_id(
router['id'], subnet['id'])
- except exceptions.NotFound:
+ except lib_exc.NotFound:
LOG.warn('router with name: %s not found for delete' %
router['name'])
self._clear_isolated_router(router['id'], router['name'])
@@ -344,12 +345,12 @@
for creds in self.isolated_creds.itervalues():
try:
self._delete_user(creds.user_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
LOG.warn("user with name: %s not found for delete" %
creds.username)
try:
self._delete_tenant(creds.tenant_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
LOG.warn("tenant with name: %s not found for delete" %
creds.tenant_name)
diff --git a/tempest/common/service_client.py b/tempest/common/service_client.py
index cd7265c..e43ced4 100644
--- a/tempest/common/service_client.py
+++ b/tempest/common/service_client.py
@@ -61,8 +61,6 @@
headers=headers, body=body)
except lib_exceptions.Unauthorized as ex:
raise exceptions.Unauthorized(ex)
- except lib_exceptions.NotFound as ex:
- raise exceptions.NotFound(ex)
except lib_exceptions.BadRequest as ex:
raise exceptions.BadRequest(ex)
# TODO(oomichi): This is just a workaround for failing gate tests
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 93e435e..333246c 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -151,10 +151,6 @@
message = "The success code is different than the expected one"
-class NotFound(RestClientException):
- message = "Object not found"
-
-
class Unauthorized(RestClientException):
message = 'Unauthorized'
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 6282923..6b44f64 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -111,7 +111,7 @@
# Tempest clients return dicts, so there is no common delete
# method available. Using a callable instead
delete_thing(*args, **kwargs)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
# If the resource is already missing, mission accomplished.
pass
@@ -1186,7 +1186,7 @@
node = None
try:
node = self.get_node(instance_id=instance_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
return node is not None
diff --git a/tempest/scenario/test_large_ops.py b/tempest/scenario/test_large_ops.py
index 99a2023..ac766ea 100644
--- a/tempest/scenario/test_large_ops.py
+++ b/tempest/scenario/test_large_ops.py
@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-from tempest_lib import exceptions
+from tempest_lib import exceptions as lib_exc
from tempest.common.utils import data_utils
from tempest import config
@@ -54,7 +54,7 @@
function, args, kwargs = cls._cleanup_resources.pop(-1)
try:
function(*args, **kwargs)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
super(TestLargeOpsScenario, cls).resource_cleanup()
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index 9efd55b..e97f089 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -16,6 +16,7 @@
import time
from tempest_lib import decorators
+from tempest_lib import exceptions as lib_exc
import testtools
from tempest.common.utils import data_utils
@@ -85,7 +86,7 @@
try:
while self.snapshots_client.get_snapshot(snapshot['id']):
time.sleep(1)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
self.addCleanup(cleaner)
self._wait_for_volume_status(volume, 'available')
diff --git a/tempest/services/botoclients.py b/tempest/services/botoclients.py
index f581e89..50d0779 100644
--- a/tempest/services/botoclients.py
+++ b/tempest/services/botoclients.py
@@ -15,6 +15,7 @@
import ConfigParser
import contextlib
+from tempest_lib import exceptions as lib_exc
import types
import urlparse
@@ -65,7 +66,7 @@
ec2_cred = keystone.ec2.create(keystone.auth_user_id,
keystone.auth_tenant_id)
if not all((ec2_cred, ec2_cred.access, ec2_cred.secret)):
- raise exceptions.NotFound("Unable to get access and secret keys")
+ raise lib_exc.NotFound("Unable to get access and secret keys")
return ec2_cred
def _config_boto_timeout(self, timeout, retries):
diff --git a/tempest/services/compute/json/aggregates_client.py b/tempest/services/compute/json/aggregates_client.py
index 94ea713..10955fd 100644
--- a/tempest/services/compute/json/aggregates_client.py
+++ b/tempest/services/compute/json/aggregates_client.py
@@ -15,10 +15,11 @@
import json
+from tempest_lib import exceptions as lib_exc
+
from tempest.api_schema.response.compute import aggregates as schema
from tempest.api_schema.response.compute.v2 import aggregates as v2_schema
from tempest.common import service_client
-from tempest import exceptions
class AggregatesClientJSON(service_client.ServiceClient):
@@ -68,7 +69,7 @@
def is_resource_deleted(self, id):
try:
self.get_aggregate(id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
return True
return False
diff --git a/tempest/services/compute/json/floating_ips_client.py b/tempest/services/compute/json/floating_ips_client.py
index 9c586e3..d06386e 100644
--- a/tempest/services/compute/json/floating_ips_client.py
+++ b/tempest/services/compute/json/floating_ips_client.py
@@ -16,9 +16,10 @@
import json
import urllib
+from tempest_lib import exceptions as lib_exc
+
from tempest.api_schema.response.compute.v2 import floating_ips as schema
from tempest.common import service_client
-from tempest import exceptions
class FloatingIPsClientJSON(service_client.ServiceClient):
@@ -40,7 +41,7 @@
resp, body = self.get(url)
body = json.loads(body)
if resp.status == 404:
- raise exceptions.NotFound(body)
+ raise lib_exc.NotFound(body)
self.validate_response(schema.floating_ip, resp, body)
return resp, body['floating_ip']
@@ -92,7 +93,7 @@
def is_resource_deleted(self, id):
try:
self.get_floating_ip_details(id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
return True
return False
diff --git a/tempest/services/compute/json/images_client.py b/tempest/services/compute/json/images_client.py
index a5755da..0ceb6d1 100644
--- a/tempest/services/compute/json/images_client.py
+++ b/tempest/services/compute/json/images_client.py
@@ -16,10 +16,11 @@
import json
import urllib
+from tempest_lib import exceptions as lib_exc
+
from tempest.api_schema.response.compute.v2 import images as schema
from tempest.common import service_client
from tempest.common import waiters
-from tempest import exceptions
class ImagesClientJSON(service_client.ServiceClient):
@@ -131,7 +132,7 @@
def is_resource_deleted(self, id):
try:
self.get_image(id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
return True
return False
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
index 410ad60..5aefa7b 100644
--- a/tempest/services/compute/json/security_groups_client.py
+++ b/tempest/services/compute/json/security_groups_client.py
@@ -16,9 +16,10 @@
import json
import urllib
+from tempest_lib import exceptions as lib_exc
+
from tempest.api_schema.response.compute.v2 import security_groups as schema
from tempest.common import service_client
-from tempest import exceptions
class SecurityGroupsClientJSON(service_client.ServiceClient):
@@ -128,12 +129,12 @@
for sg in body['security_groups']:
if sg['id'] == security_group_id:
return service_client.ResponseBodyList(resp, sg['rules'])
- raise exceptions.NotFound('No such Security Group')
+ raise lib_exc.NotFound('No such Security Group')
def is_resource_deleted(self, id):
try:
self.get_security_group(id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
return True
return False
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index be23b78..fe3d02b 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -18,6 +18,8 @@
import time
import urllib
+from tempest_lib import exceptions as lib_exc
+
from tempest.api_schema.response.compute import servers as common_schema
from tempest.api_schema.response.compute.v2 import servers as schema
from tempest.common import service_client
@@ -183,7 +185,7 @@
while True:
try:
resp, body = self.get_server(server_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
return
server_status = body['status']
diff --git a/tempest/services/compute/json/volumes_extensions_client.py b/tempest/services/compute/json/volumes_extensions_client.py
index 2e3e49c..a9cada8 100644
--- a/tempest/services/compute/json/volumes_extensions_client.py
+++ b/tempest/services/compute/json/volumes_extensions_client.py
@@ -17,6 +17,8 @@
import time
import urllib
+from tempest_lib import exceptions as lib_exc
+
from tempest.api_schema.response.compute.v2 import volumes as schema
from tempest.common import service_client
from tempest import exceptions
@@ -102,7 +104,7 @@
def is_resource_deleted(self, id):
try:
self.get_volume(id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
return True
return False
diff --git a/tempest/services/identity/json/identity_client.py b/tempest/services/identity/json/identity_client.py
index d4f57e0..6fbb3a9 100644
--- a/tempest/services/identity/json/identity_client.py
+++ b/tempest/services/identity/json/identity_client.py
@@ -11,10 +11,10 @@
# under the License.
import json
+from tempest_lib import exceptions as lib_exc
from tempest.common import service_client
from tempest import config
-from tempest import exceptions
CONF = config.CONF
@@ -134,7 +134,7 @@
for tenant in tenants:
if tenant['name'] == tenant_name:
return tenant
- raise exceptions.NotFound('No such tenant')
+ raise lib_exc.NotFound('No such tenant')
def update_tenant(self, tenant_id, **kwargs):
"""Updates a tenant."""
@@ -227,7 +227,7 @@
for user in users:
if user['name'] == username:
return user
- raise exceptions.NotFound('No such user')
+ raise lib_exc.NotFound('No such user')
def create_service(self, name, type, **kwargs):
"""Create a service."""
diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/image_client.py
index a7b8f63..0c05118 100644
--- a/tempest/services/image/v1/json/image_client.py
+++ b/tempest/services/image/v1/json/image_client.py
@@ -20,6 +20,8 @@
import time
import urllib
+from tempest_lib import exceptions as lib_exc
+
from tempest.common import glance_http
from tempest.common import service_client
from tempest.common.utils import misc as misc_utils
@@ -243,7 +245,7 @@
def is_resource_deleted(self, id):
try:
self.get_image_meta(id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
return True
return False
diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/image_client.py
index 4b1d52d..4cddc59 100644
--- a/tempest/services/image/v2/json/image_client.py
+++ b/tempest/services/image/v2/json/image_client.py
@@ -17,11 +17,11 @@
import urllib
import jsonschema
+from tempest_lib import exceptions as lib_exc
from tempest.common import glance_http
from tempest.common import service_client
from tempest import config
-from tempest import exceptions
CONF = config.CONF
@@ -120,7 +120,7 @@
def is_resource_deleted(self, id):
try:
self.get_image(id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
return True
return False
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index e92708c..5106225 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -14,6 +14,8 @@
import time
import urllib
+from tempest_lib import exceptions as lib_exc
+
from tempest.common import service_client
from tempest.common.utils import misc
from tempest import exceptions
@@ -211,7 +213,7 @@
getattr(self, method)(id)
except AttributeError:
raise Exception("Unknown resource type %s " % resource_type)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
return True
return False
diff --git a/tempest/services/orchestration/json/orchestration_client.py b/tempest/services/orchestration/json/orchestration_client.py
index c813977..1a4c5d9 100644
--- a/tempest/services/orchestration/json/orchestration_client.py
+++ b/tempest/services/orchestration/json/orchestration_client.py
@@ -18,6 +18,8 @@
import time
import urllib
+from tempest_lib import exceptions as lib_exc
+
from tempest.common import service_client
from tempest import exceptions
@@ -159,7 +161,7 @@
try:
body = self.get_resource(
stack_identifier, resource_name)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
# ignore this, as the resource may not have
# been created yet
pass
@@ -194,7 +196,7 @@
while True:
try:
body = self.get_stack(stack_identifier)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
if status == 'DELETE_COMPLETE':
return
stack_name = body['stack_name']
diff --git a/tempest/services/volume/json/admin/volume_types_client.py b/tempest/services/volume/json/admin/volume_types_client.py
index 6049eb6..c905155 100644
--- a/tempest/services/volume/json/admin/volume_types_client.py
+++ b/tempest/services/volume/json/admin/volume_types_client.py
@@ -19,7 +19,6 @@
from tempest_lib import exceptions as lib_exc
from tempest.common import service_client
-from tempest import exceptions
class BaseVolumeTypesClientJSON(service_client.ServiceClient):
@@ -42,7 +41,7 @@
else:
msg = (" resource value is either not defined or incorrect.")
raise lib_exc.UnprocessableEntity(msg)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
return True
return False
diff --git a/tempest/services/volume/json/qos_client.py b/tempest/services/volume/json/qos_client.py
index 6aa56f7..14ff506 100644
--- a/tempest/services/volume/json/qos_client.py
+++ b/tempest/services/volume/json/qos_client.py
@@ -27,7 +27,7 @@
def is_resource_deleted(self, qos_id):
try:
self.get_qos(qos_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
return True
return False
diff --git a/tempest/services/volume/json/snapshots_client.py b/tempest/services/volume/json/snapshots_client.py
index 100b34c..8430b63 100644
--- a/tempest/services/volume/json/snapshots_client.py
+++ b/tempest/services/volume/json/snapshots_client.py
@@ -14,6 +14,8 @@
import time
import urllib
+from tempest_lib import exceptions as lib_exc
+
from tempest.common import service_client
from tempest import exceptions
from tempest.openstack.common import log as logging
@@ -127,7 +129,7 @@
def is_resource_deleted(self, id):
try:
self.get_snapshot(id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
return True
return False
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index d834905..b906cec 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -17,6 +17,8 @@
import time
import urllib
+from tempest_lib import exceptions as lib_exc
+
from tempest.common import service_client
from tempest import config
from tempest import exceptions
@@ -181,7 +183,7 @@
def is_resource_deleted(self, id):
try:
self.get_volume(id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
return True
return False