Merge "Split resource_setup for database tests"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 0eeb738..bc4198f 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -779,6 +779,10 @@
# value)
#dns_servers = 8.8.8.8,8.8.4.4
+# vnic_type to use when Launching instances with pre-configured ports.
+# Supported ports are: ['normal','direct','macvtap'] (string value)
+#port_vnic_type = <None>
+
[network-feature-enabled]
diff --git a/requirements.txt b/requirements.txt
index 94c6fb0..ebb23c3 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -11,7 +11,7 @@
netaddr>=0.7.12
python-ceilometerclient>=1.0.6
python-glanceclient>=0.15.0
-python-keystoneclient>=1.0.0
+python-keystoneclient>=1.1.0
python-novaclient>=2.18.0
python-neutronclient>=2.3.6,<3
python-cinderclient>=1.1.0
@@ -25,4 +25,4 @@
iso8601>=0.1.9
fixtures>=0.3.14
testscenarios>=0.4
-tempest-lib>=0.1.0
+tempest-lib>=0.2.0
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 8080eb6..dd19edc 100644
--- a/tempest/api/baremetal/admin/test_ports_negative.py
+++ b/tempest/api/baremetal/admin/test_ports_negative.py
@@ -10,6 +10,8 @@
# 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
@@ -47,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'])
@@ -62,7 +64,7 @@
uuid = data_utils.rand_uuid()
self.create_port(node_id=node_id, address=address, uuid=uuid)
- self.assertRaises(exc.Conflict, self.create_port, node_id=node_id,
+ self.assertRaises(lib_exc.Conflict, self.create_port, node_id=node_id,
address=address, uuid=uuid)
@test.attr(type=['negative', 'smoke'])
@@ -99,7 +101,7 @@
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
self.create_port(node_id=node_id, address=address)
- self.assertRaises(exc.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.create_port, node_id=node_id,
address=address)
@@ -134,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'])
@@ -190,7 +192,7 @@
patch = [{'path': '/address',
'op': 'replace',
'value': address1}]
- self.assertRaises(exc.Conflict,
+ self.assertRaises(lib_exc.Conflict,
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 a450e5d..48f6f94 100644
--- a/tempest/api/compute/admin/test_aggregates_negative.py
+++ b/tempest/api/compute/admin/test_aggregates_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 import base
from tempest.common import tempest_fixtures as fixtures
from tempest.common.utils import data_utils
@@ -43,7 +45,7 @@
def test_aggregate_create_as_user(self):
# Regular user is not allowed to create an aggregate.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.user_client.create_aggregate,
name=aggregate_name)
@@ -69,7 +71,7 @@
aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.client.create_aggregate,
name=aggregate_name)
@@ -80,14 +82,14 @@
aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.user_client.delete_aggregate,
aggregate['id'])
@test.attr(type=['negative', 'gate'])
def test_aggregate_list_as_user(self):
# Regular user is not allowed to list aggregates.
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.user_client.list_aggregates)
@test.attr(type=['negative', 'gate'])
@@ -97,20 +99,20 @@
aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.user_client.get_aggregate,
aggregate['id'])
@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'])
@@ -127,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'])
@@ -137,7 +139,7 @@
aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.user_client.add_host,
aggregate['id'], self.host)
@@ -151,7 +153,7 @@
self.client.add_host(aggregate['id'], self.host)
self.addCleanup(self.client.remove_host, aggregate['id'], self.host)
- self.assertRaises(exceptions.Conflict, self.client.add_host,
+ self.assertRaises(lib_exc.Conflict, self.client.add_host,
aggregate['id'], self.host)
@test.attr(type=['negative', 'gate'])
@@ -164,7 +166,7 @@
self.client.add_host(aggregate['id'], self.host)
self.addCleanup(self.client.remove_host, aggregate['id'], self.host)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.user_client.remove_host,
aggregate['id'], self.host)
@@ -175,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_availability_zone_negative.py b/tempest/api/compute/admin/test_availability_zone_negative.py
index d062b0c..546aa3b 100644
--- a/tempest/api/compute/admin/test_availability_zone_negative.py
+++ b/tempest/api/compute/admin/test_availability_zone_negative.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.api.compute import base
-from tempest import exceptions
from tempest import test
@@ -33,5 +34,5 @@
# List of availability zones and available services with
# non-administrator user
self.assertRaises(
- exceptions.Unauthorized,
+ lib_exc.Unauthorized,
self.non_adm_client.get_availability_zone_list_detail)
diff --git a/tempest/api/compute/admin/test_fixed_ips_negative.py b/tempest/api/compute/admin/test_fixed_ips_negative.py
index e7022db..bb5fa8c 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
@@ -43,14 +45,14 @@
@test.attr(type=['negative', 'gate'])
@test.services('network')
def test_list_fixed_ip_details_with_non_admin_user(self):
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.get_fixed_ip_details, self.ip)
@test.attr(type=['negative', 'gate'])
@test.services('network')
def test_set_reserve_with_non_admin_user(self):
body = {"reserve": "None"}
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.reserve_fixed_ip,
self.ip, body)
@@ -58,7 +60,7 @@
@test.services('network')
def test_set_unreserve_with_non_admin_user(self):
body = {"unreserve": "None"}
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.reserve_fixed_ip,
self.ip, body)
@@ -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 4ba9eb2..5031432 100644
--- a/tempest/api/compute/admin/test_flavors_access_negative.py
+++ b/tempest/api/compute/admin/test_flavors_access_negative.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 uuid
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -53,7 +53,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)
@@ -68,7 +68,7 @@
new_flavor_id,
is_public='False')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.flavors_client.add_flavor_access,
new_flavor['id'],
self.tenant_id)
@@ -88,7 +88,7 @@
self.client.add_flavor_access(new_flavor['id'], self.tenant_id)
self.addCleanup(self.client.remove_flavor_access,
new_flavor['id'], self.tenant_id)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.flavors_client.remove_flavor_access,
new_flavor['id'],
self.tenant_id)
@@ -112,7 +112,7 @@
# An exception should be raised when adding flavor access to the same
# tenant
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.client.add_flavor_access,
new_flavor['id'],
self.tenant_id)
@@ -130,7 +130,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..e414973 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
@@ -61,7 +63,7 @@
def test_flavor_non_admin_set_keys(self):
# Test to SET flavor extra spec as a user without admin privileges.
specs = {"key1": "value1", "key2": "value2"}
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.flavors_client.set_flavor_extra_spec,
self.flavor['id'],
specs)
@@ -73,7 +75,7 @@
body = self.client.set_flavor_extra_spec(
self.flavor['id'], specs)
self.assertEqual(body['key1'], 'value1')
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.flavors_client.
update_flavor_extra_spec,
self.flavor['id'],
@@ -85,7 +87,7 @@
specs = {"key1": "value1", "key2": "value2"}
self.client.set_flavor_extra_spec(self.flavor['id'], specs)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.flavors_client.unset_flavor_extra_spec,
self.flavor['id'],
'key1')
@@ -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_flavors_negative.py b/tempest/api/compute/admin/test_flavors_negative.py
index 86125fb..d1060c5 100644
--- a/tempest/api/compute/admin/test_flavors_negative.py
+++ b/tempest/api/compute/admin/test_flavors_negative.py
@@ -15,11 +15,12 @@
import uuid
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest.api_schema.request.compute.v2 import flavors
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
@@ -88,7 +89,7 @@
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = str(uuid.uuid4())
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.user_client.create_flavor,
flavor_name, self.ram, self.vcpus, self.disk,
new_flavor_id, ephemeral=self.ephemeral,
@@ -97,7 +98,7 @@
@test.attr(type=['negative', 'gate'])
def test_delete_flavor_as_user(self):
# only admin user can delete a flavor
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.user_client.delete_flavor,
self.flavor_ref_alt)
@@ -105,6 +106,5 @@
@test.SimpleNegativeAutoTest
class FlavorCreateNegativeTestJSON(base.BaseV2ComputeAdminTest,
test.NegativeAutoTest):
- _interface = 'json'
_service = CONF.compute.catalog_type
_schema = flavors.flavor_create
diff --git a/tempest/api/compute/admin/test_hosts_negative.py b/tempest/api/compute/admin/test_hosts_negative.py
index fc918a3..20429b1 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
@@ -38,20 +40,20 @@
@test.attr(type=['negative', 'gate'])
def test_list_hosts_with_non_admin_user(self):
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.list_hosts)
@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'])
def test_show_host_detail_with_non_admin_user(self):
hostname = self._get_host_name()
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.show_host_detail,
hostname)
@@ -59,7 +61,7 @@
def test_update_host_with_non_admin_user(self):
hostname = self._get_host_name()
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.update_host,
hostname,
status='enable',
@@ -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)
@@ -130,7 +132,7 @@
def test_startup_host_with_non_admin_user(self):
hostname = self._get_host_name()
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.startup_host,
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)
@@ -146,7 +148,7 @@
def test_shutdown_host_with_non_admin_user(self):
hostname = self._get_host_name()
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.shutdown_host,
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)
@@ -162,6 +164,6 @@
def test_reboot_host_with_non_admin_user(self):
hostname = self._get_host_name()
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.reboot_host,
hostname)
diff --git a/tempest/api/compute/admin/test_hypervisor_negative.py b/tempest/api/compute/admin/test_hypervisor_negative.py
index a137a61..a9c1cb1 100644
--- a/tempest/api/compute/admin/test_hypervisor_negative.py
+++ b/tempest/api/compute/admin/test_hypervisor_negative.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 uuid
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -43,7 +43,7 @@
nonexistent_hypervisor_id = str(uuid.uuid4())
self.assertRaises(
- exceptions.NotFound,
+ lib_exc.NotFound,
self.client.get_hypervisor_show_details,
nonexistent_hypervisor_id)
@@ -53,7 +53,7 @@
self.assertTrue(len(hypers) > 0)
self.assertRaises(
- exceptions.Unauthorized,
+ lib_exc.Unauthorized,
self.non_adm_client.get_hypervisor_show_details,
hypers[0]['id'])
@@ -63,7 +63,7 @@
self.assertTrue(len(hypers) > 0)
self.assertRaises(
- exceptions.Unauthorized,
+ lib_exc.Unauthorized,
self.non_adm_client.get_hypervisor_servers,
hypers[0]['id'])
@@ -72,14 +72,14 @@
nonexistent_hypervisor_id = str(uuid.uuid4())
self.assertRaises(
- exceptions.NotFound,
+ lib_exc.NotFound,
self.client.get_hypervisor_servers,
nonexistent_hypervisor_id)
@test.attr(type=['negative', 'gate'])
def test_get_hypervisor_stats_with_non_admin_user(self):
self.assertRaises(
- exceptions.Unauthorized,
+ lib_exc.Unauthorized,
self.non_adm_client.get_hypervisor_stats)
@test.attr(type=['negative', 'gate'])
@@ -87,7 +87,7 @@
nonexistent_hypervisor_id = str(uuid.uuid4())
self.assertRaises(
- exceptions.NotFound,
+ lib_exc.NotFound,
self.client.get_hypervisor_uptime,
nonexistent_hypervisor_id)
@@ -97,7 +97,7 @@
self.assertTrue(len(hypers) > 0)
self.assertRaises(
- exceptions.Unauthorized,
+ lib_exc.Unauthorized,
self.non_adm_client.get_hypervisor_uptime,
hypers[0]['id'])
@@ -105,14 +105,14 @@
def test_get_hypervisor_list_with_non_admin_user(self):
# List of hypervisor and available services with non admin user
self.assertRaises(
- exceptions.Unauthorized,
+ lib_exc.Unauthorized,
self.non_adm_client.get_hypervisor_list)
@test.attr(type=['negative', 'gate'])
def test_get_hypervisor_list_details_with_non_admin_user(self):
# List of hypervisor details and available services with non admin user
self.assertRaises(
- exceptions.Unauthorized,
+ lib_exc.Unauthorized,
self.non_adm_client.get_hypervisor_list_details)
@test.attr(type=['negative', 'gate'])
@@ -120,7 +120,7 @@
nonexistent_hypervisor_name = data_utils.rand_name('test_hypervisor')
self.assertRaises(
- exceptions.NotFound,
+ lib_exc.NotFound,
self.client.search_hypervisor,
nonexistent_hypervisor_name)
@@ -130,6 +130,6 @@
self.assertTrue(len(hypers) > 0)
self.assertRaises(
- exceptions.Unauthorized,
+ lib_exc.Unauthorized,
self.non_adm_client.search_hypervisor,
hypers[0]['hypervisor_hostname'])
diff --git a/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py b/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py
index c4905d9..1e03bd0 100644
--- a/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py
+++ b/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py
@@ -16,6 +16,8 @@
import datetime
import urllib
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute import base
from tempest import exceptions
from tempest import test
@@ -31,11 +33,11 @@
@test.attr(type=['negative', 'gate'])
def test_instance_usage_audit_logs_with_nonadmin_user(self):
# the instance_usage_audit_logs API just can be accessed by admin user
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.instance_usages_audit_log_client.
list_instance_usage_audit_logs)
now = datetime.datetime.now()
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.instance_usages_audit_log_client.
get_instance_usage_audit_log,
urllib.quote(now.strftime("%Y-%m-%d %H:%M:%S")))
diff --git a/tempest/api/compute/admin/test_quotas_negative.py b/tempest/api/compute/admin/test_quotas_negative.py
index 7cefe90..2fb7be6 100644
--- a/tempest/api/compute/admin/test_quotas_negative.py
+++ b/tempest/api/compute/admin/test_quotas_negative.py
@@ -13,11 +13,11 @@
# under the License.
from tempest_lib import decorators
+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
@@ -39,7 +39,7 @@
@test.attr(type=['negative', 'gate'])
def test_update_quota_normal_user(self):
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.client.update_quota_set,
self.demo_tenant_id,
ram=0)
@@ -59,7 +59,7 @@
self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
cores=default_vcpu_quota)
- self.assertRaises((exceptions.Unauthorized, exceptions.OverLimit),
+ self.assertRaises((lib_exc.Unauthorized, lib_exc.OverLimit),
self.create_test_server)
@test.attr(type=['negative', 'gate'])
@@ -75,7 +75,7 @@
self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
ram=default_mem_quota)
- self.assertRaises((exceptions.Unauthorized, exceptions.OverLimit),
+ self.assertRaises((lib_exc.Unauthorized, lib_exc.OverLimit),
self.create_test_server)
@test.attr(type=['negative', 'gate'])
@@ -90,7 +90,7 @@
instances=instances_quota)
self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
instances=default_instances_quota)
- self.assertRaises((exceptions.Unauthorized, exceptions.OverLimit),
+ self.assertRaises((lib_exc.Unauthorized, lib_exc.OverLimit),
self.create_test_server)
@decorators.skip_because(bug="1186354",
@@ -116,7 +116,7 @@
# Check we cannot create anymore
# A 403 Forbidden or 413 Overlimit (old behaviour) exception
# will be raised when out of quota
- self.assertRaises((exceptions.Unauthorized, exceptions.OverLimit),
+ self.assertRaises((lib_exc.Unauthorized, lib_exc.OverLimit),
self.sg_client.create_security_group,
"sg-overlimit", "sg-desc")
@@ -155,6 +155,6 @@
# Check we cannot create SG rule anymore
# A 403 Forbidden or 413 Overlimit (old behaviour) exception
# will be raised when out of quota
- self.assertRaises((exceptions.OverLimit, exceptions.Unauthorized),
+ self.assertRaises((lib_exc.OverLimit, lib_exc.Unauthorized),
self.sg_client.create_security_group_rule,
secgroup_id, ip_protocol, 1025, 1025)
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 0dddc76..0d4731d 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -14,6 +14,7 @@
import uuid
+from tempest_lib import exceptions as lib_exc
import testtools
from tempest.api.compute import base
@@ -50,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
@@ -71,7 +72,7 @@
ram, vcpus, disk,
flavor_id)
self.addCleanup(self.flavors_client.delete_flavor, flavor_id)
- self.assertRaises((exceptions.Unauthorized, exceptions.OverLimit),
+ self.assertRaises((lib_exc.Unauthorized, lib_exc.OverLimit),
self.client.resize,
self.servers[0]['id'],
flavor_ref['id'])
@@ -92,7 +93,7 @@
ram, vcpus, disk,
flavor_id)
self.addCleanup(self.flavors_client.delete_flavor, flavor_id)
- self.assertRaises((exceptions.Unauthorized, exceptions.OverLimit),
+ self.assertRaises((lib_exc.Unauthorized, lib_exc.OverLimit),
self.client.resize,
self.servers[0]['id'],
flavor_ref['id'])
@@ -111,20 +112,20 @@
@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'])
def test_get_server_diagnostics_by_non_admin(self):
# Non-admin user can not view server diagnostics according to policy
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_adm_client.get_server_diagnostics,
self.s1_id)
@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()))
@@ -143,6 +144,6 @@
self.assertEqual(202, resp.status)
self.client.wait_for_server_status(server_id, 'SUSPENDED')
# migrate an suspended server should fail
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.client.migrate_server,
server_id)
diff --git a/tempest/api/compute/admin/test_services_negative.py b/tempest/api/compute/admin/test_services_negative.py
index bb19a39..39d0ee1 100644
--- a/tempest/api/compute/admin/test_services_negative.py
+++ b/tempest/api/compute/admin/test_services_negative.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.api.compute import base
-from tempest import exceptions
from tempest import test
@@ -31,7 +32,7 @@
@test.attr(type=['negative', 'gate'])
def test_list_services_with_non_admin_user(self):
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.list_services)
@test.attr(type=['negative', 'gate'])
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..b371f2d 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)
@@ -61,5 +62,5 @@
params = {'start': self.start,
'end': self.end,
'detailed': int(bool(True))}
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.client.list_tenant_usages, params)
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 3e80bf2..808f78c 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)
@@ -328,20 +329,17 @@
class BaseV2ComputeTest(BaseComputeTest):
_api_version = 2
- _interface = "json"
class BaseComputeAdminTest(BaseComputeTest):
"""Base test case class for Compute Admin API tests."""
- _interface = "json"
@classmethod
def resource_setup(cls):
super(BaseComputeAdminTest, cls).resource_setup()
try:
creds = cls.isolated_creds.get_admin_creds()
- cls.os_adm = clients.Manager(
- credentials=creds, interface=cls._interface)
+ cls.os_adm = clients.Manager(credentials=creds)
except NotImplementedError:
msg = ("Missing Compute Admin API credentials in configuration.")
raise cls.skipException(msg)
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 e6f4fb0..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,8 +135,8 @@
self.new_server_id)
# Make sure no longer associated with old server
- self.assertRaises((exceptions.NotFound,
+ self.assertRaises((lib_exc.NotFound,
lib_exc.UnprocessableEntity,
- exceptions.Conflict),
+ lib_exc.Conflict),
self.client.disassociate_floating_ip_from_server,
self.floating_ip, self.server_id)
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 46cec9b..63f5b9e 100644
--- a/tempest/api/compute/images/test_images_oneserver_negative.py
+++ b/tempest/api/compute/images/test_images_oneserver_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 config
@@ -102,7 +104,7 @@
# Create second snapshot
alt_snapshot_name = data_utils.rand_name('test-snap-')
- self.assertRaises(exceptions.Conflict, self.client.create_image,
+ self.assertRaises(lib_exc.Conflict, self.client.create_image,
self.server_id, alt_snapshot_name)
@test.attr(type=['negative', 'gate'])
@@ -127,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.py b/tempest/api/compute/images/test_list_image_filters.py
index 742c2dd..3f37a16 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -172,8 +172,6 @@
# Verify only the expected number of results are returned
params = {'limit': '1'}
images = self.client.list_images(params)
- # when _interface='xml', one element for images_links in images
- # ref: Question #224349
self.assertEqual(1, len([x for x in images if 'id' in x]))
@test.attr(type='gate')
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 4e06d6c..1586405 100644
--- a/tempest/api/compute/keypairs/test_keypairs_negative.py
+++ b/tempest/api/compute/keypairs/test_keypairs_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
@@ -43,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'])
@@ -68,7 +70,7 @@
k_name = data_utils.rand_name('keypair-')
self.client.create_keypair(k_name)
# Now try the same keyname to create another key
- self.assertRaises(exceptions.Conflict, self._create_keypair,
+ self.assertRaises(lib_exc.Conflict, self._create_keypair,
k_name)
self.client.delete_keypair(k_name)
diff --git a/tempest/api/compute/limits/test_absolute_limits_negative.py b/tempest/api/compute/limits/test_absolute_limits_negative.py
index d537d83..9776db3 100644
--- a/tempest/api/compute/limits/test_absolute_limits_negative.py
+++ b/tempest/api/compute/limits/test_absolute_limits_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 import tempest_fixtures as fixtures
-from tempest import exceptions
from tempest import test
@@ -51,5 +52,5 @@
# A 403 Forbidden or 413 Overlimit (old behaviour) exception
# will be raised when out of quota
- self.assertRaises((exceptions.Unauthorized, exceptions.OverLimit),
+ self.assertRaises((lib_exc.Unauthorized, lib_exc.OverLimit),
self.create_test_server, meta=meta_data)
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_list_servers_negative.py b/tempest/api/compute/servers/test_list_servers_negative.py
index fd66d2b..4655f7f 100644
--- a/tempest/api/compute/servers/test_list_servers_negative.py
+++ b/tempest/api/compute/servers/test_list_servers_negative.py
@@ -101,7 +101,6 @@
# List servers by specifying limits
resp, body = self.client.list_servers({'limit': 1})
self.assertEqual('200', resp['status'])
- # when _interface='xml', one element for servers_links in servers
self.assertEqual(1, len([x for x in body['servers'] if 'id' in x]))
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 9edaede..f948a3a 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -18,13 +18,13 @@
import urlparse
from tempest_lib import decorators
+from tempest_lib import exceptions as lib_exc
import testtools
from tempest.api.compute import base
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
@@ -262,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 "
@@ -464,7 +464,7 @@
self.assertEqual(200, resp.status)
self.assertEqual(server['status'], 'ACTIVE')
# Locked server is not allowed to be stopped by non-admin user
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.servers_client.stop, self.server_id)
resp, server = self.servers_client.unlock_server(self.server_id)
self.assertEqual(202, resp.status)
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 e193677..7fe95dd 100644
--- a/tempest/api/compute/servers/test_server_metadata_negative.py
+++ b/tempest/api/compute/servers/test_server_metadata_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 import base
from tempest.common.utils import data_utils
from tempest import exceptions
@@ -40,7 +42,7 @@
for sz in [256, 257, 511, 1023]:
key = "k" * sz
meta = {key: 'data1'}
- self.assertRaises((exceptions.BadRequest, exceptions.OverLimit),
+ self.assertRaises((exceptions.BadRequest, lib_exc.OverLimit),
self.create_test_server,
meta=meta)
@@ -58,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')
@@ -67,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)
@@ -85,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)
@@ -95,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)
@@ -112,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')
@@ -130,14 +132,14 @@
req_metadata = {}
for num in range(1, quota_metadata + 2):
req_metadata['key' + str(num)] = 'val' + str(num)
- self.assertRaises((exceptions.OverLimit, exceptions.Unauthorized),
+ self.assertRaises((lib_exc.OverLimit, lib_exc.Unauthorized),
self.client.set_server_metadata,
self.server_id, req_metadata)
# A 403 Forbidden or 413 Overlimit (old behaviour) exception
# will be raised while exceeding metadata items limit for
# tenant.
- self.assertRaises((exceptions.Unauthorized, exceptions.OverLimit),
+ self.assertRaises((lib_exc.Unauthorized, lib_exc.OverLimit),
self.client.update_server_metadata,
self.server_id, req_metadata)
diff --git a/tempest/api/compute/servers/test_server_personality.py b/tempest/api/compute/servers/test_server_personality.py
index c6d48bc..bd3ebb0 100644
--- a/tempest/api/compute/servers/test_server_personality.py
+++ b/tempest/api/compute/servers/test_server_personality.py
@@ -14,9 +14,9 @@
# under the License.
import base64
+from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
-from tempest import exceptions
from tempest import test
@@ -44,7 +44,7 @@
'contents': base64.b64encode(file_contents)})
# A 403 Forbidden or 413 Overlimit (old behaviour) exception
# will be raised when out of quota
- self.assertRaises((exceptions.Unauthorized, exceptions.OverLimit),
+ self.assertRaises((lib_exc.Unauthorized, lib_exc.OverLimit),
self.create_test_server, personality=personality)
@test.attr(type='gate')
diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py
index c01a95c..6780455 100644
--- a/tempest/api/compute/servers/test_server_rescue_negative.py
+++ b/tempest/api/compute/servers/test_server_rescue_negative.py
@@ -12,12 +12,13 @@
# 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 as lib_exc
import testtools
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
@@ -81,26 +82,26 @@
self.addCleanup(self._unpause, self.server_id)
self.assertEqual(202, resp.status)
self.servers_client.wait_for_server_status(self.server_id, 'PAUSED')
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.servers_client.rescue_server,
self.server_id)
@test.attr(type=['negative', 'gate'])
def test_rescued_vm_reboot(self):
- self.assertRaises(exceptions.Conflict, self.servers_client.reboot,
+ self.assertRaises(lib_exc.Conflict, self.servers_client.reboot,
self.rescue_id, 'HARD')
@test.attr(type=['negative', 'gate'])
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)
@test.attr(type=['negative', 'gate'])
def test_rescued_vm_rebuild(self):
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.servers_client.rebuild,
self.rescue_id,
self.image_ref_alt)
@@ -117,7 +118,7 @@
self.addCleanup(self._unrescue, self.server_id)
# Attach the volume to the server
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.servers_client.attach_volume,
self.server_id,
volume['id'],
@@ -144,7 +145,7 @@
self.addCleanup(self._unrescue, self.server_id)
# Detach the volume from the server expecting failure
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.servers_client.detach_volume,
self.server_id,
volume['id'])
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index b703cfe..845a71e 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -15,6 +15,7 @@
import sys
+from tempest_lib import exceptions as lib_exc
import testtools
from tempest.api.compute import base
@@ -108,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)
@@ -133,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,
@@ -143,7 +144,7 @@
# Pause a paused server.
self.client.pause_server(self.server_id)
self.client.wait_for_server_status(self.server_id, 'PAUSED')
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.client.pause_server,
self.server_id)
self.client.unpause_server(self.server_id)
@@ -155,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)
@@ -210,7 +211,7 @@
# Pass really long metadata while creating a server
metadata = {'a': 'b' * 260}
- self.assertRaises((exceptions.BadRequest, exceptions.OverLimit),
+ self.assertRaises((exceptions.BadRequest, lib_exc.OverLimit),
self.create_test_server,
meta=metadata)
@@ -221,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'])
@@ -239,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)
@@ -258,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)
@@ -272,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'])
@@ -294,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,
@@ -310,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,
@@ -319,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,
@@ -327,7 +328,7 @@
@test.attr(type=['negative', 'gate'])
def test_unpause_server_invalid_state(self):
# unpause an active server.
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.client.unpause_server,
self.server_id)
@@ -337,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,
@@ -348,7 +349,7 @@
resp, _ = self.client.suspend_server(self.server_id)
self.assertEqual(202, resp.status)
self.client.wait_for_server_status(self.server_id, 'SUSPENDED')
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.client.suspend_server,
self.server_id)
self.client.resume_server(self.server_id)
@@ -359,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,
@@ -367,7 +368,7 @@
@test.attr(type=['negative', 'gate'])
def test_resume_server_invalid_state(self):
# resume an active server.
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.client.resume_server,
self.server_id)
@@ -375,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)
@@ -383,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)
@@ -391,14 +392,14 @@
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)
@test.attr(type=['negative', 'gate'])
def test_restore_server_invalid_state(self):
# we can only restore-delete a server in 'soft-delete' state
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.client.restore_soft_deleted_server,
self.server_id)
@@ -408,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,
@@ -435,7 +436,7 @@
self.assertEqual(1, len(images))
self.assertEqual(image_name, images[0]['name'])
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.client.shelve_server,
self.server_id)
@@ -447,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,
@@ -455,6 +456,6 @@
@test.attr(type=['negative', 'gate'])
def test_unshelve_server_invalid_state(self):
# unshelve an active server.
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.client.unshelve_server,
self.server_id)
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_get.py b/tempest/api/compute/volumes/test_volumes_get.py
index 53f5ac0..69998d2 100644
--- a/tempest/api/compute/volumes/test_volumes_get.py
+++ b/tempest/api/compute/volumes/test_volumes_get.py
@@ -38,7 +38,7 @@
def test_volume_create_get_delete(self):
# CREATE, GET, DELETE Volume
volume = None
- v_name = data_utils.rand_name('Volume-%s-') % self._interface
+ v_name = data_utils.rand_name('Volume')
metadata = {'Type': 'work'}
# Create volume
volume = self.client.create_volume(size=1,
diff --git a/tempest/api/compute/volumes/test_volumes_list.py b/tempest/api/compute/volumes/test_volumes_list.py
index c0ac99b..ba7ee6b 100644
--- a/tempest/api/compute/volumes/test_volumes_list.py
+++ b/tempest/api/compute/volumes/test_volumes_list.py
@@ -42,7 +42,7 @@
cls.volume_list = []
cls.volume_id_list = []
for i in range(3):
- v_name = data_utils.rand_name('volume-%s' % cls._interface)
+ v_name = data_utils.rand_name('volume')
metadata = {'Type': 'work'}
try:
volume = cls.client.create_volume(size=1,
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..5992921 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
@@ -21,16 +22,26 @@
class BaseDataProcessingTest(tempest.test.BaseTestCase):
- _interface = 'json'
+
+ @classmethod
+ def skip_checks(cls):
+ super(BaseDataProcessingTest, cls).skip_checks()
+ if not CONF.service_available.sahara:
+ raise cls.skipException('Sahara support is required')
+
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseDataProcessingTest, cls).setup_credentials()
+ cls.os = cls.get_client_manager()
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseDataProcessingTest, cls).setup_clients()
+ cls.client = cls.os.data_processing_client
@classmethod
def resource_setup(cls):
super(BaseDataProcessingTest, cls).resource_setup()
- if not CONF.service_available.sahara:
- raise cls.skipException('Sahara support is required')
-
- cls.os = cls.get_client_manager()
- cls.client = cls.os.data_processing_client
cls.flavor_ref = CONF.compute.flavor_ref
@@ -63,7 +74,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/base.py b/tempest/api/database/base.py
index e67df24..31c5d2a 100644
--- a/tempest/api/database/base.py
+++ b/tempest/api/database/base.py
@@ -24,8 +24,6 @@
class BaseDatabaseTest(tempest.test.BaseTestCase):
"""Base test case class for all Database API tests."""
- _interface = 'json'
-
@classmethod
def skip_checks(cls):
super(BaseDatabaseTest, cls).skip_checks()
diff --git a/tempest/api/database/flavors/test_flavors_negative.py b/tempest/api/database/flavors/test_flavors_negative.py
index f8c7b83..bb9c05d 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/database/limits/test_limits.py b/tempest/api/database/limits/test_limits.py
index 30d0a77..68a3884 100644
--- a/tempest/api/database/limits/test_limits.py
+++ b/tempest/api/database/limits/test_limits.py
@@ -18,7 +18,6 @@
class DatabaseLimitsTest(base.BaseDatabaseTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/database/versions/test_versions.py b/tempest/api/database/versions/test_versions.py
index 26d5cb2..37a7407 100644
--- a/tempest/api/database/versions/test_versions.py
+++ b/tempest/api/database/versions/test_versions.py
@@ -18,7 +18,6 @@
class DatabaseVersionsTest(base.BaseDatabaseTest):
- _interface = 'json'
@classmethod
def setup_clients(cls):
diff --git a/tempest/api/identity/admin/test_roles.py b/tempest/api/identity/admin/test_roles.py
index c6c7dc3..80ad6db 100644
--- a/tempest/api/identity/admin/test_roles.py
+++ b/tempest/api/identity/admin/test_roles.py
@@ -21,7 +21,6 @@
class RolesTestJSON(base.BaseIdentityV2AdminTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/identity/admin/test_roles_negative.py b/tempest/api/identity/admin/test_roles_negative.py
index 58f726a..2c51715 100644
--- a/tempest/api/identity/admin/test_roles_negative.py
+++ b/tempest/api/identity/admin/test_roles_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.identity import base
@@ -22,7 +23,6 @@
class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
- _interface = 'json'
def _get_role_params(self):
self.data.setup_test_user()
@@ -35,7 +35,7 @@
@test.attr(type=['negative', 'gate'])
def test_list_roles_by_unauthorized_user(self):
# Non-administrator user should not be able to list roles
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.list_roles)
@test.attr(type=['negative', 'gate'])
@@ -43,7 +43,7 @@
# Request to list roles without a valid token should fail
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
- self.assertRaises(exceptions.Unauthorized, self.client.list_roles)
+ self.assertRaises(lib_exc.Unauthorized, self.client.list_roles)
self.client.auth_provider.clear_auth()
@test.attr(type=['negative', 'gate'])
@@ -55,7 +55,7 @@
def test_create_role_by_unauthorized_user(self):
# Non-administrator user should not be able to create role
role_name = data_utils.rand_name(name='role-')
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.create_role, role_name)
@test.attr(type=['negative', 'gate'])
@@ -64,7 +64,7 @@
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
role_name = data_utils.rand_name(name='role-')
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.client.create_role, role_name)
self.client.auth_provider.clear_auth()
@@ -75,7 +75,7 @@
body = self.client.create_role(role_name)
role1_id = body.get('id')
self.addCleanup(self.client.delete_role, role1_id)
- self.assertRaises(exceptions.Conflict, self.client.create_role,
+ self.assertRaises(lib_exc.Conflict, self.client.create_role,
role_name)
@test.attr(type=['negative', 'gate'])
@@ -85,7 +85,7 @@
body = self.client.create_role(role_name)
self.data.roles.append(body)
role_id = body.get('id')
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.delete_role, role_id)
@test.attr(type=['negative', 'gate'])
@@ -97,7 +97,7 @@
role_id = body.get('id')
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.client.delete_role,
role_id)
self.client.auth_provider.clear_auth()
@@ -106,7 +106,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'])
@@ -114,7 +114,7 @@
# Non-administrator user should not be authorized to
# assign a role to user
(user, tenant, role) = self._get_role_params()
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.assign_user_role,
tenant['id'], user['id'], role['id'])
@@ -124,7 +124,7 @@
(user, tenant, role) = self._get_role_params()
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.client.assign_user_role, tenant['id'],
user['id'], role['id'])
self.client.auth_provider.clear_auth()
@@ -134,7 +134,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'])
@@ -142,7 +142,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'])
@@ -150,7 +150,7 @@
# Duplicate user role should not get assigned
(user, tenant, role) = self._get_role_params()
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
- self.assertRaises(exceptions.Conflict, self.client.assign_user_role,
+ self.assertRaises(lib_exc.Conflict, self.client.assign_user_role,
tenant['id'], user['id'], role['id'])
@test.attr(type=['negative', 'gate'])
@@ -161,7 +161,7 @@
self.client.assign_user_role(tenant['id'],
user['id'],
role['id'])
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.remove_user_role,
tenant['id'], user['id'], role['id'])
@@ -174,7 +174,7 @@
role['id'])
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.client.remove_user_role, tenant['id'],
user['id'], role['id'])
self.client.auth_provider.clear_auth()
@@ -187,7 +187,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'])
@@ -198,7 +198,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'])
@@ -207,7 +207,7 @@
# a user's roles
(user, tenant, role) = self._get_role_params()
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.list_user_roles, tenant['id'],
user['id'])
@@ -218,7 +218,7 @@
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
try:
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.client.list_user_roles, tenant['id'],
user['id'])
finally:
diff --git a/tempest/api/identity/admin/test_services.py b/tempest/api/identity/admin/test_services.py
index 03d6e35..af38afc 100644
--- a/tempest/api/identity/admin/test_services.py
+++ b/tempest/api/identity/admin/test_services.py
@@ -14,21 +14,20 @@
# 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
class ServicesTestJSON(base.BaseIdentityV2AdminTest):
- _interface = 'json'
def _del_service(self, service_id):
# 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 75f0152..16ea96a 100644
--- a/tempest/api/identity/admin/test_tenant_negative.py
+++ b/tempest/api/identity/admin/test_tenant_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.identity import base
@@ -22,12 +23,11 @@
class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest):
- _interface = 'json'
@test.attr(type=['negative', 'gate'])
def test_list_tenants_by_unauthorized_user(self):
# Non-administrator user should not be able to list tenants
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.list_tenants)
@test.attr(type=['negative', 'gate'])
@@ -35,7 +35,7 @@
# Request to list tenants without a valid token should fail
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
- self.assertRaises(exceptions.Unauthorized, self.client.list_tenants)
+ self.assertRaises(lib_exc.Unauthorized, self.client.list_tenants)
self.client.auth_provider.clear_auth()
@test.attr(type=['negative', 'gate'])
@@ -44,7 +44,7 @@
tenant_name = data_utils.rand_name(name='tenant-')
tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.delete_tenant, tenant['id'])
@test.attr(type=['negative', 'gate'])
@@ -55,14 +55,14 @@
self.data.tenants.append(tenant)
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
- self.assertRaises(exceptions.Unauthorized, self.client.delete_tenant,
+ self.assertRaises(lib_exc.Unauthorized, self.client.delete_tenant,
tenant['id'])
self.client.auth_provider.clear_auth()
@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'])
@@ -76,14 +76,14 @@
self.addCleanup(self.client.delete_tenant, tenant1_id)
self.addCleanup(self.data.tenants.remove, tenant)
- self.assertRaises(exceptions.Conflict, self.client.create_tenant,
+ self.assertRaises(lib_exc.Conflict, self.client.create_tenant,
tenant_name)
@test.attr(type=['negative', 'gate'])
def test_create_tenant_by_unauthorized_user(self):
# Non-administrator user should not be authorized to create a tenant
tenant_name = data_utils.rand_name(name='tenant-')
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.create_tenant, tenant_name)
@test.attr(type=['negative', 'gate'])
@@ -92,7 +92,7 @@
tenant_name = data_utils.rand_name(name='tenant-')
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
- self.assertRaises(exceptions.Unauthorized, self.client.create_tenant,
+ self.assertRaises(lib_exc.Unauthorized, self.client.create_tenant,
tenant_name)
self.client.auth_provider.clear_auth()
@@ -112,7 +112,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'])
@@ -121,7 +121,7 @@
tenant_name = data_utils.rand_name(name='tenant-')
tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.update_tenant, tenant['id'])
@test.attr(type=['negative', 'gate'])
@@ -132,6 +132,6 @@
self.data.tenants.append(tenant)
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
- self.assertRaises(exceptions.Unauthorized, self.client.update_tenant,
+ self.assertRaises(lib_exc.Unauthorized, self.client.update_tenant,
tenant['id'])
self.client.auth_provider.clear_auth()
diff --git a/tempest/api/identity/admin/test_tenants.py b/tempest/api/identity/admin/test_tenants.py
index 549e952..cfae3a1 100644
--- a/tempest/api/identity/admin/test_tenants.py
+++ b/tempest/api/identity/admin/test_tenants.py
@@ -21,7 +21,6 @@
class TenantsTestJSON(base.BaseIdentityV2AdminTest):
- _interface = 'json'
@test.attr(type='gate')
def test_tenant_list_delete(self):
diff --git a/tempest/api/identity/admin/test_tokens.py b/tempest/api/identity/admin/test_tokens.py
index bec621c..5323fde 100644
--- a/tempest/api/identity/admin/test_tokens.py
+++ b/tempest/api/identity/admin/test_tokens.py
@@ -19,7 +19,6 @@
class TokensTestJSON(base.BaseIdentityV2AdminTest):
- _interface = 'json'
@test.attr(type='gate')
def test_create_get_delete_token(self):
diff --git a/tempest/api/identity/admin/test_users.py b/tempest/api/identity/admin/test_users.py
index 25312e8..9159468 100644
--- a/tempest/api/identity/admin/test_users.py
+++ b/tempest/api/identity/admin/test_users.py
@@ -21,7 +21,6 @@
class UsersTestJSON(base.BaseIdentityV2AdminTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/identity/admin/test_users_negative.py b/tempest/api/identity/admin/test_users_negative.py
index c039da6..db8c564 100644
--- a/tempest/api/identity/admin/test_users_negative.py
+++ b/tempest/api/identity/admin/test_users_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.identity import base
@@ -22,7 +23,6 @@
class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
@@ -35,7 +35,7 @@
def test_create_user_by_unauthorized_user(self):
# Non-administrator should not be authorized to create a user
self.data.setup_test_tenant()
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.create_user, self.alt_user,
self.alt_password, self.data.tenant['id'],
self.alt_email)
@@ -60,14 +60,14 @@
def test_create_user_with_duplicate_name(self):
# Duplicate user should not be created
self.data.setup_test_user()
- self.assertRaises(exceptions.Conflict, self.client.create_user,
+ self.assertRaises(lib_exc.Conflict, self.client.create_user,
self.data.test_user, self.data.test_password,
self.data.tenant['id'], self.data.test_email)
@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)
@@ -79,7 +79,7 @@
token = self.client.auth_provider.get_token()
# Delete the token from database
self.client.delete_token(token)
- self.assertRaises(exceptions.Unauthorized, self.client.create_user,
+ self.assertRaises(lib_exc.Unauthorized, self.client.create_user,
self.alt_user, self.alt_password,
self.data.tenant['id'], self.alt_email)
@@ -101,7 +101,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'])
@@ -112,7 +112,7 @@
token = self.client.auth_provider.get_token()
# Delete the token from database
self.client.delete_token(token)
- self.assertRaises(exceptions.Unauthorized, self.client.update_user,
+ self.assertRaises(lib_exc.Unauthorized, self.client.update_user,
self.alt_user)
# Unset the token to allow further tests to generate a new token
@@ -122,21 +122,21 @@
def test_update_user_by_unauthorized_user(self):
# Non-administrator should not be authorized to update user
self.data.setup_test_tenant()
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.update_user, self.alt_user)
@test.attr(type=['negative', 'gate'])
def test_delete_users_by_unauthorized_user(self):
# Non-administrator user should not be authorized to delete a user
self.data.setup_test_user()
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.delete_user,
self.data.user['id'])
@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'])
@@ -147,7 +147,7 @@
token = self.client.auth_provider.get_token()
# Delete the token from database
self.client.delete_token(token)
- self.assertRaises(exceptions.Unauthorized, self.client.delete_user,
+ self.assertRaises(lib_exc.Unauthorized, self.client.delete_user,
self.alt_user)
# Unset the token to allow further tests to generate a new token
@@ -158,7 +158,7 @@
# Disabled user's token should not get authenticated
self.data.setup_test_user()
self.disable_user(self.data.test_user)
- self.assertRaises(exceptions.Unauthorized, self.token_client.auth,
+ self.assertRaises(lib_exc.Unauthorized, self.token_client.auth,
self.data.test_user,
self.data.test_password,
self.data.test_tenant)
@@ -168,7 +168,7 @@
# User's token for a disabled tenant should not be authenticated
self.data.setup_test_user()
self.disable_tenant(self.data.test_tenant)
- self.assertRaises(exceptions.Unauthorized, self.token_client.auth,
+ self.assertRaises(lib_exc.Unauthorized, self.token_client.auth,
self.data.test_user,
self.data.test_password,
self.data.test_tenant)
@@ -177,7 +177,7 @@
def test_authentication_with_invalid_tenant(self):
# User's token for an invalid tenant should not be authenticated
self.data.setup_test_user()
- self.assertRaises(exceptions.Unauthorized, self.token_client.auth,
+ self.assertRaises(lib_exc.Unauthorized, self.token_client.auth,
self.data.test_user,
self.data.test_password,
'junktenant1234')
@@ -186,7 +186,7 @@
def test_authentication_with_invalid_username(self):
# Non-existent user's token should not get authenticated
self.data.setup_test_user()
- self.assertRaises(exceptions.Unauthorized, self.token_client.auth,
+ self.assertRaises(lib_exc.Unauthorized, self.token_client.auth,
'junkuser123', self.data.test_password,
self.data.test_tenant)
@@ -194,7 +194,7 @@
def test_authentication_with_invalid_password(self):
# User's token with invalid password should not be authenticated
self.data.setup_test_user()
- self.assertRaises(exceptions.Unauthorized, self.token_client.auth,
+ self.assertRaises(lib_exc.Unauthorized, self.token_client.auth,
self.data.test_user, 'junkpass1234',
self.data.test_tenant)
@@ -202,7 +202,7 @@
def test_get_users_by_unauthorized_user(self):
# Non-administrator user should not be authorized to get user list
self.data.setup_test_user()
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.get_users)
@test.attr(type=['negative', 'gate'])
@@ -210,7 +210,7 @@
# Request to get list of users without a valid token should fail
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
- self.assertRaises(exceptions.Unauthorized, self.client.get_users)
+ self.assertRaises(lib_exc.Unauthorized, self.client.get_users)
self.client.auth_provider.clear_auth()
@test.attr(type=['negative', 'gate'])
@@ -225,5 +225,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_credentials.py b/tempest/api/identity/admin/v3/test_credentials.py
index 6f2f6d4..f22ceec 100644
--- a/tempest/api/identity/admin/v3/test_credentials.py
+++ b/tempest/api/identity/admin/v3/test_credentials.py
@@ -19,7 +19,6 @@
class CredentialsTestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/identity/admin/v3/test_default_project_id.py b/tempest/api/identity/admin/v3/test_default_project_id.py
index bd29cb8..72d323a 100644
--- a/tempest/api/identity/admin/v3/test_default_project_id.py
+++ b/tempest/api/identity/admin/v3/test_default_project_id.py
@@ -18,7 +18,6 @@
class TestDefaultProjectId (base.BaseIdentityV3AdminTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
@@ -74,8 +73,7 @@
domain_name=dom_name)
auth_provider = auth.KeystoneV3AuthProvider(creds)
creds = auth_provider.fill_credentials()
- admin_client = clients.Manager(interface=self._interface,
- credentials=creds)
+ admin_client = clients.Manager(credentials=creds)
# verify the user's token and see that it is scoped to the project
token, auth_data = admin_client.auth_provider.get_auth()
diff --git a/tempest/api/identity/admin/v3/test_domains.py b/tempest/api/identity/admin/v3/test_domains.py
index c1bc705..0914674 100644
--- a/tempest/api/identity/admin/v3/test_domains.py
+++ b/tempest/api/identity/admin/v3/test_domains.py
@@ -20,7 +20,6 @@
class DomainsTestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
def _delete_domain(self, domain_id):
# It is necessary to disable the domain before deleting,
@@ -62,10 +61,7 @@
self.assertIsNotNone(domain['id'])
self.assertEqual(d_name, domain['name'])
self.assertEqual(d_desc, domain['description'])
- if self._interface == "json":
- self.assertEqual(True, domain['enabled'])
- else:
- self.assertEqual('true', str(domain['enabled']).lower())
+ self.assertEqual(True, domain['enabled'])
new_desc = data_utils.rand_name('new-desc-')
new_name = data_utils.rand_name('new-name-')
diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py
index eed0eb5..2283c21 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -19,7 +19,6 @@
class EndPointsTestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/identity/admin/v3/test_endpoints_negative.py b/tempest/api/identity/admin/v3/test_endpoints_negative.py
index 9da0a57..9846010 100644
--- a/tempest/api/identity/admin/v3/test_endpoints_negative.py
+++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py
@@ -22,7 +22,6 @@
class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index d8c7063..6dfddb0 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -19,7 +19,6 @@
class GroupsV3TestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/identity/admin/v3/test_list_projects.py b/tempest/api/identity/admin/v3/test_list_projects.py
index c0187f9..24b130c 100644
--- a/tempest/api/identity/admin/v3/test_list_projects.py
+++ b/tempest/api/identity/admin/v3/test_list_projects.py
@@ -19,7 +19,6 @@
class ListProjectsTestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/identity/admin/v3/test_list_users.py b/tempest/api/identity/admin/v3/test_list_users.py
index e728867..a6c3309 100644
--- a/tempest/api/identity/admin/v3/test_list_users.py
+++ b/tempest/api/identity/admin/v3/test_list_users.py
@@ -19,7 +19,6 @@
class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
def _list_users_with_params(self, params, key, expected, not_expected):
# Helper method to list users filtered with params and
diff --git a/tempest/api/identity/admin/v3/test_policies.py b/tempest/api/identity/admin/v3/test_policies.py
index 23df13d..0d5dc47 100644
--- a/tempest/api/identity/admin/v3/test_policies.py
+++ b/tempest/api/identity/admin/v3/test_policies.py
@@ -19,7 +19,6 @@
class PoliciesTestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
def _delete_policy(self, policy_id):
self.policy_client.delete_policy(policy_id)
diff --git a/tempest/api/identity/admin/v3/test_projects.py b/tempest/api/identity/admin/v3/test_projects.py
index 2cf6458..d879c7a 100644
--- a/tempest/api/identity/admin/v3/test_projects.py
+++ b/tempest/api/identity/admin/v3/test_projects.py
@@ -19,7 +19,6 @@
class ProjectsTestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
@test.attr(type='gate')
def test_project_create_with_description(self):
diff --git a/tempest/api/identity/admin/v3/test_projects_negative.py b/tempest/api/identity/admin/v3/test_projects_negative.py
index f5e832b..fc013c5 100644
--- a/tempest/api/identity/admin/v3/test_projects_negative.py
+++ b/tempest/api/identity/admin/v3/test_projects_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.identity import base
from tempest.common.utils import data_utils
from tempest import exceptions
@@ -20,12 +22,11 @@
class ProjectsNegativeTestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
@test.attr(type=['negative', 'gate'])
def test_list_projects_by_unauthorized_user(self):
# Non-admin user should not be able to list projects
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.non_admin_client.list_projects)
@test.attr(type=['negative', 'gate'])
@@ -36,14 +37,14 @@
self.data.projects.append(project)
self.assertRaises(
- exceptions.Conflict, self.client.create_project, project_name)
+ lib_exc.Conflict, self.client.create_project, project_name)
@test.attr(type=['negative', 'gate'])
def test_create_project_by_unauthorized_user(self):
# Non-admin user should not be authorized to create a project
project_name = data_utils.rand_name('project-')
self.assertRaises(
- exceptions.Unauthorized, self.non_admin_client.create_project,
+ lib_exc.Unauthorized, self.non_admin_client.create_project,
project_name)
@test.attr(type=['negative', 'gate'])
@@ -66,11 +67,11 @@
project = self.client.create_project(project_name)
self.data.projects.append(project)
self.assertRaises(
- exceptions.Unauthorized, self.non_admin_client.delete_project,
+ lib_exc.Unauthorized, self.non_admin_client.delete_project,
project['id'])
@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..359c0cf 100644
--- a/tempest/api/identity/admin/v3/test_regions.py
+++ b/tempest/api/identity/admin/v3/test_regions.py
@@ -13,14 +13,14 @@
# 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
class RegionsTestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
@@ -40,7 +40,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_roles.py b/tempest/api/identity/admin/v3/test_roles.py
index b8b309d..15ca21e 100644
--- a/tempest/api/identity/admin/v3/test_roles.py
+++ b/tempest/api/identity/admin/v3/test_roles.py
@@ -19,7 +19,6 @@
class RolesV3TestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/identity/admin/v3/test_services.py b/tempest/api/identity/admin/v3/test_services.py
index 9e45b50..13e6d66 100644
--- a/tempest/api/identity/admin/v3/test_services.py
+++ b/tempest/api/identity/admin/v3/test_services.py
@@ -13,20 +13,20 @@
# 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
class ServicesTestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
def _del_service(self, service_id):
# 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..36be098 100644
--- a/tempest/api/identity/admin/v3/test_tokens.py
+++ b/tempest/api/identity/admin/v3/test_tokens.py
@@ -13,14 +13,14 @@
# 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
class TokensV3TestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
@test.attr(type='smoke')
def test_tokens(self):
@@ -44,7 +44,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..fd62004 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -13,9 +13,11 @@
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
+from tempest.common import cred_provider
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
@@ -87,13 +89,11 @@
self.assertIsNotNone(self.trustee_user_id)
# Initialize a new client with the trustor credentials
- creds = auth.get_credentials(
+ creds = cred_provider.get_credentials(
username=self.trustor_username,
password=self.trustor_password,
tenant_name=self.trustor_project_name)
- os = clients.Manager(
- credentials=creds,
- interface=self._interface)
+ os = clients.Manager(credentials=creds)
self.trustor_client = os.identity_v3_client
def cleanup_user_and_roles(self):
@@ -166,26 +166,25 @@
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
class TrustsV3TestJSON(BaseTrustsV3Test):
- _interface = 'json'
def setUp(self):
super(TrustsV3TestJSON, self).setUp()
diff --git a/tempest/api/identity/admin/v3/test_users.py b/tempest/api/identity/admin/v3/test_users.py
index 4f3ec05..2481d9d 100644
--- a/tempest/api/identity/admin/v3/test_users.py
+++ b/tempest/api/identity/admin/v3/test_users.py
@@ -19,7 +19,6 @@
class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
- _interface = 'json'
@test.attr(type='gate')
def test_user_update(self):
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 08bfd4f..8f07a6a 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 import cred_provider
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
@@ -31,8 +31,8 @@
@classmethod
def resource_setup(cls):
super(BaseIdentityAdminTest, cls).resource_setup()
- cls.os_adm = clients.AdminManager(interface=cls._interface)
- cls.os = clients.Manager(interface=cls._interface)
+ cls.os_adm = clients.AdminManager()
+ cls.os = clients.Manager()
@classmethod
def disable_user(cls, user_name):
@@ -149,11 +149,11 @@
@property
def test_credentials(self):
- return auth.get_credentials(username=self.test_user,
- user_id=self.user['id'],
- password=self.test_password,
- tenant_name=self.test_tenant,
- tenant_id=self.tenant['id'])
+ return cred_provider.get_credentials(username=self.test_user,
+ user_id=self.user['id'],
+ password=self.test_password,
+ tenant_name=self.test_tenant,
+ tenant_id=self.tenant['id'])
def setup_test_user(self):
"""Set up a test user."""
@@ -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/identity/test_extension.py b/tempest/api/identity/test_extension.py
index e3badfc..bbc4c13 100644
--- a/tempest/api/identity/test_extension.py
+++ b/tempest/api/identity/test_extension.py
@@ -18,7 +18,6 @@
class ExtensionTestJSON(base.BaseIdentityV2AdminTest):
- _interface = 'json'
@test.attr(type='gate')
def test_list_extensions(self):
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 12f3fdd..344742b 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
@@ -35,7 +35,6 @@
cls.set_network_resources()
super(BaseImageTest, cls).resource_setup()
cls.created_images = []
- cls._interface = 'json'
cls.isolated_creds = credentials.get_isolated_credentials(
cls.__name__, network_resources=cls.network_resources)
if not CONF.service_available.glance:
@@ -48,7 +47,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_member.py b/tempest/api/image/v2/test_images_member.py
index ec1cf14..956829e 100644
--- a/tempest/api/image/v2/test_images_member.py
+++ b/tempest/api/image/v2/test_images_member.py
@@ -15,7 +15,6 @@
class ImagesMemberTest(base.BaseV2MemberImageTest):
- _interface = 'json'
@test.attr(type='gate')
def test_image_share_accept(self):
diff --git a/tempest/api/image/v2/test_images_member_negative.py b/tempest/api/image/v2/test_images_member_negative.py
index 1f8e3d0..4402af9 100644
--- a/tempest/api/image/v2/test_images_member_negative.py
+++ b/tempest/api/image/v2/test_images_member_negative.py
@@ -10,13 +10,14 @@
# 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
class ImagesMemberNegativeTest(base.BaseV2MemberImageTest):
- _interface = 'json'
@test.attr(type=['negative', 'gate'])
def test_image_share_invalid_status(self):
@@ -35,7 +36,7 @@
self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.os_img_client.update_member_status,
image_id, self.alt_tenant_id, 'accepted')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
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_claims.py b/tempest/api/messaging/test_claims.py
index 1aab8d2..c9064b0 100644
--- a/tempest/api/messaging/test_claims.py
+++ b/tempest/api/messaging/test_claims.py
@@ -29,7 +29,6 @@
class TestClaims(base.BaseMessagingTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/messaging/test_messages.py b/tempest/api/messaging/test_messages.py
index 3c27ac2..dca95fc 100644
--- a/tempest/api/messaging/test_messages.py
+++ b/tempest/api/messaging/test_messages.py
@@ -26,7 +26,6 @@
class TestMessages(base.BaseMessagingTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/messaging/test_queues.py b/tempest/api/messaging/test_queues.py
index accbd17..24656bf 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,13 +42,12 @@
self.assertEqual('', body)
self.delete_queue(queue_name)
- self.assertRaises(exceptions.NotFound,
+ self.assertRaises(lib_exc.NotFound,
self.client.get_queue,
queue_name)
class TestManageQueue(base.BaseMessagingTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/network/admin/test_agent_management.py b/tempest/api/network/admin/test_agent_management.py
index e7fd016..20948cc 100644
--- a/tempest/api/network/admin/test_agent_management.py
+++ b/tempest/api/network/admin/test_agent_management.py
@@ -18,7 +18,6 @@
class AgentManagementTestJSON(base.BaseAdminNetworkTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/network/admin/test_dhcp_agent_scheduler.py b/tempest/api/network/admin/test_dhcp_agent_scheduler.py
index a89f25c..4eb6b87 100644
--- a/tempest/api/network/admin/test_dhcp_agent_scheduler.py
+++ b/tempest/api/network/admin/test_dhcp_agent_scheduler.py
@@ -17,7 +17,6 @@
class DHCPAgentSchedulersTestJSON(base.BaseAdminNetworkTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/network/admin/test_external_network_extension.py b/tempest/api/network/admin/test_external_network_extension.py
index 06cce48..6e24f8e 100644
--- a/tempest/api/network/admin/test_external_network_extension.py
+++ b/tempest/api/network/admin/test_external_network_extension.py
@@ -15,7 +15,6 @@
class ExternalNetworksTestJSON(base.BaseAdminNetworkTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/network/admin/test_external_networks_negative.py b/tempest/api/network/admin/test_external_networks_negative.py
index 7dbb347..aa8dd9a 100644
--- a/tempest/api/network/admin/test_external_networks_negative.py
+++ b/tempest/api/network/admin/test_external_networks_negative.py
@@ -13,16 +13,16 @@
# 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 import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
class ExternalNetworksAdminNegativeTestJSON(base.BaseAdminNetworkTest):
- _interface = 'json'
@test.attr(type=['negative'])
def test_create_port_with_precreated_floatingip_as_fixed_ip(self):
@@ -47,7 +47,7 @@
fixed_ips = [{'ip_address': floating_ip_address}]
# create a port which will internally create an instance-ip
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
client.create_port,
network_id=CONF.network.public_network_id,
fixed_ips=fixed_ips)
diff --git a/tempest/api/network/admin/test_floating_ips_admin_actions.py b/tempest/api/network/admin/test_floating_ips_admin_actions.py
index 62ba1b3..ee3b0bb 100644
--- a/tempest/api/network/admin/test_floating_ips_admin_actions.py
+++ b/tempest/api/network/admin/test_floating_ips_admin_actions.py
@@ -22,7 +22,7 @@
class FloatingIPAdminTestJSON(base.BaseAdminNetworkTest):
- _interface = 'json'
+
force_tenant_isolation = True
@classmethod
diff --git a/tempest/api/network/admin/test_l3_agent_scheduler.py b/tempest/api/network/admin/test_l3_agent_scheduler.py
index a6de581..05a8e35 100644
--- a/tempest/api/network/admin/test_l3_agent_scheduler.py
+++ b/tempest/api/network/admin/test_l3_agent_scheduler.py
@@ -18,7 +18,6 @@
class L3AgentSchedulerTestJSON(base.BaseAdminNetworkTest):
- _interface = 'json'
"""
Tests the following operations in the Neutron API using the REST client for
diff --git a/tempest/api/network/admin/test_lbaas_agent_scheduler.py b/tempest/api/network/admin/test_lbaas_agent_scheduler.py
index da1af36..8cfd5c2 100644
--- a/tempest/api/network/admin/test_lbaas_agent_scheduler.py
+++ b/tempest/api/network/admin/test_lbaas_agent_scheduler.py
@@ -18,7 +18,6 @@
class LBaaSAgentSchedulerTestJSON(base.BaseAdminNetworkTest):
- _interface = 'json'
"""
Tests the following operations in the Neutron API using the REST client for
diff --git a/tempest/api/network/admin/test_load_balancer_admin_actions.py b/tempest/api/network/admin/test_load_balancer_admin_actions.py
index e81616b..2537b28 100644
--- a/tempest/api/network/admin/test_load_balancer_admin_actions.py
+++ b/tempest/api/network/admin/test_load_balancer_admin_actions.py
@@ -19,7 +19,6 @@
class LoadBalancerAdminTestJSON(base.BaseAdminNetworkTest):
- _interface = 'json'
"""
Test admin actions for load balancer.
diff --git a/tempest/api/network/admin/test_quotas.py b/tempest/api/network/admin/test_quotas.py
index f8dfca9..39850f5 100644
--- a/tempest/api/network/admin/test_quotas.py
+++ b/tempest/api/network/admin/test_quotas.py
@@ -20,7 +20,6 @@
class QuotasTest(base.BaseAdminNetworkTest):
- _interface = 'json'
"""
Tests the following operations in the Neutron API using the REST client for
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 10cda53..4cb1485 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
@@ -49,7 +50,6 @@
neutron as True
"""
- _interface = 'json'
force_tenant_isolation = False
# Default to ipv4.
@@ -177,7 +177,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 +399,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'])
@@ -420,8 +420,7 @@
try:
creds = cls.isolated_creds.get_admin_creds()
- cls.os_adm = clients.Manager(
- credentials=creds, interface=cls._interface)
+ cls.os_adm = clients.Manager(credentials=creds)
except NotImplementedError:
msg = ("Missing Administrative Network API credentials "
"in configuration.")
diff --git a/tempest/api/network/test_allowed_address_pair.py b/tempest/api/network/test_allowed_address_pair.py
index 57887ac..a4954af 100644
--- a/tempest/api/network/test_allowed_address_pair.py
+++ b/tempest/api/network/test_allowed_address_pair.py
@@ -23,7 +23,6 @@
class AllowedAddressPairTestJSON(base.BaseNetworkTest):
- _interface = 'json'
"""
Tests the Neutron Allowed Address Pair API extension using the Tempest
diff --git a/tempest/api/network/test_dhcp_ipv6.py b/tempest/api/network/test_dhcp_ipv6.py
index 1257699..f7a6fb7 100644
--- a/tempest/api/network/test_dhcp_ipv6.py
+++ b/tempest/api/network/test_dhcp_ipv6.py
@@ -16,6 +16,8 @@
import netaddr
import random
+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
@@ -348,7 +350,7 @@
fixed_ips=[
{'subnet_id': subnet['id'],
'ip_address': ip}])
- self.assertRaisesRegexp(exceptions.Conflict,
+ self.assertRaisesRegexp(lib_exc.Conflict,
"object with that identifier already exists",
self.create_port,
self.network,
diff --git a/tempest/api/network/test_extensions.py b/tempest/api/network/test_extensions.py
index 54c3cb9..2b4ccaf 100644
--- a/tempest/api/network/test_extensions.py
+++ b/tempest/api/network/test_extensions.py
@@ -19,7 +19,6 @@
class ExtensionsTestJSON(base.BaseNetworkTest):
- _interface = 'json'
"""
Tests the following operations in the Neutron API using the REST client for
diff --git a/tempest/api/network/test_extra_dhcp_options.py b/tempest/api/network/test_extra_dhcp_options.py
index bd70323..1faac58 100644
--- a/tempest/api/network/test_extra_dhcp_options.py
+++ b/tempest/api/network/test_extra_dhcp_options.py
@@ -19,7 +19,6 @@
class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest):
- _interface = 'json'
"""
Tests the following operations with the Extra DHCP Options Neutron API
diff --git a/tempest/api/network/test_floating_ips.py b/tempest/api/network/test_floating_ips.py
index 1151c5d..43b296c 100644
--- a/tempest/api/network/test_floating_ips.py
+++ b/tempest/api/network/test_floating_ips.py
@@ -24,7 +24,6 @@
class FloatingIPTestJSON(base.BaseNetworkTest):
- _interface = 'json'
"""
Tests the following operations in the Quantum API using the REST client for
diff --git a/tempest/api/network/test_floating_ips_negative.py b/tempest/api/network/test_floating_ips_negative.py
index 82f0519..81eedd4 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
@@ -24,7 +26,7 @@
class FloatingIPNegativeTestJSON(base.BaseNetworkTest):
- _interface = 'json'
+
"""
Test the following negative operations for floating ips:
@@ -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..280c5bb 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
@@ -22,7 +24,6 @@
class FWaaSExtensionTestJSON(base.BaseNetworkTest):
- _interface = 'json'
"""
Tests the following operations in the Neutron API using the REST client for
@@ -63,7 +64,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 +72,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 +80,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_load_balancer.py b/tempest/api/network/test_load_balancer.py
index df76757..107d8cd 100644
--- a/tempest/api/network/test_load_balancer.py
+++ b/tempest/api/network/test_load_balancer.py
@@ -21,7 +21,6 @@
class LoadBalancerTestJSON(base.BaseNetworkTest):
- _interface = 'json'
"""
Tests the following operations in the Neutron API using the REST client for
diff --git a/tempest/api/network/test_metering_extensions.py b/tempest/api/network/test_metering_extensions.py
index 6ba1ea4..c80d0e9 100644
--- a/tempest/api/network/test_metering_extensions.py
+++ b/tempest/api/network/test_metering_extensions.py
@@ -24,7 +24,6 @@
class MeteringTestJSON(base.BaseAdminNetworkTest):
- _interface = 'json'
"""
Tests the following operations in the Neutron API using the REST client for
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index 65aeb24..0df455e 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -15,19 +15,18 @@
import itertools
import netaddr
+from tempest_lib import exceptions as lib_exc
from tempest.api.network import base
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
class NetworksTestJSON(base.BaseNetworkTest):
- _interface = 'json'
"""
Tests the following operations in the Neutron API using the REST client for
@@ -280,7 +279,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')
@@ -300,7 +299,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
@@ -399,7 +398,6 @@
class BulkNetworkOpsTestJSON(base.BaseNetworkTest):
- _interface = 'json'
"""
Tests the following operations in the Neutron API using the REST client for
@@ -614,7 +612,7 @@
self.assertNotIn(subnet_slaac['id'], subnet_ids,
"Subnet wasn't deleted")
self.assertRaisesRegexp(
- exceptions.Conflict,
+ lib_exc.Conflict,
"There are one or more ports still in use on the network",
self.client.delete_network,
slaac_network['id'])
diff --git a/tempest/api/network/test_networks_negative.py b/tempest/api/network/test_networks_negative.py
index bc3ab68..09bd9c3 100644
--- a/tempest/api/network/test_networks_negative.py
+++ b/tempest/api/network/test_networks_negative.py
@@ -14,41 +14,41 @@
# 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
class NetworksNegativeTestJSON(base.BaseNetworkTest):
- _interface = 'json'
@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_ports.py b/tempest/api/network/test_ports.py
index bf85e90..2460092 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -27,7 +27,6 @@
class PortsTestJSON(sec_base.BaseSecGroupTest):
- _interface = 'json'
"""
Test the following operations for ports:
@@ -300,7 +299,6 @@
class PortsAdminExtendedAttrsTestJSON(base.BaseAdminNetworkTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index 210a8af..b0ee00d 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -25,7 +25,6 @@
class RoutersTest(base.BaseRouterTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/network/test_routers_negative.py b/tempest/api/network/test_routers_negative.py
index d571e92..655fa58 100644
--- a/tempest/api/network/test_routers_negative.py
+++ b/tempest/api/network/test_routers_negative.py
@@ -14,6 +14,7 @@
# under the License.
import netaddr
+from tempest_lib import exceptions as lib_exc
from tempest.api.network import base_routers as base
from tempest.common.utils import data_utils
@@ -25,7 +26,6 @@
class RoutersNegativeTest(base.BaseRouterTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
@@ -42,7 +42,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={
@@ -79,26 +79,26 @@
def test_router_remove_interface_in_use_returns_409(self):
self.client.add_router_interface_with_subnet_id(
self.router['id'], self.subnet['id'])
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.client.delete_router,
self.router['id'])
@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.py b/tempest/api/network/test_security_groups.py
index 415dedd..3d26b48 100644
--- a/tempest/api/network/test_security_groups.py
+++ b/tempest/api/network/test_security_groups.py
@@ -24,7 +24,7 @@
class SecGroupTest(base.BaseSecGroupTest):
- _interface = 'json'
+
_tenant_network_cidr = CONF.network.tenant_network_cidr
@classmethod
diff --git a/tempest/api/network/test_security_groups_negative.py b/tempest/api/network/test_security_groups_negative.py
index fb51e30..47b218c 100644
--- a/tempest/api/network/test_security_groups_negative.py
+++ b/tempest/api/network/test_security_groups_negative.py
@@ -15,6 +15,8 @@
import uuid
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.network import base_security_groups as base
from tempest import config
from tempest import exceptions
@@ -24,7 +26,7 @@
class NegativeSecGroupTest(base.BaseSecGroupTest):
- _interface = 'json'
+
_tenant_network_cidr = CONF.network.tenant_network_cidr
@classmethod
@@ -37,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
)
@@ -88,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)
@@ -152,7 +154,7 @@
def test_create_additional_default_security_group_fails(self):
# Create security group named 'default', it should be failed.
name = 'default'
- self.assertRaises(exceptions.Conflict,
+ self.assertRaises(lib_exc.Conflict,
self.client.create_security_group,
name=name)
@@ -175,7 +177,7 @@
# Try creating the same security group rule, it should fail
self.assertRaises(
- exceptions.Conflict, self.client.create_security_group_rule,
+ lib_exc.Conflict, self.client.create_security_group_rule,
security_group_id=body['security_group']['id'],
protocol='tcp', direction='ingress', ethertype=self.ethertype,
port_range_min=min_port, port_range_max=max_port)
@@ -184,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_service_type_management.py b/tempest/api/network/test_service_type_management.py
index 0492fe3..e620ae6 100644
--- a/tempest/api/network/test_service_type_management.py
+++ b/tempest/api/network/test_service_type_management.py
@@ -17,7 +17,6 @@
class ServiceTypeManagementTestJSON(base.BaseNetworkTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/network/test_vpnaas_extensions.py b/tempest/api/network/test_vpnaas_extensions.py
index 56e1a05..d869b55 100644
--- a/tempest/api/network/test_vpnaas_extensions.py
+++ b/tempest/api/network/test_vpnaas_extensions.py
@@ -13,17 +13,17 @@
# 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
class VPNaaSTestJSON(base.BaseAdminNetworkTest):
- _interface = 'json'
"""
Tests the following operations in the Neutron API using the REST client for
@@ -74,7 +74,7 @@
try:
self.client.delete_ipsecpolicy(ipsec_policy_id)
- except exceptions.NotFound:
+ except lib_exc.NotFound:
pass
def _assertExpected(self, expected, actual):
@@ -304,7 +304,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_account_quotas_negative.py b/tempest/api/object_storage/test_account_quotas_negative.py
index 5a0be54..0e136bf 100644
--- a/tempest/api/object_storage/test_account_quotas_negative.py
+++ b/tempest/api/object_storage/test_account_quotas_negative.py
@@ -15,12 +15,12 @@
# under the License.
from tempest_lib import decorators
+from tempest_lib import exceptions as lib_exc
from tempest.api.object_storage import base
from tempest import clients
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -85,12 +85,12 @@
"""
# Not able to remove quota
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.account_client.create_account_metadata,
{"Quota-Bytes": ""})
# Not able to modify quota
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.account_client.create_account_metadata,
{"Quota-Bytes": "100"})
@@ -100,6 +100,6 @@
def test_upload_large_object(self):
object_name = data_utils.rand_name(name="TestObject")
data = data_utils.arbitrary_string(30)
- self.assertRaises(exceptions.OverLimit,
+ self.assertRaises(lib_exc.OverLimit,
self.object_client.create_object,
self.container_name, object_name, data)
diff --git a/tempest/api/object_storage/test_account_services_negative.py b/tempest/api/object_storage/test_account_services_negative.py
index ef04387..9acf668 100644
--- a/tempest/api/object_storage/test_account_services_negative.py
+++ b/tempest/api/object_storage/test_account_services_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.object_storage import base
from tempest import clients
-from tempest import exceptions
from tempest import test
@@ -44,6 +45,6 @@
params = {'format': 'json'}
# list containers with non-authorized user token
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.account_client.list_account_containers,
params=params)
diff --git a/tempest/api/object_storage/test_container_acl_negative.py b/tempest/api/object_storage/test_container_acl_negative.py
index 138d25a..7fe472c 100644
--- a/tempest/api/object_storage/test_container_acl_negative.py
+++ b/tempest/api/object_storage/test_container_acl_negative.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 import clients
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -47,7 +48,7 @@
request_part='headers',
auth_data=None
)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.object_client.create_object,
self.container_name, object_name, 'data', headers={})
@@ -63,7 +64,7 @@
request_part='headers',
auth_data=None
)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.object_client.delete_object,
self.container_name, object_name)
@@ -77,7 +78,7 @@
request_part='headers',
auth_data=self.test_auth_data
)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.object_client.create_object,
self.container_name, object_name, 'data', headers={})
@@ -94,7 +95,7 @@
request_part='headers',
auth_data=self.test_auth_data
)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.object_client.get_object,
self.container_name, object_name)
@@ -111,7 +112,7 @@
request_part='headers',
auth_data=self.test_auth_data
)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.object_client.delete_object,
self.container_name, object_name)
@@ -134,7 +135,7 @@
request_part='headers',
auth_data=self.test_auth_data
)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.object_client.get_object,
self.container_name, object_name)
@@ -153,7 +154,7 @@
auth_data=self.test_auth_data
)
object_name = data_utils.rand_name(name='Object')
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.object_client.create_object,
self.container_name,
object_name, 'data', headers={})
@@ -175,7 +176,7 @@
auth_data=self.test_auth_data
)
object_name = data_utils.rand_name(name='Object')
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.object_client.create_object,
self.container_name,
object_name, 'data', headers={})
@@ -201,7 +202,7 @@
request_part='headers',
auth_data=self.test_auth_data
)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.object_client.delete_object,
self.container_name,
object_name)
diff --git a/tempest/api/object_storage/test_container_quotas.py b/tempest/api/object_storage/test_container_quotas.py
index 46944ed..12ec6d2 100644
--- a/tempest/api/object_storage/test_container_quotas.py
+++ b/tempest/api/object_storage/test_container_quotas.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.object_storage import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -75,7 +76,7 @@
nbefore = self._get_bytes_used()
- self.assertRaises(exceptions.OverLimit,
+ self.assertRaises(lib_exc.OverLimit,
self.object_client.create_object,
self.container_name, object_name, data)
@@ -93,7 +94,7 @@
nbefore = self._get_object_count()
self.assertEqual(nbefore, QUOTA_COUNT)
- self.assertRaises(exceptions.OverLimit,
+ self.assertRaises(lib_exc.OverLimit,
self.object_client.create_object,
self.container_name, "OverQuotaObject", "")
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_formpost_negative.py b/tempest/api/object_storage/test_object_formpost_negative.py
index 32f5917..cdd9d2c 100644
--- a/tempest/api/object_storage/test_object_formpost_negative.py
+++ b/tempest/api/object_storage/test_object_formpost_negative.py
@@ -18,9 +18,10 @@
import time
import urlparse
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.object_storage import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -117,7 +118,7 @@
url = "%s/%s" % (self.container_name, self.object_name)
exc = self.assertRaises(
- exceptions.Unauthorized,
+ lib_exc.Unauthorized,
self.object_client.post,
url, body, headers=headers)
self.assertIn('FormPost: Form Expired', str(exc))
@@ -133,7 +134,7 @@
url = "%s/%s" % (self.container_name, self.object_name)
exc = self.assertRaises(
- exceptions.Unauthorized,
+ lib_exc.Unauthorized,
self.object_client.post,
url, body, headers=headers)
self.assertIn('FormPost: Invalid Signature', str(exc))
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/object_storage/test_object_temp_url_negative.py b/tempest/api/object_storage/test_object_temp_url_negative.py
index b752348..ca34293 100644
--- a/tempest/api/object_storage/test_object_temp_url_negative.py
+++ b/tempest/api/object_storage/test_object_temp_url_negative.py
@@ -19,9 +19,10 @@
import time
import urlparse
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.object_storage import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -104,5 +105,5 @@
# temp URL is valid for 1 seconds, let's wait 2
time.sleep(2)
- self.assertRaises(exceptions.Unauthorized,
+ self.assertRaises(lib_exc.Unauthorized,
self.object_client.get, url)
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index 97777db..6873756 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
@@ -59,7 +59,7 @@
@classmethod
def _get_identity_admin_client(cls):
"""Returns an instance of the Identity Admin API client."""
- manager = clients.AdminManager(interface=cls._interface)
+ manager = clients.AdminManager()
admin_client = manager.identity_client
return admin_client
@@ -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..05aed08 100644
--- a/tempest/api/telemetry/test_telemetry_alarming_api.py
+++ b/tempest/api/telemetry/test_telemetry_alarming_api.py
@@ -10,14 +10,14 @@
# 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
class TelemetryAlarmingAPITestJSON(base.BaseTelemetryTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
@@ -70,7 +70,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 +101,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/telemetry/test_telemetry_notification_api.py b/tempest/api/telemetry/test_telemetry_notification_api.py
index 7e5d6ee..147020e 100644
--- a/tempest/api/telemetry/test_telemetry_notification_api.py
+++ b/tempest/api/telemetry/test_telemetry_notification_api.py
@@ -21,7 +21,6 @@
class TelemetryNotificationAPITestJSON(base.BaseTelemetryTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/volume/admin/test_multi_backend.py b/tempest/api/volume/admin/test_multi_backend.py
index 65c4bd3..245161a 100644
--- a/tempest/api/volume/admin/test_multi_backend.py
+++ b/tempest/api/volume/admin/test_multi_backend.py
@@ -22,7 +22,6 @@
class VolumeMultiBackendV2Test(base.BaseVolumeAdminTest):
- _interface = "json"
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/volume/admin/test_snapshots_actions.py b/tempest/api/volume/admin/test_snapshots_actions.py
index 6c64298..e7d9d7b 100644
--- a/tempest/api/volume/admin/test_snapshots_actions.py
+++ b/tempest/api/volume/admin/test_snapshots_actions.py
@@ -19,7 +19,6 @@
class SnapshotsActionsV2Test(base.BaseVolumeAdminTest):
- _interface = "json"
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/volume/admin/test_volume_hosts.py b/tempest/api/volume/admin/test_volume_hosts.py
index a214edf..8189aab 100644
--- a/tempest/api/volume/admin/test_volume_hosts.py
+++ b/tempest/api/volume/admin/test_volume_hosts.py
@@ -18,7 +18,6 @@
class VolumeHostsAdminV2TestsJSON(base.BaseVolumeAdminTest):
- _interface = "json"
@test.attr(type='gate')
def test_list_hosts(self):
diff --git a/tempest/api/volume/admin/test_volume_quotas.py b/tempest/api/volume/admin/test_volume_quotas.py
index 52f2d90..2a30b54 100644
--- a/tempest/api/volume/admin/test_volume_quotas.py
+++ b/tempest/api/volume/admin/test_volume_quotas.py
@@ -23,7 +23,6 @@
class BaseVolumeQuotasAdminV2TestJSON(base.BaseVolumeAdminTest):
- _interface = "json"
force_tenant_isolation = True
@classmethod
diff --git a/tempest/api/volume/admin/test_volume_quotas_negative.py b/tempest/api/volume/admin/test_volume_quotas_negative.py
index 5cf6af0..f972457 100644
--- a/tempest/api/volume/admin/test_volume_quotas_negative.py
+++ b/tempest/api/volume/admin/test_volume_quotas_negative.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.volume import base
-from tempest import exceptions
from tempest import test
class BaseVolumeQuotasNegativeV2TestJSON(base.BaseVolumeAdminTest):
- _interface = "json"
force_tenant_isolation = True
@classmethod
@@ -42,13 +42,13 @@
@test.attr(type='negative')
def test_quota_volumes(self):
- self.assertRaises(exceptions.OverLimit,
+ self.assertRaises(lib_exc.OverLimit,
self.volumes_client.create_volume,
size=1)
@test.attr(type='negative')
def test_quota_volume_snapshots(self):
- self.assertRaises(exceptions.OverLimit,
+ self.assertRaises(lib_exc.OverLimit,
self.snapshots_client.create_snapshot,
self.volume['id'])
@@ -65,7 +65,7 @@
self.quotas_client.update_quota_set(
self.demo_tenant_id,
**new_quota_set)
- self.assertRaises(exceptions.OverLimit,
+ self.assertRaises(lib_exc.OverLimit,
self.volumes_client.create_volume,
size=1)
@@ -73,7 +73,7 @@
self.quotas_client.update_quota_set(
self.demo_tenant_id,
**self.shared_quota_set)
- self.assertRaises(exceptions.OverLimit,
+ self.assertRaises(lib_exc.OverLimit,
self.snapshots_client.create_snapshot,
self.volume['id'])
diff --git a/tempest/api/volume/admin/test_volume_services.py b/tempest/api/volume/admin/test_volume_services.py
index 46db70f..3bab185 100644
--- a/tempest/api/volume/admin/test_volume_services.py
+++ b/tempest/api/volume/admin/test_volume_services.py
@@ -22,7 +22,6 @@
Tests Volume Services API.
volume service list requires admin privileges.
"""
- _interface = "json"
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/volume/admin/test_volume_types.py b/tempest/api/volume/admin/test_volume_types.py
index 58f1551..f2c1dda 100644
--- a/tempest/api/volume/admin/test_volume_types.py
+++ b/tempest/api/volume/admin/test_volume_types.py
@@ -22,7 +22,6 @@
class VolumeTypesV2Test(base.BaseVolumeAdminTest):
- _interface = "json"
def _delete_volume(self, volume_id):
self.volumes_client.delete_volume(volume_id)
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs.py b/tempest/api/volume/admin/test_volume_types_extra_specs.py
index 460a6c3..1ce1402 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs.py
@@ -19,7 +19,6 @@
class VolumeTypesExtraSpecsV2Test(base.BaseVolumeAdminTest):
- _interface = "json"
@classmethod
def resource_setup(cls):
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..2f3b382 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
@@ -22,7 +24,6 @@
class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):
- _interface = 'json'
@classmethod
def resource_setup(cls):
@@ -83,7 +84,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 +110,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 +118,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 +127,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 +136,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..77ca34c 100644
--- a/tempest/api/volume/admin/test_volume_types_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_negative.py
@@ -15,13 +15,14 @@
import uuid
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.volume import base
from tempest import exceptions
from tempest import test
class VolumeTypesNegativeV2Test(base.BaseVolumeAdminTest):
- _interface = 'json'
@test.attr(type='gate')
def test_create_with_nonexistent_volume_type(self):
@@ -29,7 +30,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 +43,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/admin/test_volumes_actions.py b/tempest/api/volume/admin/test_volumes_actions.py
index 4feba73..439dd35 100644
--- a/tempest/api/volume/admin/test_volumes_actions.py
+++ b/tempest/api/volume/admin/test_volumes_actions.py
@@ -19,7 +19,6 @@
class VolumesActionsV2Test(base.BaseVolumeAdminTest):
- _interface = "json"
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/volume/admin/test_volumes_backup.py b/tempest/api/volume/admin/test_volumes_backup.py
index 0739480..d572893 100644
--- a/tempest/api/volume/admin/test_volumes_backup.py
+++ b/tempest/api/volume/admin/test_volumes_backup.py
@@ -24,7 +24,6 @@
class VolumesBackupsV2Test(base.BaseVolumeAdminTest):
- _interface = "json"
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 127a216..2489b79 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
@@ -29,7 +31,6 @@
"""Base test case class for all Cinder API tests."""
_api_version = 2
- _interface = 'json'
@classmethod
def resource_setup(cls):
@@ -153,8 +154,7 @@
try:
cls.adm_creds = cls.isolated_creds.get_admin_creds()
- cls.os_adm = clients.Manager(
- credentials=cls.adm_creds, interface=cls._interface)
+ cls.os_adm = clients.Manager(credentials=cls.adm_creds)
except NotImplementedError:
msg = "Missing Volume Admin API credentials in configuration."
raise cls.skipException(msg)
@@ -208,13 +208,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_volume_transfers.py b/tempest/api/volume/test_volume_transfers.py
index b2961bd..7451050 100644
--- a/tempest/api/volume/test_volume_transfers.py
+++ b/tempest/api/volume/test_volume_transfers.py
@@ -30,13 +30,11 @@
super(VolumesV2TransfersTest, cls).resource_setup()
# Add another tenant to test volume-transfer
- cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds(),
- interface=cls._interface)
+ cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
# Add admin tenant to cleanup resources
try:
creds = cls.isolated_creds.get_admin_creds()
- cls.os_adm = clients.Manager(
- credentials=creds, interface=cls._interface)
+ cls.os_adm = clients.Manager(credentials=creds)
except NotImplementedError:
msg = "Missing Volume Admin API credentials in configuration."
raise cls.skipException(msg)
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index 6d9c438..2a49210 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -37,15 +37,6 @@
self.client.delete_volume(volume_id)
self.client.wait_for_resource_deletion(volume_id)
- def _is_true(self, val):
- # NOTE(jdg): Temporary conversion method to get cinder patch
- # merged. Then we'll make this strict again and
- # specifically check "true" or "false"
- if val in ['true', 'True', True]:
- return True
- else:
- return False
-
def _volume_create_get_update_delete(self, **kwargs):
# Create a volume, Get it's details and Delete the volume
volume = {}
@@ -79,13 +70,10 @@
'The fetched Volume metadata misses data '
'from the created Volume')
- # NOTE(jdg): Revert back to strict true/false checking
- # after fix for bug #1227837 merges
- boot_flag = self._is_true(fetched_volume['bootable'])
if 'imageRef' in kwargs:
- self.assertEqual(boot_flag, True)
+ self.assertEqual('true', fetched_volume['bootable'])
if 'imageRef' not in kwargs:
- self.assertEqual(boot_flag, False)
+ self.assertEqual('false', fetched_volume['bootable'])
# Update Volume
# Test volume update when display_name is same with original value
@@ -125,13 +113,10 @@
self.descrip_field: volume[self.descrip_field]}
self.client.update_volume(new_volume['id'], **params)
- # NOTE(jdg): Revert back to strict true/false checking
- # after fix for bug #1227837 merges
- boot_flag = self._is_true(updated_volume['bootable'])
if 'imageRef' in kwargs:
- self.assertEqual(boot_flag, True)
+ self.assertEqual('true', updated_volume['bootable'])
if 'imageRef' not in kwargs:
- self.assertEqual(boot_flag, False)
+ self.assertEqual('false', updated_volume['bootable'])
@test.attr(type='smoke')
def test_volume_create_get_update_delete(self):
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/auth.py b/tempest/auth.py
index 6a92b5f..7e1928f 100644
--- a/tempest/auth.py
+++ b/tempest/auth.py
@@ -38,34 +38,21 @@
Provide authentication
"""
- def __init__(self, credentials, interface=None):
+ def __init__(self, credentials):
"""
:param credentials: credentials for authentication
- :param interface: 'json' or 'xml'. Applicable for tempest client only
- (deprecated: only json now supported)
"""
- credentials = self._convert_credentials(credentials)
if self.check_credentials(credentials):
self.credentials = credentials
else:
raise TypeError("Invalid credentials")
- self.interface = 'json'
self.cache = None
self.alt_auth_data = None
self.alt_part = None
- def _convert_credentials(self, credentials):
- # Support dict credentials for backwards compatibility
- if isinstance(credentials, dict):
- return get_credentials(**credentials)
- else:
- return credentials
-
def __str__(self):
- return "Creds :{creds}, interface: {interface}, " \
- "cached auth data: {cache}".format(
- creds=self.credentials, interface=self.interface,
- cache=self.cache)
+ return "Creds :{creds}, cached auth data: {cache}".format(
+ creds=self.credentials, cache=self.cache)
@abc.abstractmethod
def _decorate_request(self, filters, method, url, headers=None, body=None,
@@ -201,8 +188,8 @@
token_expiry_threshold = datetime.timedelta(seconds=60)
- def __init__(self, credentials, interface=None):
- super(KeystoneAuthProvider, self).__init__(credentials, interface)
+ def __init__(self, credentials):
+ super(KeystoneAuthProvider, self).__init__(credentials)
self.auth_client = self._auth_client()
def _decorate_request(self, filters, method, url, headers=None, body=None,
@@ -440,44 +427,38 @@
datetime.datetime.utcnow()
-def get_default_credentials(credential_type, fill_in=True):
- """
- Returns configured credentials of the specified type
- based on the configured auth_version
- """
- return get_credentials(fill_in=fill_in, credential_type=credential_type)
+def is_identity_version_supported(identity_version):
+ return identity_version in IDENTITY_VERSION
-def get_credentials(credential_type=None, fill_in=True, **kwargs):
+def get_credentials(fill_in=True, identity_version='v2', **kwargs):
"""
Builds a credentials object based on the configured auth_version
- :param credential_type (string): requests credentials from tempest
- configuration file. Valid values are defined in
- Credentials.TYPE.
- :param kwargs (dict): take into account only if credential_type is
- not specified or None. Dict of credential key/value pairs
+ :param fill_in (boolean): obtain a token and fill in all credential
+ details provided by the identity service. When fill_in is not
+ specified, credentials are not validated. Validation can be invoked
+ by invoking ``is_valid()``
+ :param identity_version (string): identity API version is used to
+ select the matching auth provider and credentials class
+ :param kwargs (dict): Dict of credential key/value pairs
Examples:
Returns credentials from the provided parameters:
>>> get_credentials(username='foo', password='bar')
- Returns credentials from tempest configuration:
- >>> get_credentials(credential_type='user')
+ Returns credentials including IDs:
+ >>> get_credentials(username='foo', password='bar', fill_in=True)
"""
- if CONF.identity.auth_version == 'v2':
- credential_class = KeystoneV2Credentials
- auth_provider_class = KeystoneV2AuthProvider
- elif CONF.identity.auth_version == 'v3':
- credential_class = KeystoneV3Credentials
- auth_provider_class = KeystoneV3AuthProvider
- else:
- raise exceptions.InvalidConfiguration('Unsupported auth version')
- if credential_type is not None:
- creds = credential_class.get_default(credential_type)
- else:
- creds = credential_class(**kwargs)
+ if not is_identity_version_supported(identity_version):
+ raise exceptions.InvalidIdentityVersion(
+ identity_version=identity_version)
+
+ credential_class, auth_provider_class = IDENTITY_VERSION.get(
+ identity_version)
+
+ creds = credential_class(**kwargs)
# Fill in the credentials fields that were not specified
if fill_in:
auth_provider = auth_provider_class(creds)
@@ -490,18 +471,9 @@
Set of credentials for accessing OpenStack services
ATTRIBUTES: list of valid class attributes representing credentials.
-
- TYPES: types of credentials available in the configuration file.
- For each key there's a tuple (section, prefix) to match the
- configuration options.
"""
ATTRIBUTES = []
- TYPES = {
- 'identity_admin': ('identity', 'admin'),
- 'user': ('identity', None),
- 'alt_user': ('identity', 'alt')
- }
def __init__(self, **kwargs):
"""
@@ -554,21 +526,8 @@
except AttributeError:
return default
- @classmethod
- def get_default(cls, credentials_type):
- if credentials_type not in cls.TYPES:
- raise exceptions.InvalidCredentials()
- creds = cls._get_default(credentials_type)
- if not creds.is_valid():
- msg = ("The %s credentials are incorrectly set in the config file."
- " Double check that all required values are assigned" %
- credentials_type)
- raise exceptions.InvalidConfiguration(msg)
- return creds
-
- @classmethod
- def _get_default(cls, credentials_type):
- raise NotImplementedError
+ def get_init_attributes(self):
+ return self._initial.keys()
def is_valid(self):
raise NotImplementedError
@@ -584,21 +543,8 @@
class KeystoneV2Credentials(Credentials):
- CONF_ATTRIBUTES = ['username', 'password', 'tenant_name']
- ATTRIBUTES = ['user_id', 'tenant_id']
- ATTRIBUTES.extend(CONF_ATTRIBUTES)
-
- @classmethod
- def _get_default(cls, credentials_type='user'):
- params = {}
- section, prefix = cls.TYPES[credentials_type]
- for attr in cls.CONF_ATTRIBUTES:
- _section = getattr(CONF, section)
- if prefix is None:
- params[attr] = getattr(_section, attr)
- else:
- params[attr] = getattr(_section, prefix + "_" + attr)
- return cls(**params)
+ ATTRIBUTES = ['username', 'password', 'tenant_name', 'user_id',
+ 'tenant_id']
def is_valid(self):
"""
@@ -608,16 +554,15 @@
return None not in (self.username, self.password)
-class KeystoneV3Credentials(KeystoneV2Credentials):
+class KeystoneV3Credentials(Credentials):
"""
Credentials suitable for the Keystone Identity V3 API
"""
- CONF_ATTRIBUTES = ['domain_name', 'password', 'tenant_name', 'username']
- ATTRIBUTES = ['project_domain_id', 'project_domain_name', 'project_id',
+ ATTRIBUTES = ['domain_name', 'password', 'tenant_name', 'username',
+ 'project_domain_id', 'project_domain_name', 'project_id',
'project_name', 'tenant_id', 'tenant_name', 'user_domain_id',
'user_domain_name', 'user_id']
- ATTRIBUTES.extend(CONF_ATTRIBUTES)
def __init__(self, **kwargs):
"""
@@ -685,3 +630,7 @@
self.project_id is not None,
self.project_name is not None and valid_project_domain])
return all([self.password is not None, valid_user, valid_project])
+
+
+IDENTITY_VERSION = {'v2': (KeystoneV2Credentials, KeystoneV2AuthProvider),
+ 'v3': (KeystoneV3Credentials, KeystoneV3AuthProvider)}
diff --git a/tempest/cli/simple_read_only/compute/__init__.py b/tempest/cli/simple_read_only/compute/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tempest/cli/simple_read_only/compute/__init__.py
+++ /dev/null
diff --git a/tempest/cli/simple_read_only/compute/test_nova.py b/tempest/cli/simple_read_only/compute/test_nova.py
deleted file mode 100644
index aee92fa..0000000
--- a/tempest/cli/simple_read_only/compute/test_nova.py
+++ /dev/null
@@ -1,209 +0,0 @@
-# Copyright 2013 OpenStack Foundation
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# 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 decorators
-from tempest_lib import exceptions
-import testtools
-
-from tempest import cli
-from tempest import config
-from tempest.openstack.common import log as logging
-
-CONF = config.CONF
-
-LOG = logging.getLogger(__name__)
-
-
-class SimpleReadOnlyNovaClientTest(cli.ClientTestBase):
-
- """
- This is a first pass at a simple read only python-novaclient test. This
- only exercises client commands that are read only.
-
- This should test commands:
- * as a regular user
- * as a admin user
- * with and without optional parameters
- * initially just check return codes, and later test command outputs
-
- """
-
- @classmethod
- def resource_setup(cls):
- if not CONF.service_available.nova:
- msg = ("%s skipped as Nova is not available" % cls.__name__)
- raise cls.skipException(msg)
- super(SimpleReadOnlyNovaClientTest, cls).resource_setup()
-
- def nova(self, *args, **kwargs):
- return self.clients.nova(*args,
- endpoint_type=CONF.compute.endpoint_type,
- **kwargs)
-
- def test_admin_fake_action(self):
- self.assertRaises(exceptions.CommandFailed,
- self.nova,
- 'this-does-nova-exist')
-
- # NOTE(jogo): Commands in order listed in 'nova help'
-
- # Positional arguments:
-
- def test_admin_absolute_limites(self):
- self.nova('absolute-limits')
- self.nova('absolute-limits', params='--reserved')
-
- def test_admin_aggregate_list(self):
- self.nova('aggregate-list')
-
- def test_admin_availability_zone_list(self):
- self.assertIn("internal", self.nova('availability-zone-list'))
-
- def test_admin_cloudpipe_list(self):
- self.nova('cloudpipe-list')
-
- def test_admin_credentials(self):
- self.nova('credentials')
-
- @testtools.skipIf(CONF.service_available.neutron,
- "Neutron does not provide this feature")
- def test_admin_dns_domains(self):
- self.nova('dns-domains')
-
- @decorators.skip_because(bug="1157349")
- def test_admin_dns_list(self):
- self.nova('dns-list')
-
- def test_admin_endpoints(self):
- self.nova('endpoints')
-
- def test_admin_flavor_acces_list(self):
- self.assertRaises(exceptions.CommandFailed,
- self.nova,
- 'flavor-access-list')
- # Failed to get access list for public flavor type
- self.assertRaises(exceptions.CommandFailed,
- self.nova,
- 'flavor-access-list',
- params='--flavor m1.tiny')
-
- def test_admin_flavor_list(self):
- self.assertIn("Memory_MB", self.nova('flavor-list'))
-
- def test_admin_floating_ip_bulk_list(self):
- self.nova('floating-ip-bulk-list')
-
- def test_admin_floating_ip_list(self):
- self.nova('floating-ip-list')
-
- def test_admin_floating_ip_pool_list(self):
- self.nova('floating-ip-pool-list')
-
- def test_admin_host_list(self):
- self.nova('host-list')
-
- def test_admin_hypervisor_list(self):
- self.nova('hypervisor-list')
-
- def test_admin_image_list(self):
- self.nova('image-list')
-
- @decorators.skip_because(bug="1157349")
- def test_admin_interface_list(self):
- self.nova('interface-list')
-
- def test_admin_keypair_list(self):
- self.nova('keypair-list')
-
- def test_admin_list(self):
- self.nova('list')
- self.nova('list', params='--all-tenants 1')
- self.nova('list', params='--all-tenants 0')
- self.assertRaises(exceptions.CommandFailed,
- self.nova,
- 'list',
- params='--all-tenants bad')
-
- def test_admin_network_list(self):
- self.nova('network-list')
-
- def test_admin_rate_limits(self):
- self.nova('rate-limits')
-
- def test_admin_secgroup_list(self):
- self.nova('secgroup-list')
-
- @decorators.skip_because(bug="1157349")
- def test_admin_secgroup_list_rules(self):
- self.nova('secgroup-list-rules')
-
- @cli.min_client_version(client='nova', version='2.18')
- def test_admin_server_group_list(self):
- self.nova('server-group-list')
-
- def test_admin_servce_list(self):
- self.nova('service-list')
-
- def test_admin_usage(self):
- self.nova('usage')
-
- def test_admin_usage_list(self):
- self.nova('usage-list')
-
- @testtools.skipIf(not CONF.service_available.cinder,
- "Skipped as Cinder is not available")
- def test_admin_volume_list(self):
- self.nova('volume-list')
-
- @testtools.skipIf(not CONF.service_available.cinder,
- "Skipped as Cinder is not available")
- def test_admin_volume_snapshot_list(self):
- self.nova('volume-snapshot-list')
-
- @testtools.skipIf(not CONF.service_available.cinder,
- "Skipped as Cinder is not available")
- def test_admin_volume_type_list(self):
- self.nova('volume-type-list')
-
- def test_admin_help(self):
- self.nova('help')
-
- def test_admin_list_extensions(self):
- self.nova('list-extensions')
-
- def test_admin_net_list(self):
- self.nova('net-list')
-
- def test_agent_list(self):
- self.nova('agent-list')
- self.nova('agent-list', flags='--debug')
-
- def test_migration_list(self):
- self.nova('migration-list')
- self.nova('migration-list', flags='--debug')
-
- # Optional arguments:
-
- def test_admin_version(self):
- self.nova('', flags='--version')
-
- def test_admin_debug_list(self):
- self.nova('list', flags='--debug')
-
- def test_admin_timeout(self):
- self.nova('list', flags='--timeout %d' % CONF.cli.timeout)
-
- def test_admin_timing(self):
- self.nova('list', flags='--timing')
diff --git a/tempest/clients.py b/tempest/clients.py
index 03928ba..1836173 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -15,7 +15,7 @@
import copy
-from tempest import auth
+from tempest.common import cred_provider
from tempest.common import negative_rest_client
from tempest import config
from tempest import manager
@@ -155,10 +155,7 @@
}
default_params_with_timeout_values.update(default_params)
- def __init__(self, credentials=None, interface='json', service=None):
- # Set interface and client type first
- self.interface = interface
- # super cares for credentials validation
+ def __init__(self, credentials=None, service=None):
super(Manager, self).__init__(credentials=credentials)
self._set_compute_clients()
@@ -376,8 +373,8 @@
managed client objects
"""
- def __init__(self, interface='json', service=None):
+ def __init__(self, service=None):
super(AdminManager, self).__init__(
- credentials=auth.get_default_credentials('identity_admin'),
- interface=interface,
+ credentials=cred_provider.get_configured_credentials(
+ 'identity_admin'),
service=service)
diff --git a/tempest/cmd/cleanup.py b/tempest/cmd/cleanup.py
index 28992b9..c52704a 100755
--- a/tempest/cmd/cleanup.py
+++ b/tempest/cmd/cleanup.py
@@ -54,9 +54,9 @@
import json
import sys
-from tempest import auth
from tempest import clients
from tempest.cmd import cleanup_service
+from tempest.common import cred_provider
from tempest import config
from tempest.openstack.common import log as logging
@@ -159,7 +159,8 @@
kwargs = {"username": CONF.identity.admin_username,
"password": CONF.identity.admin_password,
"tenant_name": tenant['name']}
- mgr = clients.Manager(credentials=auth.get_credentials(**kwargs))
+ mgr = clients.Manager(credentials=cred_provider.get_credentials(
+ **kwargs))
kwargs = {'data': tenant_data,
'is_dry_run': is_dry_run,
'saved_state_json': None,
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 889b2dd..4af2108 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -110,6 +110,7 @@
import unittest
import netaddr
+from tempest_lib import exceptions as lib_exc
import yaml
import tempest.auth
@@ -297,7 +298,7 @@
USERS[user]['tenant_id'],
USERS[user]['id'],
role['id'])
- except exceptions.Conflict:
+ except lib_exc.Conflict:
# don't care if it's already assigned
pass
@@ -313,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/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py
index 65a3a95..87f5ca6 100755
--- a/tempest/cmd/verify_tempest_config.py
+++ b/tempest/cmd/verify_tempest_config.py
@@ -327,7 +327,7 @@
CONF_PARSER = moves.configparser.SafeConfigParser()
CONF_PARSER.optionxform = str
CONF_PARSER.readfp(conf_file)
- os = clients.AdminManager(interface='json')
+ os = clients.AdminManager()
services = check_service_availability(os, update)
results = {}
for service in ['nova', 'cinder', 'neutron', 'swift']:
diff --git a/tempest/common/accounts.py b/tempest/common/accounts.py
index 66285e4..dd8d498 100644
--- a/tempest/common/accounts.py
+++ b/tempest/common/accounts.py
@@ -17,7 +17,6 @@
import yaml
-from tempest import auth
from tempest.common import cred_provider
from tempest import config
from tempest import exceptions
@@ -109,9 +108,9 @@
def get_hash(self, creds):
for _hash in self.hash_dict:
- # Comparing on the attributes that are expected in the YAML
+ # Comparing on the attributes that were read from the YAML
if all([getattr(creds, k) == self.hash_dict[_hash][k] for k in
- creds.CONF_ATTRIBUTES]):
+ creds.get_init_attributes()]):
return _hash
raise AttributeError('Invalid credentials %s' % creds)
@@ -123,7 +122,7 @@
if self.isolated_creds.get('primary'):
return self.isolated_creds.get('primary')
creds = self._get_creds()
- primary_credential = auth.get_credentials(**creds)
+ primary_credential = cred_provider.get_credentials(**creds)
self.isolated_creds['primary'] = primary_credential
return primary_credential
@@ -131,7 +130,7 @@
if self.isolated_creds.get('alt'):
return self.isolated_creds.get('alt')
creds = self._get_creds()
- alt_credential = auth.get_credentials(**creds)
+ alt_credential = cred_provider.get_credentials(**creds)
self.isolated_creds['alt'] = alt_credential
return alt_credential
@@ -189,9 +188,10 @@
return self.isolated_creds.get('primary')
if not self.use_default_creds:
creds = self.get_creds(0)
- primary_credential = auth.get_credentials(**creds)
+ primary_credential = cred_provider.get_credentials(**creds)
else:
- primary_credential = auth.get_default_credentials('user')
+ primary_credential = cred_provider.get_configured_credentials(
+ 'user')
self.isolated_creds['primary'] = primary_credential
return primary_credential
@@ -200,9 +200,10 @@
return self.isolated_creds.get('alt')
if not self.use_default_creds:
creds = self.get_creds(1)
- alt_credential = auth.get_credentials(**creds)
+ alt_credential = cred_provider.get_credentials(**creds)
else:
- alt_credential = auth.get_default_credentials('alt_user')
+ alt_credential = cred_provider.get_configured_credentials(
+ 'alt_user')
self.isolated_creds['alt'] = alt_credential
return alt_credential
@@ -210,4 +211,5 @@
self.isolated_creds = {}
def get_admin_creds(self):
- return auth.get_default_credentials("identity_admin", fill_in=False)
+ return cred_provider.get_configured_credentials(
+ "identity_admin", fill_in=False)
diff --git a/tempest/common/cred_provider.py b/tempest/common/cred_provider.py
index c5be0c0..f40ed7a 100644
--- a/tempest/common/cred_provider.py
+++ b/tempest/common/cred_provider.py
@@ -16,17 +16,68 @@
import six
+from tempest import auth
from tempest import config
+from tempest import exceptions
from tempest.openstack.common import log as logging
CONF = config.CONF
LOG = logging.getLogger(__name__)
+# Type of credentials available from configuration
+CREDENTIAL_TYPES = {
+ 'identity_admin': ('identity', 'admin'),
+ 'user': ('identity', None),
+ 'alt_user': ('identity', 'alt')
+}
+
+
+# Read credentials from configuration, builds a Credentials object
+# based on the specified or configured version
+def get_configured_credentials(credential_type, fill_in=True,
+ identity_version=None):
+ identity_version = identity_version or CONF.identity.auth_version
+ if identity_version not in ('v2', 'v3'):
+ raise exceptions.InvalidConfiguration(
+ 'Unsupported auth version: %s' % identity_version)
+ if credential_type not in CREDENTIAL_TYPES:
+ raise exceptions.InvalidCredentials()
+ conf_attributes = ['username', 'password', 'tenant_name']
+ if identity_version == 'v3':
+ conf_attributes.append('domain_name')
+ # Read the parts of credentials from config
+ params = {}
+ section, prefix = CREDENTIAL_TYPES[credential_type]
+ for attr in conf_attributes:
+ _section = getattr(CONF, section)
+ if prefix is None:
+ params[attr] = getattr(_section, attr)
+ else:
+ params[attr] = getattr(_section, prefix + "_" + attr)
+ # Build and validate credentials. We are reading configured credentials,
+ # so validate them even if fill_in is False
+ credentials = get_credentials(fill_in=fill_in, **params)
+ if not fill_in:
+ if not credentials.is_valid():
+ msg = ("The %s credentials are incorrectly set in the config file."
+ " Double check that all required values are assigned" %
+ credential_type)
+ raise exceptions.InvalidConfiguration(msg)
+ return credentials
+
+
+# Wrapper around auth.get_credentials to use the configured identity version
+# is none is specified
+def get_credentials(fill_in=True, identity_version=None, **kwargs):
+ identity_version = identity_version or CONF.identity.auth_version
+ return auth.get_credentials(fill_in=fill_in,
+ identity_version=identity_version,
+ **kwargs)
+
@six.add_metaclass(abc.ABCMeta)
class CredentialProvider(object):
- def __init__(self, name, interface='json', password='pass',
- network_resources=None):
+ def __init__(self, name, password='pass', network_resources=None):
self.name = name
@abc.abstractmethod
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index a663931..1cfb963 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -13,8 +13,8 @@
# under the License.
import netaddr
+from tempest_lib import exceptions as lib_exc
-from tempest import auth
from tempest import clients
from tempest.common import cred_provider
from tempest.common.utils import data_utils
@@ -28,15 +28,12 @@
class IsolatedCreds(cred_provider.CredentialProvider):
- def __init__(self, name, interface='json', password='pass',
- network_resources=None):
- super(IsolatedCreds, self).__init__(name, interface, password,
- network_resources)
+ def __init__(self, name, password='pass', network_resources=None):
+ super(IsolatedCreds, self).__init__(name, password, network_resources)
self.network_resources = network_resources
self.isolated_creds = {}
self.isolated_net_resources = {}
self.ports = []
- self.interface = interface
self.password = password
self.identity_admin_client, self.network_admin_client = (
self._get_admin_clients())
@@ -48,7 +45,7 @@
identity
network
"""
- os = clients.AdminManager(interface=self.interface)
+ os = clients.AdminManager()
return os.identity_client, os.network_client
def _create_tenant(self, name, description):
@@ -81,7 +78,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'])
@@ -129,7 +126,7 @@
return self._get_credentials(user, tenant)
def _get_credentials(self, user, tenant):
- return auth.get_credentials(
+ return cred_provider.get_credentials(
username=user['name'], user_id=user['id'],
tenant_name=tenant['name'], tenant_id=tenant['id'],
password=self.password)
@@ -282,7 +279,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 +287,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 +295,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 +307,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 +323,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 +341,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 69e25e2..9aeb243 100644
--- a/tempest/common/service_client.py
+++ b/tempest/common/service_client.py
@@ -59,22 +59,14 @@
method, url,
extra_headers=extra_headers,
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)
- except lib_exceptions.Conflict as ex:
- raise exceptions.Conflict(ex)
- except lib_exceptions.OverLimit as ex:
- raise exceptions.OverLimit(ex)
# TODO(oomichi): This is just a workaround for failing gate tests
# when separating Forbidden from Unauthorized in tempest-lib.
# We will need to remove this translation and replace negative tests
# with lib_exceptions.Forbidden in the future.
except lib_exceptions.Forbidden as ex:
- raise exceptions.Unauthorized(ex)
+ raise lib_exceptions.Unauthorized(ex)
class ResponseBody(dict):
diff --git a/tempest/config.py b/tempest/config.py
index c60434a..4588b20 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -455,7 +455,13 @@
cfg.ListOpt('dns_servers',
default=["8.8.8.8", "8.8.4.4"],
help="List of dns servers which should be used"
- " for subnet creation")
+ " for subnet creation"),
+ cfg.StrOpt('port_vnic_type',
+ choices=[None, 'normal', 'direct', 'macvtap'],
+ help="vnic_type to use when Launching instances"
+ " with pre-configured ports."
+ " Supported ports are:"
+ " ['normal','direct','macvtap']"),
]
network_feature_group = cfg.OptGroup(name='network-feature-enabled',
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 7ddeeff..09f7016 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -63,6 +63,10 @@
message = "Invalid service tag"
+class InvalidIdentityVersion(TempestException):
+ message = "Invalid version %(identity_version) of the identity service"
+
+
class TimeoutException(TempestException):
message = "Request timed out"
@@ -151,26 +155,10 @@
message = "The success code is different than the expected one"
-class NotFound(RestClientException):
- message = "Object not found"
-
-
-class Unauthorized(RestClientException):
- message = 'Unauthorized'
-
-
class BadRequest(RestClientException):
message = "Bad request"
-class OverLimit(RestClientException):
- message = "Quota exceeded"
-
-
-class Conflict(RestClientException):
- message = "An object with that identifier already exists"
-
-
class ResponseWithNonEmptyBody(RFCViolation):
message = ("RFC Violation! Response with %(status)d HTTP Status Code "
"MUST NOT have a body")
diff --git a/tempest/manager.py b/tempest/manager.py
index 538b619..421d2de 100644
--- a/tempest/manager.py
+++ b/tempest/manager.py
@@ -14,6 +14,7 @@
# under the License.
from tempest import auth
+from tempest.common import cred_provider
from tempest import config
from tempest import exceptions
@@ -39,7 +40,7 @@
"""
self.auth_version = CONF.identity.auth_version
if credentials is None:
- self.credentials = auth.get_default_credentials('user')
+ self.credentials = cred_provider.get_configured_credentials('user')
else:
self.credentials = credentials
# Check if passed or default credentials are valid
@@ -63,5 +64,4 @@
'Credentials must be specified')
auth_provider_class = self.get_auth_provider_class(credentials)
return auth_provider_class(
- interface=getattr(self, 'interface', None),
credentials=credentials)
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 8e9f3ea..7da7b12 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -19,9 +19,10 @@
import netaddr
import six
+from tempest_lib import exceptions as lib_exc
-from tempest import auth
from tempest import clients
+from tempest.common import cred_provider
from tempest.common import credentials
from tempest.common.utils import data_utils
from tempest.common.utils.linux import remote_client
@@ -110,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
@@ -628,7 +629,7 @@
try:
result = client.create_subnet(**subnet)
break
- except exceptions.Conflict as e:
+ except lib_exc.Conflict as e:
is_overlapping_cidr = 'overlaps with another subnet' in str(e)
if not is_overlapping_cidr:
raise
@@ -639,14 +640,15 @@
self.addCleanup(self.delete_wrapper, subnet.delete)
return subnet
- def _create_port(self, network, client=None, namestart='port-quotatest'):
+ def _create_port(self, network_id, client=None, namestart='port-quotatest',
+ **kwargs):
if not client:
client = self.network_client
name = data_utils.rand_name(namestart)
result = client.create_port(
name=name,
- network_id=network.id,
- tenant_id=network.tenant_id)
+ network_id=network_id,
+ **kwargs)
self.assertIsNotNone(result, 'Unable to allocate port')
port = net_resources.DeletablePort(client=client,
**result['port'])
@@ -915,7 +917,7 @@
try:
sg_rule = self._create_security_group_rule(
client=client, secgroup=secgroup, **ruleset)
- except exceptions.Conflict as ex:
+ except lib_exc.Conflict as ex:
# if rule already exist - skip rule and continue
msg = 'Security group rule already exists'
if msg not in ex._error_string:
@@ -1047,6 +1049,66 @@
subnet.add_to_router(router.id)
return network, subnet, router
+ def create_server(self, name=None, image=None, flavor=None,
+ wait_on_boot=True, wait_on_delete=True,
+ create_kwargs=None):
+ vnic_type = CONF.network.port_vnic_type
+
+ # If vnic_type is configured create port for
+ # every network
+ if vnic_type:
+ ports = []
+ networks = []
+ create_port_body = {'binding:vnic_type': vnic_type,
+ 'namestart': 'port-smoke'}
+ if create_kwargs:
+ net_client = create_kwargs.get("network_client",
+ self.network_client)
+
+ # Convert security group names to security group ids
+ # to pass to create_port
+ if create_kwargs.get('security_groups'):
+ security_groups = net_client.list_security_groups().get(
+ 'security_groups')
+ sec_dict = dict([(s['name'], s['id'])
+ for s in security_groups])
+
+ sec_groups_names = [s['name'] for s in create_kwargs[
+ 'security_groups']]
+ security_groups_ids = [sec_dict[s]
+ for s in sec_groups_names]
+
+ if security_groups_ids:
+ create_port_body[
+ 'security_groups'] = security_groups_ids
+ networks = create_kwargs.get('networks')
+ else:
+ net_client = self.network_client
+ # If there are no networks passed to us we look up
+ # for the tenant's private networks and create a port
+ # if there is only one private network. The same behaviour
+ # as we would expect when passing the call to the clients
+ # with no networks
+ if not networks:
+ networks = net_client.list_networks(filters={
+ 'router:external': False})
+ self.assertEqual(1, len(networks),
+ "There is more than one"
+ " network for the tenant")
+ for net in networks:
+ net_id = net['uuid']
+ port = self._create_port(network_id=net_id,
+ client=net_client,
+ **create_port_body)
+ ports.append({'port': port.id})
+ if ports:
+ create_kwargs['networks'] = ports
+
+ return super(NetworkScenarioTest, self).create_server(
+ name=name, image=image, flavor=flavor,
+ wait_on_boot=wait_on_boot, wait_on_delete=wait_on_delete,
+ create_kwargs=create_kwargs)
+
# power/provision states as of icehouse
class BaremetalPowerStates(object):
@@ -1124,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
@@ -1259,8 +1321,9 @@
@classmethod
def credentials(cls):
- admin_creds = auth.get_default_credentials('identity_admin')
- creds = auth.get_default_credentials('user')
+ admin_creds = cred_provider.get_configured_credentials(
+ 'identity_admin')
+ creds = cred_provider.get_configured_credentials('user')
admin_creds.tenant_name = creds.tenant_name
return admin_creds
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_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index fc174cd..ae326c4 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -381,6 +381,9 @@
@testtools.skipUnless(CONF.compute_feature_enabled.interface_attach,
'NIC hotplug not available')
+ @testtools.skipIf(CONF.network.port_vnic_type in ['direct', 'macvtap'],
+ 'NIC hotplug not supported for '
+ 'vnic_type direct or macvtap')
@test.attr(type='smoke')
@test.services('compute', 'network')
def test_hotplug_nic(self):
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index 83739fd..55ab18f 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -238,7 +238,8 @@
],
'key_name': tenant.keypair['name'],
'security_groups': security_groups_names,
- 'tenant_id': tenant.creds.tenant_id
+ 'tenant_id': tenant.creds.tenant_id,
+ 'network_client': tenant.manager.network_client
}
server = self.create_server(name=name, create_kwargs=create_kwargs)
self.assertEqual(
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/scenario/utils.py b/tempest/scenario/utils.py
index f997a65..061f5c8 100644
--- a/tempest/scenario/utils.py
+++ b/tempest/scenario/utils.py
@@ -21,8 +21,8 @@
import testscenarios
import testtools
-from tempest import auth
from tempest import clients
+from tempest.common import cred_provider
from tempest.common.utils import misc
from tempest import config
from tempest import exceptions
@@ -101,7 +101,7 @@
def __init__(self):
os = clients.Manager(
- auth.get_default_credentials('user', fill_in=False))
+ cred_provider.get_configured_credentials('user', fill_in=False))
self.images_client = os.images_client
self.flavors_client = os.flavors_client
self.image_pattern = CONF.input_scenario.image_regex
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/database/json/limits_client.py b/tempest/services/database/json/limits_client.py
index 4daf028..6168bfd 100644
--- a/tempest/services/database/json/limits_client.py
+++ b/tempest/services/database/json/limits_client.py
@@ -15,11 +15,8 @@
import urllib
-from tempest import config
from tempest_lib.common import rest_client
-CONF = config.CONF
-
class DatabaseLimitsClientJSON(rest_client.RestClient):
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/identity/json/token_client.py b/tempest/services/identity/json/token_client.py
index 93936bc..1e8b31e 100644
--- a/tempest/services/identity/json/token_client.py
+++ b/tempest/services/identity/json/token_client.py
@@ -13,6 +13,7 @@
# under the License.
import json
+from tempest_lib import exceptions as lib_exc
from tempest.common import service_client
from tempest import config
@@ -87,7 +88,7 @@
if resp.status in [401, 403]:
resp_body = json.loads(resp_body)
- raise exceptions.Unauthorized(resp_body['error']['message'])
+ raise lib_exc.Unauthorized(resp_body['error']['message'])
elif resp.status not in [200, 201]:
raise exceptions.IdentityError(
'Unexpected status code {0}'.format(resp.status))
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index f3d9d2d..95c52bf 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -17,11 +17,8 @@
import urllib
from tempest.common import service_client
-from tempest import config
from tempest.services.identity.v3.json import base
-CONF = config.CONF
-
class IdentityV3ClientJSON(base.IdentityV3Client):
diff --git a/tempest/services/identity/v3/json/token_client.py b/tempest/services/identity/v3/json/token_client.py
index 14c4a0a..1467d7c 100644
--- a/tempest/services/identity/v3/json/token_client.py
+++ b/tempest/services/identity/v3/json/token_client.py
@@ -13,6 +13,7 @@
# under the License.
import json
+from tempest_lib import exceptions as lib_exc
from tempest.common import service_client
from tempest import config
@@ -112,7 +113,7 @@
if resp.status in [401, 403]:
resp_body = json.loads(resp_body)
- raise exceptions.Unauthorized(resp_body['error']['message'])
+ raise lib_exc.Unauthorized(resp_body['error']['message'])
elif resp.status not in [200, 201, 204]:
raise exceptions.IdentityError(
'Unexpected status code {0}'.format(resp.status))
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
diff --git a/tempest/stress/driver.py b/tempest/stress/driver.py
index 49fac3d..1c27815 100644
--- a/tempest/stress/driver.py
+++ b/tempest/stress/driver.py
@@ -19,8 +19,8 @@
from six import moves
-from tempest import auth
from tempest import clients
+from tempest.common import cred_provider
from tempest.common import ssh
from tempest.common.utils import data_utils
from tempest import config
@@ -148,9 +148,9 @@
password,
tenant['id'],
"email")
- creds = auth.get_credentials(username=username,
- password=password,
- tenant_name=tenant_name)
+ creds = cred_provider.get_credentials(username=username,
+ password=password,
+ tenant_name=tenant_name)
manager = clients.Manager(credentials=creds)
test_obj = importutils.import_class(test['action'])
diff --git a/tempest/test.py b/tempest/test.py
index 28e1e2c..0c9cbfd 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -359,7 +359,7 @@
level=None))
@classmethod
- def get_client_manager(cls, interface=None):
+ def get_client_manager(cls):
"""
Returns an OpenStack client manager
"""
@@ -373,12 +373,7 @@
)
creds = cls.isolated_creds.get_primary_creds()
- params = dict(credentials=creds, service=cls._service)
- if getattr(cls, '_interface', None):
- interface = cls._interface
- if interface:
- params['interface'] = interface
- os = clients.Manager(**params)
+ os = clients.Manager(credentials=creds, service=cls._service)
return os
@classmethod
@@ -394,8 +389,7 @@
"""
Returns an instance of the Identity Admin API client
"""
- os = clients.AdminManager(interface=cls._interface,
- service=cls._service)
+ os = clients.AdminManager(service=cls._service)
admin_client = os.identity_client
return admin_client
@@ -436,8 +430,7 @@
super(NegativeAutoTest, cls).setUpClass()
os = cls.get_client_manager()
cls.client = os.negative_client
- os_admin = clients.AdminManager(interface=cls._interface,
- service=cls._service)
+ os_admin = clients.AdminManager(service=cls._service)
cls.admin_client = os_admin.negative_client
@staticmethod
diff --git a/tempest/tests/common/test_cred_provider.py b/tempest/tests/common/test_cred_provider.py
new file mode 100644
index 0000000..160ecaa
--- /dev/null
+++ b/tempest/tests/common/test_cred_provider.py
@@ -0,0 +1,97 @@
+# Copyright 2015 Hewlett-Packard Development Company, L.P.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# 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 oslo.config import cfg
+
+from tempest import auth
+from tempest.common import cred_provider
+from tempest.common import tempest_fixtures as fixtures
+from tempest.services.identity.json import token_client as v2_client
+from tempest.services.identity.v3.json import token_client as v3_client
+from tempest.tests import fake_identity
+# Note: eventually the auth module will move to tempest-lib, and so wil its
+# unit tests. *CredentialsTests will be imported from tempest-lib then.
+from tempest.tests import test_credentials as test_creds
+
+
+class ConfiguredV2CredentialsTests(test_creds.CredentialsTests):
+ attributes = {
+ 'username': 'fake_username',
+ 'password': 'fake_password',
+ 'tenant_name': 'fake_tenant_name'
+ }
+
+ identity_response = fake_identity._fake_v2_response
+ credentials_class = auth.KeystoneV2Credentials
+ tokenclient_class = v2_client.TokenClientJSON
+ identity_version = 'v2'
+
+ def setUp(self):
+ super(ConfiguredV2CredentialsTests, self).setUp()
+ self.stubs.Set(self.tokenclient_class, 'raw_request',
+ self.identity_response)
+
+ def _verify_credentials(self, credentials_class, filled=True,
+ identity_version=None):
+ for ctype in cred_provider.CREDENTIAL_TYPES:
+ if identity_version is None:
+ creds = cred_provider.get_configured_credentials(
+ credential_type=ctype, fill_in=filled)
+ else:
+ creds = cred_provider.get_configured_credentials(
+ credential_type=ctype, fill_in=filled,
+ identity_version=identity_version)
+ self._check(creds, credentials_class, filled)
+
+ def test_get_configured_credentials(self):
+ self.useFixture(fixtures.LockFixture('auth_version'))
+ self._verify_credentials(credentials_class=self.credentials_class)
+
+ def test_get_configured_credentials_unfilled(self):
+ self.useFixture(fixtures.LockFixture('auth_version'))
+ self._verify_credentials(credentials_class=self.credentials_class,
+ filled=False)
+
+ def test_get_configured_credentials_version(self):
+ # version specified and not loaded from config
+ self.useFixture(fixtures.LockFixture('auth_version'))
+ self._verify_credentials(credentials_class=self.credentials_class,
+ identity_version=self.identity_version)
+
+ def test_is_valid(self):
+ creds = self._get_credentials()
+ self.assertTrue(creds.is_valid())
+
+
+class ConfiguredV3CredentialsTests(ConfiguredV2CredentialsTests):
+ attributes = {
+ 'username': 'fake_username',
+ 'password': 'fake_password',
+ 'project_name': 'fake_project_name',
+ 'user_domain_name': 'fake_domain_name'
+ }
+
+ credentials_class = auth.KeystoneV3Credentials
+ identity_response = fake_identity._fake_v3_response
+ tokenclient_class = v3_client.V3TokenClientJSON
+ identity_version = 'v3'
+
+ def setUp(self):
+ super(ConfiguredV3CredentialsTests, self).setUp()
+ # Additional config items reset by cfg fixture after each test
+ cfg.CONF.set_default('auth_version', 'v3', group='identity')
+ # Identity group items
+ for prefix in ['', 'alt_', 'admin_']:
+ cfg.CONF.set_default(prefix + 'domain_name', 'fake_domain_name',
+ group='identity')
diff --git a/tempest/tests/negative/test_negative_auto_test.py b/tempest/tests/negative/test_negative_auto_test.py
index fb1da43..7a127cd 100644
--- a/tempest/tests/negative/test_negative_auto_test.py
+++ b/tempest/tests/negative/test_negative_auto_test.py
@@ -21,7 +21,6 @@
class TestNegativeAutoTest(base.TestCase):
# Fake entries
- _interface = 'json'
_service = 'compute'
fake_input_desc = {"name": "list-flavors-with-detail",
diff --git a/tempest/tests/test_auth.py b/tempest/tests/test_auth.py
index 90bb8a7..0317ad6 100644
--- a/tempest/tests/test_auth.py
+++ b/tempest/tests/test_auth.py
@@ -30,11 +30,7 @@
from tempest.tests import fake_identity
-def fake_get_default_credentials(credential_type, fill_in=True):
- return fake_credentials.FakeCredentials()
-
-
-def fake_get_credentials(credential_type=None, fill_in=True, **kwargs):
+def fake_get_credentials(fill_in=True, identity_version='v2', **kwargs):
return fake_credentials.FakeCredentials()
@@ -54,8 +50,6 @@
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(auth, 'get_credentials', fake_get_credentials)
- self.stubs.Set(auth, 'get_default_credentials',
- fake_get_default_credentials)
self.auth_provider = self._auth(self.credentials)
@@ -87,11 +81,6 @@
def test_check_credentials_bad_type(self):
self.assertFalse(self.auth_provider.check_credentials([]))
- def test_instantiate_with_dict(self):
- # Dict credentials are only supported for backward compatibility
- auth_provider = self._auth(credentials={})
- self.assertIsInstance(auth_provider.credentials, auth.Credentials)
-
def test_auth_data_property_when_cache_exists(self):
self.auth_provider.cache = 'foo'
self.useFixture(mockpatch.PatchObject(self.auth_provider,
diff --git a/tempest/tests/test_credentials.py b/tempest/tests/test_credentials.py
index 6e447d6..7621f6e 100644
--- a/tempest/tests/test_credentials.py
+++ b/tempest/tests/test_credentials.py
@@ -15,8 +15,6 @@
import copy
-from oslo.config import cfg
-
from tempest import auth
from tempest.common import tempest_fixtures as fixtures
from tempest import config
@@ -37,6 +35,18 @@
attributes = self.attributes
return self.credentials_class(**attributes)
+ def _check(self, credentials, credentials_class, filled):
+ # Check the right version of credentials has been returned
+ self.assertIsInstance(credentials, credentials_class)
+ # Check the id attributes are filled in
+ attributes = [x for x in credentials.ATTRIBUTES if (
+ '_id' in x and x != 'domain_id')]
+ for attr in attributes:
+ if filled:
+ self.assertIsNotNone(getattr(credentials, attr))
+ else:
+ self.assertIsNone(getattr(credentials, attr))
+
def setUp(self):
super(CredentialsTests, self).setUp()
self.useFixture(fake_config.ConfigFixture())
@@ -51,18 +61,6 @@
self._get_credentials,
attributes=dict(invalid='fake'))
- def test_default(self):
- self.useFixture(fixtures.LockFixture('auth_version'))
- for ctype in self.credentials_class.TYPES:
- self.assertRaises(NotImplementedError,
- self.credentials_class.get_default,
- credentials_type=ctype)
-
- def test_invalid_default(self):
- self.assertRaises(exceptions.InvalidCredentials,
- auth.Credentials.get_default,
- credentials_type='invalid_type')
-
def test_is_valid(self):
creds = self._get_credentials()
self.assertRaises(NotImplementedError, creds.is_valid)
@@ -78,39 +76,18 @@
identity_response = fake_identity._fake_v2_response
credentials_class = auth.KeystoneV2Credentials
tokenclient_class = v2_client.TokenClientJSON
+ identity_version = 'v2'
def setUp(self):
super(KeystoneV2CredentialsTests, self).setUp()
self.stubs.Set(self.tokenclient_class, 'raw_request',
self.identity_response)
- def _verify_credentials(self, credentials_class, filled=True,
- creds_dict=None):
-
- def _check(credentials):
- # Check the right version of credentials has been returned
- self.assertIsInstance(credentials, credentials_class)
- # Check the id attributes are filled in
- attributes = [x for x in credentials.ATTRIBUTES if (
- '_id' in x and x != 'domain_id')]
- for attr in attributes:
- if filled:
- self.assertIsNotNone(getattr(credentials, attr))
- else:
- self.assertIsNone(getattr(credentials, attr))
-
- if creds_dict is None:
- for ctype in auth.Credentials.TYPES:
- creds = auth.get_default_credentials(credential_type=ctype,
- fill_in=filled)
- _check(creds)
- else:
- creds = auth.get_credentials(fill_in=filled, **creds_dict)
- _check(creds)
-
- def test_get_default_credentials(self):
- self.useFixture(fixtures.LockFixture('auth_version'))
- self._verify_credentials(credentials_class=self.credentials_class)
+ def _verify_credentials(self, credentials_class, creds_dict, filled=True):
+ creds = auth.get_credentials(fill_in=filled,
+ identity_version=self.identity_version,
+ **creds_dict)
+ self._check(creds, credentials_class, filled)
def test_get_credentials(self):
self.useFixture(fixtures.LockFixture('auth_version'))
@@ -120,8 +97,8 @@
def test_get_credentials_not_filled(self):
self.useFixture(fixtures.LockFixture('auth_version'))
self._verify_credentials(credentials_class=self.credentials_class,
- filled=False,
- creds_dict=self.attributes)
+ creds_dict=self.attributes,
+ filled=False)
def test_is_valid(self):
creds = self._get_credentials()
@@ -144,15 +121,6 @@
# credential requirements
self._test_is_not_valid('tenant_name')
- def test_default(self):
- self.useFixture(fixtures.LockFixture('auth_version'))
- for ctype in self.credentials_class.TYPES:
- creds = self.credentials_class.get_default(credentials_type=ctype)
- for attr in self.attributes.keys():
- # Default configuration values related to credentials
- # are defined as fake_* in fake_config.py
- self.assertEqual(getattr(creds, attr), 'fake_' + attr)
-
def test_reset_all_attributes(self):
creds = self._get_credentials()
initial_creds = copy.deepcopy(creds)
@@ -189,28 +157,7 @@
credentials_class = auth.KeystoneV3Credentials
identity_response = fake_identity._fake_v3_response
tokenclient_class = v3_client.V3TokenClientJSON
-
- def setUp(self):
- super(KeystoneV3CredentialsTests, self).setUp()
- # Additional config items reset by cfg fixture after each test
- cfg.CONF.set_default('auth_version', 'v3', group='identity')
- # Identity group items
- for prefix in ['', 'alt_', 'admin_']:
- cfg.CONF.set_default(prefix + 'domain_name', 'fake_domain_name',
- group='identity')
-
- def test_default(self):
- self.useFixture(fixtures.LockFixture('auth_version'))
- for ctype in self.credentials_class.TYPES:
- creds = self.credentials_class.get_default(credentials_type=ctype)
- for attr in self.attributes.keys():
- if attr == 'project_name':
- config_value = 'fake_tenant_name'
- elif attr == 'user_domain_name':
- config_value = 'fake_domain_name'
- else:
- config_value = 'fake_' + attr
- self.assertEqual(getattr(creds, attr), config_value)
+ identity_version = 'v3'
def test_is_not_valid(self):
# NOTE(mtreinish) For a Keystone V3 credential object a project name