Merge "clear dict post cleanup in clear_isolated_creds"
diff --git a/HACKING.rst b/HACKING.rst
index 607682b..81a7c2c 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -13,6 +13,7 @@
- [T104] Scenario tests require a services decorator
- [T105] Tests cannot use setUpClass/tearDownClass
- [T106] vim configuration should not be kept in source files.
+- [T107] Check that a service tag isn't in the module path
- [N322] Method's default argument shouldn't be mutable
Test Data/Configuration
diff --git a/tempest/api/baremetal/admin/base.py b/tempest/api/baremetal/admin/base.py
index 1e9b308..4f5c6c8 100644
--- a/tempest/api/baremetal/admin/base.py
+++ b/tempest/api/baremetal/admin/base.py
@@ -53,9 +53,8 @@
"""Base class for Baremetal API tests."""
@classmethod
- def resource_setup(cls):
- super(BaseBaremetalTest, cls).resource_setup()
-
+ def skip_checks(cls):
+ super(BaseBaremetalTest, cls).skip_checks()
if not CONF.service_available.ironic:
skip_msg = ('%s skipped as Ironic is not available' % cls.__name__)
raise cls.skipException(skip_msg)
@@ -65,10 +64,22 @@
'testing.' %
(cls.__name__, CONF.baremetal.driver))
raise cls.skipException(skip_msg)
- cls.driver = CONF.baremetal.driver
- mgr = clients.AdminManager()
- cls.client = mgr.baremetal_client
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseBaremetalTest, cls).setup_credentials()
+ cls.mgr = clients.AdminManager()
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseBaremetalTest, cls).setup_clients()
+ cls.client = cls.mgr.baremetal_client
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseBaremetalTest, cls).resource_setup()
+
+ cls.driver = CONF.baremetal.driver
cls.power_timeout = CONF.baremetal.power_timeout
cls.created_objects = {}
for resource in RESOURCE_TYPES:
diff --git a/tempest/api/baremetal/admin/test_ports_negative.py b/tempest/api/baremetal/admin/test_ports_negative.py
index dd19edc..8dbdedf 100644
--- a/tempest/api/baremetal/admin/test_ports_negative.py
+++ b/tempest/api/baremetal/admin/test_ports_negative.py
@@ -14,7 +14,6 @@
from tempest.api.baremetal.admin import base
from tempest.common.utils import data_utils
-from tempest import exceptions as exc
from tempest import test
@@ -32,19 +31,19 @@
node_id = self.node['uuid']
address = 'malformed:mac'
- self.assertRaises(exc.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_port, node_id=node_id, address=address)
@test.attr(type=['negative', 'smoke'])
def test_create_port_nonexsistent_node_id(self):
node_id = str(data_utils.rand_uuid())
address = data_utils.rand_mac_address()
- self.assertRaises(exc.BadRequest, self.create_port, node_id=node_id,
- address=address)
+ self.assertRaises(lib_exc.BadRequest, self.create_port,
+ node_id=node_id, address=address)
@test.attr(type=['negative', 'smoke'])
def test_show_port_malformed_uuid(self):
- self.assertRaises(exc.BadRequest, self.client.show_port,
+ self.assertRaises(lib_exc.BadRequest, self.client.show_port,
'malformed:uuid')
@test.attr(type=['negative', 'smoke'])
@@ -54,7 +53,7 @@
@test.attr(type=['negative', 'smoke'])
def test_show_port_by_mac_not_allowed(self):
- self.assertRaises(exc.BadRequest, self.client.show_port,
+ self.assertRaises(lib_exc.BadRequest, self.client.show_port,
data_utils.rand_mac_address())
@test.attr(type=['negative', 'smoke'])
@@ -71,15 +70,15 @@
def test_create_port_no_mandatory_field_node_id(self):
address = data_utils.rand_mac_address()
- self.assertRaises(exc.BadRequest, self.create_port, node_id=None,
+ self.assertRaises(lib_exc.BadRequest, self.create_port, node_id=None,
address=address)
@test.attr(type=['negative', 'smoke'])
def test_create_port_no_mandatory_field_mac(self):
node_id = self.node['uuid']
- self.assertRaises(exc.BadRequest, self.create_port, node_id=node_id,
- address=None)
+ self.assertRaises(lib_exc.BadRequest, self.create_port,
+ node_id=node_id, address=None)
@test.attr(type=['negative', 'smoke'])
def test_create_port_malformed_port_uuid(self):
@@ -87,13 +86,13 @@
address = data_utils.rand_mac_address()
uuid = 'malformed:uuid'
- self.assertRaises(exc.BadRequest, self.create_port, node_id=node_id,
- address=address, uuid=uuid)
+ self.assertRaises(lib_exc.BadRequest, self.create_port,
+ node_id=node_id, address=address, uuid=uuid)
@test.attr(type=['negative', 'smoke'])
def test_create_port_malformed_node_id(self):
address = data_utils.rand_mac_address()
- self.assertRaises(exc.BadRequest, self.create_port,
+ self.assertRaises(lib_exc.BadRequest, self.create_port,
node_id='malformed:nodeid', address=address)
@test.attr(type=['negative', 'smoke'])
@@ -117,7 +116,7 @@
'op': 'replace',
'value': 'new-value'}]
- self.assertRaises(exc.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_port, address,
patch)
@@ -147,7 +146,7 @@
self.create_port(node_id=node_id, address=address)
new_address = data_utils.rand_mac_address()
- self.assertRaises(exc.BadRequest, self.client.update_port,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_port,
uuid='malformed:uuid',
patch=[{'path': '/address', 'op': 'replace',
'value': new_address}])
@@ -160,7 +159,7 @@
_, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
- self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_port, port_id,
[{'path': '/nonexistent', ' op': 'add',
'value': 'value'}])
@@ -175,7 +174,7 @@
patch = [{'path': '/node_uuid',
'op': 'replace',
'value': 'malformed:node_uuid'}]
- self.assertRaises(exc.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_port, port_id, patch)
@test.attr(type=['negative', 'smoke'])
@@ -206,7 +205,7 @@
patch = [{'path': '/node_uuid',
'op': 'replace',
'value': data_utils.rand_uuid()}]
- self.assertRaises(exc.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_port, port_id, patch)
@test.attr(type=['negative', 'smoke'])
@@ -221,7 +220,7 @@
'op': 'replace',
'value': 'malformed:mac'}]
- self.assertRaises(exc.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_port, port_id, patch)
@test.attr(type=['negative', 'smoke'])
@@ -234,7 +233,7 @@
patch = [{'path': '/nonexistent', ' op': 'replace', 'value': 'value'}]
- self.assertRaises(exc.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_port, port_id, patch)
@test.attr(type=['negative', 'smoke'])
@@ -245,7 +244,7 @@
_, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
- self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_port, port_id,
[{'path': '/address', 'op': 'remove'}])
@test.attr(type=['negative', 'smoke'])
@@ -256,7 +255,7 @@
_, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
- self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_port, port_id,
[{'path': '/uuid', 'op': 'remove'}])
@test.attr(type=['negative', 'smoke'])
@@ -267,7 +266,7 @@
_, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
- self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_port, port_id,
[{'path': '/nonexistent', 'op': 'remove'}])
@test.attr(type=['negative', 'smoke'])
@@ -276,7 +275,7 @@
address = data_utils.rand_mac_address()
self.create_port(node_id=node_id, address=address)
- self.assertRaises(exc.BadRequest, self.client.delete_port, address)
+ self.assertRaises(lib_exc.BadRequest, self.client.delete_port, address)
@test.attr(type=['negative', 'smoke'])
def test_update_port_mixed_ops_integrity(self):
@@ -306,7 +305,7 @@
'op': 'replace',
'value': 'value'}]
- self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_port, port_id,
patch)
# patch should not be applied
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index dd40145..2bf2b82 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -204,8 +204,8 @@
self.addCleanup(self.client.remove_host, aggregate['id'], self.host)
server_name = data_utils.rand_name('test_server_')
admin_servers_client = self.os_adm.servers_client
- resp, server = self.create_test_server(name=server_name,
- availability_zone=az_name,
- wait_until='ACTIVE')
- resp, body = admin_servers_client.get_server(server['id'])
+ server = self.create_test_server(name=server_name,
+ availability_zone=az_name,
+ wait_until='ACTIVE')
+ body = admin_servers_client.get_server(server['id'])
self.assertEqual(self.host, body[self._host_key])
diff --git a/tempest/api/compute/admin/test_aggregates_negative.py b/tempest/api/compute/admin/test_aggregates_negative.py
index 48f6f94..fd44f7f 100644
--- a/tempest/api/compute/admin/test_aggregates_negative.py
+++ b/tempest/api/compute/admin/test_aggregates_negative.py
@@ -18,7 +18,6 @@
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
@@ -52,7 +51,7 @@
@test.attr(type=['negative', 'gate'])
def test_aggregate_create_aggregate_name_length_less_than_1(self):
# the length of aggregate name should >= 1 and <=255
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_aggregate,
name='')
@@ -60,7 +59,7 @@
def test_aggregate_create_aggregate_name_length_exceeds_255(self):
# the length of aggregate name should >= 1 and <=255
aggregate_name = 'a' * 256
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_aggregate,
name=aggregate_name)
diff --git a/tempest/api/compute/admin/test_availability_zone.py b/tempest/api/compute/admin/test_availability_zone.py
index e88fecb..909f0a5 100644
--- a/tempest/api/compute/admin/test_availability_zone.py
+++ b/tempest/api/compute/admin/test_availability_zone.py
@@ -31,14 +31,11 @@
@test.attr(type='gate')
def test_get_availability_zone_list(self):
# List of availability zone
- resp, availability_zone = self.client.get_availability_zone_list()
- self.assertEqual(200, resp.status)
+ availability_zone = self.client.get_availability_zone_list()
self.assertTrue(len(availability_zone) > 0)
@test.attr(type='gate')
def test_get_availability_zone_list_detail(self):
# List of availability zones and available services
- resp, availability_zone = \
- self.client.get_availability_zone_list_detail()
- self.assertEqual(200, resp.status)
+ availability_zone = self.client.get_availability_zone_list_detail()
self.assertTrue(len(availability_zone) > 0)
diff --git a/tempest/api/compute/admin/test_baremetal_nodes.py b/tempest/api/compute/admin/test_baremetal_nodes.py
new file mode 100644
index 0000000..d894de6
--- /dev/null
+++ b/tempest/api/compute/admin/test_baremetal_nodes.py
@@ -0,0 +1,43 @@
+# Copyright 2015 NEC Corporation. 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.api.compute import base
+from tempest import config
+from tempest import test
+
+CONF = config.CONF
+
+
+class BaremetalNodesAdminTestJSON(base.BaseV2ComputeAdminTest):
+ """
+ Tests Baremetal API
+ """
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaremetalNodesAdminTestJSON, cls).resource_setup()
+ if not CONF.service_available.ironic:
+ skip_msg = ('%s skipped as Ironic is not available' % cls.__name__)
+ raise cls.skipException(skip_msg)
+ cls.client = cls.os_adm.baremetal_nodes_client
+
+ @test.attr(type='smoke')
+ def test_list_baremetal_nodes(self):
+ # List all baremetal nodes.
+ baremetal_nodes = self.client.list_baremetal_nodes()
+ self.assertNotEmpty(baremetal_nodes, "No baremetal nodes found.")
+
+ for node in baremetal_nodes:
+ baremetal_node = self.client.get_baremetal_node(node['id'])
+ self.assertEqual(node['id'], baremetal_node['id'])
diff --git a/tempest/api/compute/admin/test_fixed_ips.py b/tempest/api/compute/admin/test_fixed_ips.py
index d1d13a0..078fe08 100644
--- a/tempest/api/compute/admin/test_fixed_ips.py
+++ b/tempest/api/compute/admin/test_fixed_ips.py
@@ -29,8 +29,8 @@
msg = ("%s skipped as neutron is available" % cls.__name__)
raise cls.skipException(msg)
cls.client = cls.os_adm.fixed_ips_client
- resp, server = cls.create_test_server(wait_until='ACTIVE')
- resp, server = cls.servers_client.get_server(server['id'])
+ server = cls.create_test_server(wait_until='ACTIVE')
+ server = cls.servers_client.get_server(server['id'])
for ip_set in server['addresses']:
for ip in server['addresses'][ip_set]:
if ip['OS-EXT-IPS:type'] == 'fixed':
@@ -42,19 +42,17 @@
@test.attr(type='gate')
@test.services('network')
def test_list_fixed_ip_details(self):
- resp, fixed_ip = self.client.get_fixed_ip_details(self.ip)
+ fixed_ip = self.client.get_fixed_ip_details(self.ip)
self.assertEqual(fixed_ip['address'], self.ip)
@test.attr(type='gate')
@test.services('network')
def test_set_reserve(self):
body = {"reserve": "None"}
- resp, body = self.client.reserve_fixed_ip(self.ip, body)
- self.assertEqual(resp.status, 202)
+ self.client.reserve_fixed_ip(self.ip, body)
@test.attr(type='gate')
@test.services('network')
def test_set_unreserve(self):
body = {"unreserve": "None"}
- resp, body = self.client.reserve_fixed_ip(self.ip, body)
- self.assertEqual(resp.status, 202)
+ self.client.reserve_fixed_ip(self.ip, body)
diff --git a/tempest/api/compute/admin/test_fixed_ips_negative.py b/tempest/api/compute/admin/test_fixed_ips_negative.py
index bb5fa8c..f717291 100644
--- a/tempest/api/compute/admin/test_fixed_ips_negative.py
+++ b/tempest/api/compute/admin/test_fixed_ips_negative.py
@@ -16,7 +16,6 @@
from tempest.api.compute import base
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -32,8 +31,8 @@
raise cls.skipException(msg)
cls.client = cls.os_adm.fixed_ips_client
cls.non_admin_client = cls.fixed_ips_client
- resp, server = cls.create_test_server(wait_until='ACTIVE')
- resp, server = cls.servers_client.get_server(server['id'])
+ server = cls.create_test_server(wait_until='ACTIVE')
+ server = cls.servers_client.get_server(server['id'])
for ip_set in server['addresses']:
for ip in server['addresses'][ip_set]:
if ip['OS-EXT-IPS:type'] == 'fixed':
@@ -73,7 +72,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((lib_exc.NotFound, exceptions.BadRequest),
+ self.assertRaises((lib_exc.NotFound, lib_exc.BadRequest),
self.client.reserve_fixed_ip,
"my.invalid.ip", body)
@@ -81,6 +80,6 @@
@test.services('network')
def test_fixed_ip_with_invalid_action(self):
body = {"invalid_action": "None"}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.reserve_fixed_ip,
self.ip, body)
diff --git a/tempest/api/compute/admin/test_flavors.py b/tempest/api/compute/admin/test_flavors.py
index 360bcf7..8d5c5e3 100644
--- a/tempest/api/compute/admin/test_flavors.py
+++ b/tempest/api/compute/admin/test_flavors.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
@@ -210,7 +210,7 @@
self.addCleanup(self.flavor_clean_up, flavor['id'])
# Verify flavor is not used by other user
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.os.servers_client.create_server,
'test', self.image_ref, flavor['id'])
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 e414973..c22602a 100644
--- a/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
+++ b/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
@@ -18,7 +18,6 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -110,7 +109,7 @@
@test.attr(type=['negative', 'gate'])
def test_flavor_update_mismatch_key(self):
# the key will be updated should be match the key in the body
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_flavor_extra_spec,
self.flavor['id'],
"key2",
@@ -119,7 +118,7 @@
@test.attr(type=['negative', 'gate'])
def test_flavor_update_more_key(self):
# there should be just one item in the request body
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_flavor_extra_spec,
self.flavor['id'],
"key1",
diff --git a/tempest/api/compute/admin/test_floating_ips_bulk.py b/tempest/api/compute/admin/test_floating_ips_bulk.py
index c1263ea..e01245e 100644
--- a/tempest/api/compute/admin/test_floating_ips_bulk.py
+++ b/tempest/api/compute/admin/test_floating_ips_bulk.py
@@ -40,7 +40,7 @@
@classmethod
def verify_unallocated_floating_ip_range(cls, ip_range):
# Verify whether configure floating IP range is not already allocated.
- _, body = cls.client.list_floating_ips_bulk()
+ body = cls.client.list_floating_ips_bulk()
allocated_ips_list = map(lambda x: x['address'], body)
for ip_addr in netaddr.IPNetwork(ip_range).iter_hosts():
if str(ip_addr) in allocated_ips_list:
@@ -65,18 +65,14 @@
# anywhere. Using the below mentioned interface which is not ever
# expected to be used. Clean Up has been done for created IP range
interface = 'eth0'
- resp, body = self.client.create_floating_ips_bulk(self.ip_range,
- pool,
- interface)
-
- self.assertEqual(200, resp.status)
+ body = self.client.create_floating_ips_bulk(self.ip_range,
+ pool,
+ interface)
self.addCleanup(self._delete_floating_ips_bulk, self.ip_range)
self.assertEqual(self.ip_range, body['ip_range'])
- resp, ips_list = self.client.list_floating_ips_bulk()
- self.assertEqual(200, resp.status)
+ ips_list = self.client.list_floating_ips_bulk()
self.assertNotEqual(0, len(ips_list))
for ip in netaddr.IPNetwork(self.ip_range).iter_hosts():
self.assertIn(str(ip), map(lambda x: x['address'], ips_list))
- resp, body = self.client.delete_floating_ips_bulk(self.ip_range)
- self.assertEqual(200, resp.status)
- self.assertEqual(self.ip_range, body)
+ body = self.client.delete_floating_ips_bulk(self.ip_range)
+ self.assertEqual(self.ip_range, body.data)
diff --git a/tempest/api/compute/admin/test_hosts_negative.py b/tempest/api/compute/admin/test_hosts_negative.py
index 20429b1..8d70c44 100644
--- a/tempest/api/compute/admin/test_hosts_negative.py
+++ b/tempest/api/compute/admin/test_hosts_negative.py
@@ -16,7 +16,6 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -72,7 +71,7 @@
# only 'status' and 'maintenance_mode' are the valid params.
hostname = self._get_host_name()
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_host,
hostname,
status='enable',
@@ -84,7 +83,7 @@
# 'status' can only be 'enable' or 'disable'
hostname = self._get_host_name()
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_host,
hostname,
status='invalid',
@@ -95,7 +94,7 @@
# 'maintenance_mode' can only be 'enable' or 'disable'
hostname = self._get_host_name()
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_host,
hostname,
status='enable',
@@ -106,7 +105,7 @@
# 'status' or 'maintenance_mode' needed for host update
hostname = self._get_host_name()
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_host,
hostname)
diff --git a/tempest/api/compute/admin/test_instance_usage_audit_log.py b/tempest/api/compute/admin/test_instance_usage_audit_log.py
index f7b5e43..16ce93c 100644
--- a/tempest/api/compute/admin/test_instance_usage_audit_log.py
+++ b/tempest/api/compute/admin/test_instance_usage_audit_log.py
@@ -30,8 +30,7 @@
@test.attr(type='gate')
def test_list_instance_usage_audit_logs(self):
# list instance usage audit logs
- resp, body = self.adm_client.list_instance_usage_audit_logs()
- self.assertEqual(200, resp.status)
+ body = self.adm_client.list_instance_usage_audit_logs()
expected_items = ['total_errors', 'total_instances', 'log',
'num_hosts_running', 'num_hosts_done',
'num_hosts', 'hosts_not_run', 'overall_status',
@@ -44,10 +43,9 @@
def test_get_instance_usage_audit_log(self):
# Get instance usage audit log before specified time
now = datetime.datetime.now()
- resp, body = self.adm_client.get_instance_usage_audit_log(
+ body = self.adm_client.get_instance_usage_audit_log(
urllib.quote(now.strftime("%Y-%m-%d %H:%M:%S")))
- self.assertEqual(200, resp.status)
expected_items = ['total_errors', 'total_instances', 'log',
'num_hosts_running', 'num_hosts_done', 'num_hosts',
'hosts_not_run', 'overall_status', 'period_ending',
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 1e03bd0..5453ff4 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
@@ -19,7 +19,6 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
-from tempest import exceptions
from tempest import test
@@ -44,6 +43,6 @@
@test.attr(type=['negative', 'gate'])
def test_get_instance_usage_audit_logs_with_invalid_time(self):
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.adm_client.get_instance_usage_audit_log,
"invalid_time")
diff --git a/tempest/api/compute/admin/test_migrations.py b/tempest/api/compute/admin/test_migrations.py
index 7ba05ef..c51ad61 100644
--- a/tempest/api/compute/admin/test_migrations.py
+++ b/tempest/api/compute/admin/test_migrations.py
@@ -31,15 +31,14 @@
@test.attr(type='gate')
def test_list_migrations(self):
# Admin can get the migrations list
- resp, _ = self.client.list_migrations()
- self.assertEqual(200, resp.status)
+ self.client.list_migrations()
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
'Resize not available.')
@test.attr(type='gate')
def test_list_migrations_in_flavor_resize_situation(self):
# Admin can get the migrations list which contains the resized server
- resp, server = self.create_test_server(wait_until="ACTIVE")
+ server = self.create_test_server(wait_until="ACTIVE")
server_id = server['id']
resp, _ = self.servers_client.resize(server_id, self.flavor_ref_alt)
@@ -48,8 +47,7 @@
self.servers_client.confirm_resize(server_id)
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
- resp, body = self.client.list_migrations()
- self.assertEqual(200, resp.status)
+ body = self.client.list_migrations()
instance_uuids = [x['instance_uuid'] for x in body]
self.assertIn(server_id, instance_uuids)
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 31103df..a0606cd 100644
--- a/tempest/api/compute/admin/test_security_group_default_rules.py
+++ b/tempest/api/compute/admin/test_security_group_default_rules.py
@@ -30,10 +30,14 @@
@testtools.skipIf(CONF.service_available.neutron,
"Skip as this functionality is not yet "
"implemented in Neutron. Related Bug#1311500")
- def resource_setup(cls):
+ def setup_credentials(cls):
# A network and a subnet will be created for these tests
cls.set_network_resources(network=True, subnet=True)
- super(SecurityGroupDefaultRulesTest, cls).resource_setup()
+ super(SecurityGroupDefaultRulesTest, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(SecurityGroupDefaultRulesTest, cls).setup_clients()
cls.adm_client = cls.os_adm.security_group_default_rules_client
def _create_security_group_default_rules(self, ip_protocol='tcp',
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index cff9a43..6110b89 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -35,13 +35,13 @@
cls.flavors_client = cls.os_adm.flavors_client
cls.s1_name = data_utils.rand_name('server')
- resp, server = cls.create_test_server(name=cls.s1_name,
- wait_until='ACTIVE')
+ server = cls.create_test_server(name=cls.s1_name,
+ wait_until='ACTIVE')
cls.s1_id = server['id']
cls.s2_name = data_utils.rand_name('server')
- resp, server = cls.create_test_server(name=cls.s2_name,
- wait_until='ACTIVE')
+ server = cls.create_test_server(name=cls.s2_name,
+ wait_until='ACTIVE')
cls.s2_id = server['id']
@test.attr(type='gate')
@@ -61,7 +61,7 @@
# Reset server's state to 'active'
resp, server = self.client.reset_state(self.s1_id, state='active')
# Verify server's state
- resp, server = self.client.get_server(self.s1_id)
+ server = self.client.get_server(self.s1_id)
self.assertEqual(server['status'], 'ACTIVE')
servers = body['servers']
# Verify error server in list result
@@ -104,12 +104,10 @@
name = data_utils.rand_name('server')
flavor = self.flavor_ref
image_id = self.image_ref
- resp, test_server = self.client.create_server(
- name, image_id, flavor)
- self.assertEqual('202', resp['status'])
+ test_server = self.client.create_server(name, image_id, flavor)
self.addCleanup(self.client.delete_server, test_server['id'])
self.client.wait_for_server_status(test_server['id'], 'ACTIVE')
- resp, server = self.client.get_server(test_server['id'])
+ server = self.client.get_server(test_server['id'])
self.assertEqual(server['status'], 'ACTIVE')
hostname = server[self._host_key]
params = {'host': hostname}
@@ -132,7 +130,7 @@
self.assertEqual(202, resp.status)
# Verify server's state
- resp, server = self.client.get_server(self.s1_id)
+ server = self.client.get_server(self.s1_id)
self.assertEqual(server['status'], 'ERROR')
# Reset server's state to 'active'
@@ -140,7 +138,7 @@
self.assertEqual(202, resp.status)
# Verify server's state
- resp, server = self.client.get_server(self.s1_id)
+ server = self.client.get_server(self.s1_id)
self.assertEqual(server['status'], 'ACTIVE')
@test.attr(type='gate')
@@ -179,14 +177,14 @@
'ACTIVE',
raise_on_error=False)
# Verify the server properties after rebuilding
- resp, server = self.non_admin_client.get_server(rebuilt_server['id'])
+ server = self.non_admin_client.get_server(rebuilt_server['id'])
rebuilt_image_id = server['image']['id']
self.assertEqual(self.image_ref_alt, rebuilt_image_id)
@test.attr(type='gate')
def test_reset_network_inject_network_info(self):
# Reset Network of a Server
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
resp, server_body = self.client.reset_network(server['id'])
self.assertEqual(202, resp.status)
# Inject the Network Info into Server
@@ -199,6 +197,5 @@
hints = {
'same_host': self.s1_id
}
- resp, server = self.create_test_server(sched_hints=hints,
- wait_until='ACTIVE')
- self.assertEqual('202', resp['status'])
+ self.create_test_server(sched_hints=hints,
+ wait_until='ACTIVE')
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index 0d4731d..7fd87f6 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -21,7 +21,6 @@
from tempest.common import tempest_fixtures as fixtures
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -42,8 +41,8 @@
cls.tenant_id = cls.client.tenant_id
cls.s1_name = data_utils.rand_name('server')
- resp, server = cls.create_test_server(name=cls.s1_name,
- wait_until='ACTIVE')
+ server = cls.create_test_server(name=cls.s1_name,
+ wait_until='ACTIVE')
cls.s1_id = server['id']
def _get_unused_flavor_id(self):
@@ -100,13 +99,13 @@
@test.attr(type=['negative', 'gate'])
def test_reset_state_server_invalid_state(self):
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.reset_state, self.s1_id,
state='invalid')
@test.attr(type=['negative', 'gate'])
def test_reset_state_server_invalid_type(self):
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.reset_state, self.s1_id,
state=1)
@@ -136,8 +135,7 @@
@test.attr(type=['negative', 'gate'])
def test_migrate_server_invalid_state(self):
# create server.
- resp, server = self.create_test_server(wait_until='ACTIVE')
- self.assertEqual(202, resp.status)
+ server = self.create_test_server(wait_until='ACTIVE')
server_id = server['id']
# suspend the server.
resp, _ = self.client.suspend_server(server_id)
diff --git a/tempest/api/compute/admin/test_simple_tenant_usage.py b/tempest/api/compute/admin/test_simple_tenant_usage.py
index f6553b3..6775d1f 100644
--- a/tempest/api/compute/admin/test_simple_tenant_usage.py
+++ b/tempest/api/compute/admin/test_simple_tenant_usage.py
@@ -30,7 +30,7 @@
cls.tenant_id = cls.client.tenant_id
# Create a server in the demo tenant
- resp, server = cls.create_test_server(wait_until='ACTIVE')
+ cls.create_test_server(wait_until='ACTIVE')
time.sleep(2)
now = datetime.datetime.now()
@@ -48,8 +48,7 @@
params = {'start': self.start,
'end': self.end,
'detailed': int(bool(True))}
- resp, tenant_usage = self.adm_client.list_tenant_usages(params)
- self.assertEqual(200, resp.status)
+ tenant_usage = self.adm_client.list_tenant_usages(params)
self.assertEqual(len(tenant_usage), 8)
@test.attr(type='gate')
@@ -57,10 +56,9 @@
# Get usage for a specific tenant
params = {'start': self.start,
'end': self.end}
- resp, tenant_usage = self.adm_client.get_tenant_usage(
+ tenant_usage = self.adm_client.get_tenant_usage(
self.tenant_id, params)
- self.assertEqual(200, resp.status)
self.assertEqual(len(tenant_usage), 8)
@test.attr(type='gate')
@@ -68,8 +66,7 @@
# Get usage for a specific tenant with non admin user
params = {'start': self.start,
'end': self.end}
- resp, tenant_usage = self.client.get_tenant_usage(
+ tenant_usage = self.client.get_tenant_usage(
self.tenant_id, params)
- self.assertEqual(200, resp.status)
self.assertEqual(len(tenant_usage), 8)
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 b371f2d..0d88f6c 100644
--- a/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
+++ b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
@@ -17,7 +17,6 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
-from tempest import exceptions
from tempest import test
@@ -52,7 +51,7 @@
# Get usage for tenant with invalid date
params = {'start': self.end,
'end': self.start}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.adm_client.get_tenant_usage,
self.client.tenant_id, params)
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 808f78c..c448975 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -17,6 +17,7 @@
import time
from tempest import clients
+from tempest.common import credentials
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
@@ -36,15 +37,60 @@
force_tenant_isolation = False
@classmethod
- def resource_setup(cls):
- cls.set_network_resources()
- super(BaseComputeTest, cls).resource_setup()
+ def skip_checks(cls):
+ super(BaseComputeTest, cls).skip_checks()
+ if cls._api_version != 2:
+ msg = ("Unexpected API version is specified (%s)" %
+ cls._api_version)
+ raise exceptions.InvalidConfiguration(message=msg)
+ @classmethod
+ def setup_credentials(cls):
+ cls.set_network_resources()
+ super(BaseComputeTest, cls).setup_credentials()
# TODO(andreaf) WE should care also for the alt_manager here
# but only once client lazy load in the manager is done
cls.os = cls.get_client_manager()
+ # Note that we put this here and not in skip_checks because in
+ # the case of preprovisioned users we won't know if we can get
+ # two distinct users until we go and lock them
cls.multi_user = cls.check_multi_user()
+ @classmethod
+ def setup_clients(cls):
+ super(BaseComputeTest, cls).setup_clients()
+ cls.servers_client = cls.os.servers_client
+ cls.flavors_client = cls.os.flavors_client
+ cls.images_client = cls.os.images_client
+ cls.extensions_client = cls.os.extensions_client
+ cls.floating_ips_client = cls.os.floating_ips_client
+ cls.keypairs_client = cls.os.keypairs_client
+ cls.security_groups_client = cls.os.security_groups_client
+ cls.quotas_client = cls.os.quotas_client
+ # NOTE(mriedem): os-quota-class-sets is v2 API only
+ cls.quota_classes_client = cls.os.quota_classes_client
+ # NOTE(mriedem): os-networks is v2 API only
+ cls.networks_client = cls.os.networks_client
+ cls.limits_client = cls.os.limits_client
+ cls.volumes_extensions_client = cls.os.volumes_extensions_client
+ cls.volumes_client = cls.os.volumes_client
+ cls.interfaces_client = cls.os.interfaces_client
+ cls.fixed_ips_client = cls.os.fixed_ips_client
+ cls.availability_zone_client = cls.os.availability_zone_client
+ cls.agents_client = cls.os.agents_client
+ cls.aggregates_client = cls.os.aggregates_client
+ cls.services_client = cls.os.services_client
+ cls.instance_usages_audit_log_client = (
+ cls.os.instance_usages_audit_log_client)
+ cls.hypervisor_client = cls.os.hypervisor_client
+ cls.certificates_client = cls.os.certificates_client
+ cls.migrations_client = cls.os.migrations_client
+ cls.security_group_default_rules_client = (
+ cls.os.security_group_default_rules_client)
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseComputeTest, cls).resource_setup()
cls.build_interval = CONF.compute.build_interval
cls.build_timeout = CONF.compute.build_timeout
cls.ssh_user = CONF.compute.ssh_user
@@ -59,39 +105,13 @@
cls.security_groups = []
cls.server_groups = []
- if cls._api_version == 2:
- cls.servers_client = cls.os.servers_client
- cls.flavors_client = cls.os.flavors_client
- cls.images_client = cls.os.images_client
- cls.extensions_client = cls.os.extensions_client
- cls.floating_ips_client = cls.os.floating_ips_client
- cls.keypairs_client = cls.os.keypairs_client
- cls.security_groups_client = cls.os.security_groups_client
- cls.quotas_client = cls.os.quotas_client
- # NOTE(mriedem): os-quota-class-sets is v2 API only
- cls.quota_classes_client = cls.os.quota_classes_client
- # NOTE(mriedem): os-networks is v2 API only
- cls.networks_client = cls.os.networks_client
- cls.limits_client = cls.os.limits_client
- cls.volumes_extensions_client = cls.os.volumes_extensions_client
- cls.volumes_client = cls.os.volumes_client
- cls.interfaces_client = cls.os.interfaces_client
- cls.fixed_ips_client = cls.os.fixed_ips_client
- cls.availability_zone_client = cls.os.availability_zone_client
- cls.agents_client = cls.os.agents_client
- cls.aggregates_client = cls.os.aggregates_client
- cls.services_client = cls.os.services_client
- cls.instance_usages_audit_log_client = \
- cls.os.instance_usages_audit_log_client
- cls.hypervisor_client = cls.os.hypervisor_client
- cls.certificates_client = cls.os.certificates_client
- cls.migrations_client = cls.os.migrations_client
- cls.security_group_default_rules_client = (
- cls.os.security_group_default_rules_client)
- else:
- msg = ("Unexpected API version is specified (%s)" %
- cls._api_version)
- raise exceptions.InvalidConfiguration(message=msg)
+ @classmethod
+ def resource_cleanup(cls):
+ cls.clear_images()
+ cls.clear_servers()
+ cls.clear_security_groups()
+ cls.clear_server_groups()
+ super(BaseComputeTest, cls).resource_cleanup()
@classmethod
def check_multi_user(cls):
@@ -183,14 +203,6 @@
server_group_id)
@classmethod
- def resource_cleanup(cls):
- cls.clear_images()
- cls.clear_servers()
- cls.clear_security_groups()
- cls.clear_server_groups()
- super(BaseComputeTest, cls).resource_cleanup()
-
- @classmethod
def create_test_server(cls, **kwargs):
"""Wrapper utility that returns a test server."""
name = data_utils.rand_name(cls.__name__ + "-instance")
@@ -199,7 +211,7 @@
flavor = kwargs.get('flavor', cls.flavor_ref)
image_id = kwargs.get('image_id', cls.image_ref)
- resp, body = cls.servers_client.create_server(
+ body = cls.servers_client.create_server(
name, image_id, flavor, **kwargs)
# handle the case of multiple servers
@@ -227,7 +239,7 @@
cls.servers.extend(servers)
- return resp, body
+ return body
@classmethod
def create_security_group(cls, name=None, description=None):
@@ -317,7 +329,7 @@
cls.servers_client.wait_for_server_termination(server_id)
except Exception:
LOG.exception('Failed to delete server %s' % server_id)
- resp, server = cls.create_test_server(wait_until='ACTIVE', **kwargs)
+ server = cls.create_test_server(wait_until='ACTIVE', **kwargs)
cls.password = server['adminPass']
return server['id']
@@ -335,15 +347,21 @@
"""Base test case class for Compute Admin API tests."""
@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)
- except NotImplementedError:
- msg = ("Missing Compute Admin API credentials in configuration.")
+ def skip_checks(cls):
+ if not credentials.is_admin_available():
+ msg = ("Missing Identity Admin API credentials in configuration.")
raise cls.skipException(msg)
+ super(BaseComputeAdminTest, cls).skip_checks()
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseComputeAdminTest, cls).setup_credentials()
+ creds = cls.isolated_creds.get_admin_creds()
+ cls.os_adm = clients.Manager(credentials=creds)
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseComputeAdminTest, cls).setup_clients()
cls.availability_zone_admin_client = (
cls.os_adm.availability_zone_client)
diff --git a/tempest/api/compute/certificates/test_certificates.py b/tempest/api/compute/certificates/test_certificates.py
index 15ccf53..321a0a1 100644
--- a/tempest/api/compute/certificates/test_certificates.py
+++ b/tempest/api/compute/certificates/test_certificates.py
@@ -24,14 +24,13 @@
@test.attr(type='gate')
def test_create_root_certificate(self):
# create certificates
- resp, body = self.certificates_client.create_certificate()
+ body = self.certificates_client.create_certificate()
self.assertIn('data', body)
self.assertIn('private_key', body)
@test.attr(type='gate')
def test_get_root_certificate(self):
# get the root certificate
- resp, body = self.certificates_client.get_certificate('root')
- self.assertEqual(200, resp.status)
+ body = self.certificates_client.get_certificate('root')
self.assertIn('data', body)
self.assertIn('private_key', body)
diff --git a/tempest/api/compute/floating_ips/base.py b/tempest/api/compute/floating_ips/base.py
index 19b6a50..142eaec 100644
--- a/tempest/api/compute/floating_ips/base.py
+++ b/tempest/api/compute/floating_ips/base.py
@@ -19,8 +19,8 @@
class BaseFloatingIPsTest(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
# Floating IP actions might need a full network configuration
cls.set_network_resources(network=True, subnet=True,
router=True, dhcp=True)
- super(BaseFloatingIPsTest, cls).resource_setup()
+ super(BaseFloatingIPsTest, cls).setup_credentials()
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 089ee5a..46a6ddb 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
@@ -25,16 +25,20 @@
floating_ip = None
@classmethod
+ def setup_clients(cls):
+ super(FloatingIPsTestJSON, cls).setup_clients()
+ cls.client = cls.floating_ips_client
+
+ @classmethod
def resource_setup(cls):
super(FloatingIPsTestJSON, cls).resource_setup()
- cls.client = cls.floating_ips_client
cls.floating_ip_id = None
# Server creation
- resp, server = cls.create_test_server(wait_until='ACTIVE')
+ server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
# Floating IP creation
- resp, body = cls.client.create_floating_ip()
+ body = cls.client.create_floating_ip()
cls.floating_ip_id = body['id']
cls.floating_ip = body['ip']
@@ -42,7 +46,7 @@
def resource_cleanup(cls):
# Deleting the floating IP which is created in this method
if cls.floating_ip_id:
- resp, body = cls.client.delete_floating_ip(cls.floating_ip_id)
+ cls.client.delete_floating_ip(cls.floating_ip_id)
super(FloatingIPsTestJSON, cls).resource_cleanup()
def _try_delete_floating_ip(self, floating_ip_id):
@@ -58,15 +62,14 @@
def test_allocate_floating_ip(self):
# Positive test:Allocation of a new floating IP to a project
# should be successful
- resp, body = self.client.create_floating_ip()
+ body = self.client.create_floating_ip()
floating_ip_id_allocated = body['id']
self.addCleanup(self.client.delete_floating_ip,
floating_ip_id_allocated)
- self.assertEqual(200, resp.status)
- resp, floating_ip_details = \
+ floating_ip_details = \
self.client.get_floating_ip_details(floating_ip_id_allocated)
# Checking if the details of allocated IP is in list of floating IP
- resp, body = self.client.list_floating_ips()
+ body = self.client.list_floating_ips()
self.assertIn(floating_ip_details, body)
@test.attr(type='gate')
@@ -75,14 +78,10 @@
# Positive test:Deletion of valid floating IP from project
# should be successful
# Creating the floating IP that is to be deleted in this method
- resp, floating_ip_body = self.client.create_floating_ip()
+ floating_ip_body = self.client.create_floating_ip()
self.addCleanup(self._try_delete_floating_ip, floating_ip_body['id'])
- # Storing the details of floating IP before deleting it
- cli_resp = self.client.get_floating_ip_details(floating_ip_body['id'])
- resp, floating_ip_details = cli_resp
# Deleting the floating IP from the project
- resp, body = self.client.delete_floating_ip(floating_ip_body['id'])
- self.assertEqual(202, resp.status)
+ self.client.delete_floating_ip(floating_ip_body['id'])
# Check it was really deleted.
self.client.wait_for_resource_deletion(floating_ip_body['id'])
@@ -93,20 +92,18 @@
# to a specific server should be successful
# Association of floating IP to fixed IP address
- resp, body = self.client.associate_floating_ip_to_server(
+ self.client.associate_floating_ip_to_server(
self.floating_ip,
self.server_id)
- self.assertEqual(202, resp.status)
# Check instance_id in the floating_ip body
- resp, body = self.client.get_floating_ip_details(self.floating_ip_id)
+ body = self.client.get_floating_ip_details(self.floating_ip_id)
self.assertEqual(self.server_id, body['instance_id'])
# Disassociation of floating IP that was associated in this method
- resp, body = self.client.disassociate_floating_ip_from_server(
+ self.client.disassociate_floating_ip_from_server(
self.floating_ip,
self.server_id)
- self.assertEqual(202, resp.status)
@test.attr(type='gate')
@test.services('network')
@@ -115,24 +112,23 @@
# to specific server should change the association of the Floating IP
# Create server so as to use for Multiple association
new_name = data_utils.rand_name('floating_server')
- resp, body = self.create_test_server(name=new_name)
+ body = self.create_test_server(name=new_name)
self.servers_client.wait_for_server_status(body['id'], 'ACTIVE')
self.new_server_id = body['id']
+ self.addCleanup(self.servers_client.delete_server, self.new_server_id)
# Associating floating IP for the first time
- resp, _ = self.client.associate_floating_ip_to_server(
+ self.client.associate_floating_ip_to_server(
self.floating_ip,
self.server_id)
# Associating floating IP for the second time
- resp, body = self.client.associate_floating_ip_to_server(
+ self.client.associate_floating_ip_to_server(
self.floating_ip,
self.new_server_id)
- self.addCleanup(self.servers_client.delete_server, self.new_server_id)
- if (resp['status'] is not None):
- self.addCleanup(self.client.disassociate_floating_ip_from_server,
- self.floating_ip,
- self.new_server_id)
+ self.addCleanup(self.client.disassociate_floating_ip_from_server,
+ self.floating_ip,
+ self.new_server_id)
# Make sure no longer associated with old server
self.assertRaises((lib_exc.NotFound,
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 b4ea175..fa3fa16 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
@@ -20,7 +20,6 @@
from tempest.api.compute.floating_ips import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -30,16 +29,20 @@
server_id = None
@classmethod
- def resource_setup(cls):
- super(FloatingIPsNegativeTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(FloatingIPsNegativeTestJSON, cls).setup_clients()
cls.client = cls.floating_ips_client
+ @classmethod
+ def resource_setup(cls):
+ super(FloatingIPsNegativeTestJSON, cls).resource_setup()
+
# Server creation
- resp, server = cls.create_test_server(wait_until='ACTIVE')
+ server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
# Generating a nonexistent floatingIP id
cls.floating_ip_ids = []
- resp, body = cls.client.list_floating_ips()
+ body = cls.client.list_floating_ips()
for i in range(len(body)):
cls.floating_ip_ids.append(body[i]['id'])
while True:
@@ -92,6 +95,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((lib_exc.NotFound, exceptions.BadRequest),
+ self.assertRaises((lib_exc.NotFound, lib_exc.BadRequest),
self.client.associate_floating_ip_to_server,
'', self.server_id)
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips.py b/tempest/api/compute/floating_ips/test_list_floating_ips.py
index 7af9ca7..25f13fc 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips.py
@@ -20,13 +20,17 @@
class FloatingIPDetailsTestJSON(base.BaseV2ComputeTest):
@classmethod
+ def setup_clients(cls):
+ super(FloatingIPDetailsTestJSON, cls).setup_clients()
+ cls.client = cls.floating_ips_client
+
+ @classmethod
def resource_setup(cls):
super(FloatingIPDetailsTestJSON, cls).resource_setup()
- cls.client = cls.floating_ips_client
cls.floating_ip = []
cls.floating_ip_id = []
for i in range(3):
- resp, body = cls.client.create_floating_ip()
+ body = cls.client.create_floating_ip()
cls.floating_ip.append(body)
cls.floating_ip_id.append(body['id'])
@@ -40,8 +44,7 @@
@test.services('network')
def test_list_floating_ips(self):
# Positive test:Should return the list of floating IPs
- resp, body = self.client.list_floating_ips()
- self.assertEqual(200, resp.status)
+ body = self.client.list_floating_ips()
floating_ips = body
self.assertNotEqual(0, len(floating_ips),
"Expected floating IPs. Got zero.")
@@ -53,16 +56,14 @@
def test_get_floating_ip_details(self):
# Positive test:Should be able to GET the details of floatingIP
# Creating a floating IP for which details are to be checked
- resp, body = self.client.create_floating_ip()
+ body = self.client.create_floating_ip()
floating_ip_id = body['id']
self.addCleanup(self.client.delete_floating_ip,
floating_ip_id)
floating_ip_instance_id = body['instance_id']
floating_ip_ip = body['ip']
floating_ip_fixed_ip = body['fixed_ip']
- resp, body = \
- self.client.get_floating_ip_details(floating_ip_id)
- self.assertEqual(200, resp.status)
+ body = self.client.get_floating_ip_details(floating_ip_id)
# Comparing the details of floating IP
self.assertEqual(floating_ip_instance_id,
body['instance_id'])
@@ -75,7 +76,6 @@
@test.services('network')
def test_list_floating_ip_pools(self):
# Positive test:Should return the list of floating IP Pools
- resp, floating_ip_pools = self.client.list_floating_ip_pools()
- self.assertEqual(200, resp.status)
+ floating_ip_pools = self.client.list_floating_ip_pools()
self.assertNotEqual(0, len(floating_ip_pools),
"Expected floating IP Pools. Got zero.")
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 b3ff132..d1d3517 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
@@ -28,8 +28,8 @@
class FloatingIPDetailsNegativeTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
- super(FloatingIPDetailsNegativeTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(FloatingIPDetailsNegativeTestJSON, cls).setup_clients()
cls.client = cls.floating_ips_client
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/compute/images/test_images.py b/tempest/api/compute/images/test_images.py
index dc27a70..2508fe1 100644
--- a/tempest/api/compute/images/test_images.py
+++ b/tempest/api/compute/images/test_images.py
@@ -40,7 +40,7 @@
@test.attr(type='gate')
def test_delete_saving_image(self):
snapshot_name = data_utils.rand_name('test-snap-')
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
self.addCleanup(self.servers_client.delete_server, server['id'])
image = self.create_image_from_server(server['id'],
name=snapshot_name,
diff --git a/tempest/api/compute/images/test_images_negative.py b/tempest/api/compute/images/test_images_negative.py
index cf127ee..55184d9 100644
--- a/tempest/api/compute/images/test_images_negative.py
+++ b/tempest/api/compute/images/test_images_negative.py
@@ -42,7 +42,7 @@
@test.attr(type=['negative', 'gate'])
def test_create_image_from_deleted_server(self):
# An image should not be created if the server instance is removed
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
# Delete server before trying to create server
self.servers_client.delete_server(server['id'])
@@ -67,7 +67,7 @@
@test.attr(type=['negative', 'gate'])
def test_create_image_from_stopped_server(self):
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
self.servers_client.stop(server['id'])
self.servers_client.wait_for_server_status(server['id'],
'SHUTOFF')
diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index 79cd27a..12aa886 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -59,7 +59,7 @@
% cls.__name__)
raise cls.skipException(skip_msg)
- resp, server = cls.create_test_server(wait_until='ACTIVE')
+ server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
def _get_default_flavor_disk_size(self, flavor_id):
diff --git a/tempest/api/compute/images/test_images_oneserver_negative.py b/tempest/api/compute/images/test_images_oneserver_negative.py
index 63f5b9e..7f15ad1 100644
--- a/tempest/api/compute/images/test_images_oneserver_negative.py
+++ b/tempest/api/compute/images/test_images_oneserver_negative.py
@@ -19,7 +19,6 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest import test
@@ -69,7 +68,7 @@
% cls.__name__)
raise cls.skipException(skip_msg)
- resp, server = cls.create_test_server(wait_until='ACTIVE')
+ server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
cls.image_ids = []
@@ -79,7 +78,7 @@
# Return an error when creating image with invalid metadata
snapshot_name = data_utils.rand_name('test-snap-')
meta = {'': ''}
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_image,
self.server_id, snapshot_name, meta)
@test.attr(type=['negative', 'gate'])
@@ -87,7 +86,7 @@
# Return an error when creating image with meta data over 256 chars
snapshot_name = data_utils.rand_name('test-snap-')
meta = {'a' * 260: 'b' * 260}
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_image,
self.server_id, snapshot_name, meta)
@test.attr(type=['negative', 'gate'])
@@ -112,7 +111,7 @@
# Return an error if snapshot name over 256 characters is passed
snapshot_name = data_utils.rand_name('a' * 260)
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_image,
self.server_id, snapshot_name)
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index 3f37a16..a2e5f56 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -69,8 +69,8 @@
return
# Create instances and snapshots via nova
- resp, cls.server1 = cls.create_test_server()
- resp, cls.server2 = cls.create_test_server(wait_until='ACTIVE')
+ cls.server1 = cls.create_test_server()
+ cls.server2 = cls.create_test_server(wait_until='ACTIVE')
# NOTE(sdague) this is faster than doing the sync wait_util on both
cls.servers_client.wait_for_server_status(cls.server1['id'],
'ACTIVE')
diff --git a/tempest/api/compute/keypairs/test_keypairs_negative.py b/tempest/api/compute/keypairs/test_keypairs_negative.py
index 1586405..ea25527 100644
--- a/tempest/api/compute/keypairs/test_keypairs_negative.py
+++ b/tempest/api/compute/keypairs/test_keypairs_negative.py
@@ -18,7 +18,6 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -38,7 +37,7 @@
# Keypair should not be created with a non RSA public key
k_name = data_utils.rand_name('keypair-')
pub_key = "ssh-rsa JUNK nova@ubuntu"
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self._create_keypair, k_name, pub_key)
@test.attr(type=['negative', 'gate'])
@@ -53,7 +52,7 @@
# Keypair should not be created with an empty public key
k_name = data_utils.rand_name("keypair-")
pub_key = ' '
- self.assertRaises(exceptions.BadRequest, self._create_keypair,
+ self.assertRaises(lib_exc.BadRequest, self._create_keypair,
k_name, pub_key)
@test.attr(type=['negative', 'gate'])
@@ -61,7 +60,7 @@
# Keypair should not be created when public key bits are too long
k_name = data_utils.rand_name("keypair-")
pub_key = 'ssh-rsa ' + 'A' * 2048 + ' openstack@ubuntu'
- self.assertRaises(exceptions.BadRequest, self._create_keypair,
+ self.assertRaises(lib_exc.BadRequest, self._create_keypair,
k_name, pub_key)
@test.attr(type=['negative', 'gate'])
@@ -77,19 +76,19 @@
@test.attr(type=['negative', 'gate'])
def test_create_keypair_with_empty_name_string(self):
# Keypairs with name being an empty string should not be created
- self.assertRaises(exceptions.BadRequest, self._create_keypair,
+ self.assertRaises(lib_exc.BadRequest, self._create_keypair,
'')
@test.attr(type=['negative', 'gate'])
def test_create_keypair_with_long_keynames(self):
# Keypairs with name longer than 255 chars should not be created
k_name = 'keypair-'.ljust(260, '0')
- self.assertRaises(exceptions.BadRequest, self._create_keypair,
+ self.assertRaises(lib_exc.BadRequest, self._create_keypair,
k_name)
@test.attr(type=['negative', 'gate'])
def test_create_keypair_invalid_name(self):
# Keypairs with name being an invalid name should not be created
k_name = 'key_/.\@:'
- self.assertRaises(exceptions.BadRequest, self._create_keypair,
+ self.assertRaises(lib_exc.BadRequest, self._create_keypair,
k_name)
diff --git a/tempest/api/compute/limits/test_absolute_limits.py b/tempest/api/compute/limits/test_absolute_limits.py
index 520dfa9..de6eecb 100644
--- a/tempest/api/compute/limits/test_absolute_limits.py
+++ b/tempest/api/compute/limits/test_absolute_limits.py
@@ -20,8 +20,8 @@
class AbsoluteLimitsTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
- super(AbsoluteLimitsTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(AbsoluteLimitsTestJSON, cls).setup_clients()
cls.client = cls.limits_client
@test.attr(type='gate')
diff --git a/tempest/api/compute/limits/test_absolute_limits_negative.py b/tempest/api/compute/limits/test_absolute_limits_negative.py
index 9776db3..d82a2e5 100644
--- a/tempest/api/compute/limits/test_absolute_limits_negative.py
+++ b/tempest/api/compute/limits/test_absolute_limits_negative.py
@@ -28,8 +28,8 @@
super(AbsoluteLimitsNegativeTestJSON, self).setUp()
@classmethod
- def resource_setup(cls):
- super(AbsoluteLimitsNegativeTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(AbsoluteLimitsNegativeTestJSON, cls).setup_clients()
cls.client = cls.limits_client
cls.server_client = cls.servers_client
diff --git a/tempest/api/compute/security_groups/base.py b/tempest/api/compute/security_groups/base.py
index 05cad9a..f70f6d3 100644
--- a/tempest/api/compute/security_groups/base.py
+++ b/tempest/api/compute/security_groups/base.py
@@ -19,7 +19,7 @@
class BaseSecurityGroupsTest(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
# A network and a subnet will be created for these tests
cls.set_network_resources(network=True, subnet=True)
- super(BaseSecurityGroupsTest, cls).resource_setup()
+ super(BaseSecurityGroupsTest, cls).setup_credentials()
diff --git a/tempest/api/compute/security_groups/test_security_group_rules.py b/tempest/api/compute/security_groups/test_security_group_rules.py
index 527f2dd..1871c73 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules.py
@@ -23,9 +23,13 @@
class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest):
@classmethod
+ def setup_clients(cls):
+ super(SecurityGroupRulesTestJSON, cls).setup_clients()
+ cls.client = cls.security_groups_client
+
+ @classmethod
def resource_setup(cls):
super(SecurityGroupRulesTestJSON, cls).resource_setup()
- cls.client = cls.security_groups_client
cls.neutron_available = CONF.service_available.neutron
cls.ip_protocol = 'tcp'
cls.from_port = 22
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 c8da63f..bd48cbe 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
@@ -18,7 +18,6 @@
from tempest.api.compute.security_groups 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,8 +33,8 @@
class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest):
@classmethod
- def resource_setup(cls):
- super(SecurityGroupRulesNegativeTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(SecurityGroupRulesNegativeTestJSON, cls).setup_clients()
cls.client = cls.security_groups_client
@test.attr(type=['negative', 'smoke'])
@@ -62,7 +61,7 @@
ip_protocol = 'tcp'
from_port = 22
to_port = 22
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
@@ -85,7 +84,7 @@
to_port)
self.addCleanup(self.client.delete_security_group_rule, rule['id'])
# Add the same rule to the group should fail
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
@@ -102,7 +101,7 @@
from_port = 22
to_port = 22
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
@@ -118,7 +117,7 @@
ip_protocol = 'tcp'
from_port = data_utils.rand_int_id(start=65536)
to_port = 22
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
@@ -134,7 +133,7 @@
ip_protocol = 'tcp'
from_port = 22
to_port = data_utils.rand_int_id(start=65536)
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group_rule,
parent_group_id, ip_protocol, from_port, to_port)
@@ -150,7 +149,7 @@
ip_protocol = 'tcp'
from_port = 22
to_port = 21
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group_rule,
secgroup_id, ip_protocol, from_port, to_port)
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index 909d444..1e2b6e7 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -13,17 +13,18 @@
# 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 exceptions
from tempest import test
class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest):
@classmethod
- def resource_setup(cls):
- super(SecurityGroupsTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(SecurityGroupsTestJSON, cls).setup_clients()
cls.client = cls.security_groups_client
@test.attr(type='smoke')
@@ -93,7 +94,7 @@
# Create server and add the security group created
# above to the server we just created
server_name = data_utils.rand_name('server')
- resp, server = self.create_test_server(name=server_name)
+ server = self.create_test_server(name=server_name)
server_id = server['id']
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
resp, body = self.servers_client.add_security_group(server_id,
@@ -101,7 +102,7 @@
# Check that we are not able to delete the security
# group since it is in use by an active server
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.delete_security_group,
sg['id'])
@@ -113,7 +114,7 @@
# Check that we are not able to delete the other security
# group since it is in use by an active server
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.delete_security_group,
sg2['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 a083406..2cbea1a 100644
--- a/tempest/api/compute/security_groups/test_security_groups_negative.py
+++ b/tempest/api/compute/security_groups/test_security_groups_negative.py
@@ -20,7 +20,6 @@
from tempest.api.compute.security_groups import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -29,9 +28,13 @@
class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest):
@classmethod
+ def setup_clients(cls):
+ super(SecurityGroupsNegativeTestJSON, cls).setup_clients()
+ cls.client = cls.security_groups_client
+
+ @classmethod
def resource_setup(cls):
super(SecurityGroupsNegativeTestJSON, cls).resource_setup()
- cls.client = cls.security_groups_client
cls.neutron_available = CONF.service_available.neutron
def _generate_a_non_existent_security_group_id(self):
@@ -66,15 +69,15 @@
# as an empty string/with white spaces/chars more than 255
s_description = data_utils.rand_name('description-')
# Create Security Group with empty string as group name
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group, "", s_description)
# Create Security Group with white space in group name
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group, " ",
s_description)
# Create Security Group with group name longer than 255 chars
s_name = 'securitygroup-'.ljust(260, '0')
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group, s_name,
s_description)
@@ -87,14 +90,14 @@
# as an empty string/with white spaces/chars more than 255
s_name = data_utils.rand_name('securitygroup-')
# Create Security Group with empty string as description
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group, s_name, "")
# Create Security Group with white space in description
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group, s_name, " ")
# Create Security Group with group description longer than 255 chars
s_description = 'description-'.ljust(260, '0')
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group, s_name,
s_description)
@@ -109,7 +112,7 @@
s_description = data_utils.rand_name('description-')
self.create_security_group(s_name, s_description)
# Now try the Security Group with the same 'Name'
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_security_group, s_name,
s_description)
@@ -124,7 +127,7 @@
default_security_group_id = body[i]['id']
break
# Deleting the "default" Security Group
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.delete_security_group,
default_security_group_id)
@@ -154,7 +157,7 @@
s_description = data_utils.rand_name('description-')
# Create a non int sg_id
sg_id_invalid = data_utils.rand_name('sg-')
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_security_group, sg_id_invalid,
name=s_name, description=s_description)
@@ -169,7 +172,7 @@
securitygroup_id = securitygroup['id']
# Update Security Group with group name longer than 255 chars
s_new_name = 'securitygroup-'.ljust(260, '0')
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_security_group,
securitygroup_id, name=s_new_name)
@@ -184,7 +187,7 @@
securitygroup_id = securitygroup['id']
# Update Security Group with group description longer than 255 chars
s_new_des = 'des-'.ljust(260, '0')
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_security_group,
securitygroup_id, description=s_new_des)
diff --git a/tempest/api/compute/servers/test_attach_interfaces.py b/tempest/api/compute/servers/test_attach_interfaces.py
index 4b14dc4..33995f3 100644
--- a/tempest/api/compute/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/servers/test_attach_interfaces.py
@@ -26,14 +26,22 @@
class AttachInterfacesTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(AttachInterfacesTestJSON, cls).skip_checks()
if not CONF.service_available.neutron:
raise cls.skipException("Neutron is required")
if not CONF.compute_feature_enabled.interface_attach:
raise cls.skipException("Interface attachment is not available.")
+
+ @classmethod
+ def setup_credentials(cls):
# This test class requires network and subnet
cls.set_network_resources(network=True, subnet=True)
- super(AttachInterfacesTestJSON, cls).resource_setup()
+ super(AttachInterfacesTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(AttachInterfacesTestJSON, cls).setup_clients()
cls.client = cls.os.interfaces_client
def _check_interface(self, iface, port_id=None, network_id=None,
@@ -49,7 +57,7 @@
self.assertEqual(iface['mac_addr'], mac_addr)
def _create_server_get_interfaces(self):
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
resp, ifs = self.client.list_interfaces(server['id'])
self.assertEqual(200, resp.status)
resp, body = self.client.wait_for_interface_status(
@@ -148,7 +156,7 @@
network_id)
self.assertEqual(202, resp.status)
# Remove the fixed IP from server.
- server_resp, server_detail = self.os.servers_client.get_server(
+ server_detail = self.os.servers_client.get_server(
server['id'])
# Get the Fixed IP from server.
fixed_ip = None
diff --git a/tempest/api/compute/servers/test_availability_zone.py b/tempest/api/compute/servers/test_availability_zone.py
index 5ddf053..dfff014 100644
--- a/tempest/api/compute/servers/test_availability_zone.py
+++ b/tempest/api/compute/servers/test_availability_zone.py
@@ -31,6 +31,5 @@
@test.attr(type='gate')
def test_get_availability_zone_list_with_non_admin_user(self):
# List of availability zone with non-administrator user
- resp, availability_zone = self.client.get_availability_zone_list()
- self.assertEqual(200, resp.status)
+ availability_zone = self.client.get_availability_zone_list()
self.assertTrue(len(availability_zone) > 0)
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index 85eb049..73e7d15 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -43,16 +43,16 @@
'contents': base64.b64encode(file_contents)}]
cls.client = cls.servers_client
cls.network_client = cls.os.network_client
- cli_resp = cls.create_test_server(name=cls.name,
- meta=cls.meta,
- accessIPv4=cls.accessIPv4,
- accessIPv6=cls.accessIPv6,
- personality=personality,
- disk_config=cls.disk_config)
- cls.resp, cls.server_initial = cli_resp
+ disk_config = cls.disk_config
+ cls.server_initial = cls.create_test_server(name=cls.name,
+ meta=cls.meta,
+ accessIPv4=cls.accessIPv4,
+ accessIPv6=cls.accessIPv6,
+ personality=personality,
+ disk_config=disk_config)
cls.password = cls.server_initial['adminPass']
cls.client.wait_for_server_status(cls.server_initial['id'], 'ACTIVE')
- resp, cls.server = cls.client.get_server(cls.server_initial['id'])
+ cls.server = cls.client.get_server(cls.server_initial['id'])
@test.attr(type='smoke')
def test_verify_server_details(self):
@@ -115,9 +115,8 @@
self.addCleanup(self.client.delete_server_group, group_id)
hints = {'group': group_id}
- resp, server = self.create_test_server(sched_hints=hints,
- wait_until='ACTIVE')
- self.assertEqual(202, resp.status)
+ server = self.create_test_server(sched_hints=hints,
+ wait_until='ACTIVE')
# Check a server is in the group
resp, server_group = self.client.get_server_group(group_id)
@@ -156,7 +155,7 @@
networks = [{'uuid': net1['network']['id']},
{'uuid': net2['network']['id']}]
- _, server_multi_nics = self.create_test_server(
+ server_multi_nics = self.create_test_server(
networks=networks, wait_until='ACTIVE')
# Cleanup server; this is needed in the test case because with the LIFO
@@ -245,22 +244,22 @@
admin_pass = self.image_ssh_password
- resp, server_no_eph_disk = (self.create_test_server(
- wait_until='ACTIVE',
- adminPass=admin_pass,
- flavor=flavor_no_eph_disk_id))
- resp, server_with_eph_disk = (self.create_test_server(
- wait_until='ACTIVE',
- adminPass=admin_pass,
- flavor=flavor_with_eph_disk_id))
+ server_no_eph_disk = (self.create_test_server(
+ wait_until='ACTIVE',
+ adminPass=admin_pass,
+ flavor=flavor_no_eph_disk_id))
+ server_with_eph_disk = (self.create_test_server(
+ wait_until='ACTIVE',
+ adminPass=admin_pass,
+ flavor=flavor_with_eph_disk_id))
# Get partition number of server without extra specs.
- _, server_no_eph_disk = self.client.get_server(
+ server_no_eph_disk = self.client.get_server(
server_no_eph_disk['id'])
linux_client = remote_client.RemoteClient(server_no_eph_disk,
self.ssh_user, admin_pass)
partition_num = len(linux_client.get_partitions().split('\n'))
- _, server_with_eph_disk = self.client.get_server(
+ server_with_eph_disk = self.client.get_server(
server_with_eph_disk['id'])
linux_client = remote_client.RemoteClient(server_with_eph_disk,
self.ssh_user, admin_pass)
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
index 7ccec8e..aec2f6f 100644
--- a/tempest/api/compute/servers/test_delete_server.py
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -35,27 +35,24 @@
@test.attr(type='gate')
def test_delete_server_while_in_building_state(self):
# Delete a server while it's VM state is Building
- resp, server = self.create_test_server(wait_until='BUILD')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
+ server = self.create_test_server(wait_until='BUILD')
+ self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@test.attr(type='gate')
def test_delete_active_server(self):
# Delete a server while it's VM state is Active
- resp, server = self.create_test_server(wait_until='ACTIVE')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
+ server = self.create_test_server(wait_until='ACTIVE')
+ self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@test.attr(type='gate')
def test_delete_server_while_in_shutoff_state(self):
# Delete a server while it's VM state is Shutoff
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
resp, body = self.client.stop(server['id'])
self.client.wait_for_server_status(server['id'], 'SHUTOFF')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
+ self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
@@ -63,11 +60,10 @@
@test.attr(type='gate')
def test_delete_server_while_in_pause_state(self):
# Delete a server while it's VM state is Pause
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
resp, body = self.client.pause_server(server['id'])
self.client.wait_for_server_status(server['id'], 'PAUSED')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
+ self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,
@@ -75,11 +71,10 @@
@test.attr(type='gate')
def test_delete_server_while_in_suspended_state(self):
# Delete a server while it's VM state is Suspended
- _, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
self.client.suspend_server(server['id'])
self.client.wait_for_server_status(server['id'], 'SUSPENDED')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
+ self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@testtools.skipUnless(CONF.compute_feature_enabled.shelve,
@@ -87,7 +82,7 @@
@test.attr(type='gate')
def test_delete_server_while_in_shelved_state(self):
# Delete a server while it's VM state is Shelved
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
resp, body = self.client.shelve_server(server['id'])
self.assertEqual(202, resp.status)
@@ -99,8 +94,7 @@
else:
self.client.wait_for_server_status(server['id'],
'SHELVED')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
+ self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@testtools.skipIf(not CONF.compute_feature_enabled.resize,
@@ -108,12 +102,11 @@
@test.attr(type='gate')
def test_delete_server_while_in_verify_resize_state(self):
# Delete a server while it's VM state is VERIFY_RESIZE
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
resp, body = self.client.resize(server['id'], self.flavor_ref_alt)
self.assertEqual(202, resp.status)
self.client.wait_for_server_status(server['id'], 'VERIFY_RESIZE')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
+ self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@test.services('volume')
@@ -122,7 +115,7 @@
# Delete a server while a volume is attached to it
volumes_client = self.volumes_extensions_client
device = '/dev/%s' % CONF.compute.volume_device_name
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
volume = volumes_client.create_volume(1)
self.addCleanup(volumes_client.delete_volume, volume['id'])
@@ -132,8 +125,7 @@
device=device)
volumes_client.wait_for_volume_status(volume['id'], 'in-use')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
+ self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
volumes_client.wait_for_volume_status(volume['id'], 'available')
@@ -151,21 +143,19 @@
@test.attr(type='gate')
def test_delete_server_while_in_error_state(self):
# Delete a server while it's VM state is error
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
resp, body = self.admin_client.reset_state(server['id'], state='error')
self.assertEqual(202, resp.status)
# Verify server's state
- resp, server = self.non_admin_client.get_server(server['id'])
+ server = self.non_admin_client.get_server(server['id'])
self.assertEqual(server['status'], 'ERROR')
- resp, _ = self.non_admin_client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
+ self.non_admin_client.delete_server(server['id'])
self.servers_client.wait_for_server_termination(server['id'],
ignore_error=True)
@test.attr(type='gate')
def test_admin_delete_servers_of_others(self):
# Administrator can delete servers of others
- resp, server = self.create_test_server(wait_until='ACTIVE')
- resp, _ = self.admin_client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
+ server = self.create_test_server(wait_until='ACTIVE')
+ self.admin_client.delete_server(server['id'])
self.servers_client.wait_for_server_termination(server['id'])
diff --git a/tempest/api/compute/servers/test_disk_config.py b/tempest/api/compute/servers/test_disk_config.py
index eeef0e5..f7a5bfb 100644
--- a/tempest/api/compute/servers/test_disk_config.py
+++ b/tempest/api/compute/servers/test_disk_config.py
@@ -31,17 +31,16 @@
raise cls.skipException(msg)
super(ServerDiskConfigTestJSON, cls).resource_setup()
cls.client = cls.os.servers_client
- resp, server = cls.create_test_server(wait_until='ACTIVE')
+ server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
def _update_server_with_disk_config(self, disk_config):
- resp, server = self.client.get_server(self.server_id)
+ server = self.client.get_server(self.server_id)
if disk_config != server['OS-DCF:diskConfig']:
- resp, server = self.client.update_server(self.server_id,
- disk_config=disk_config)
- self.assertEqual(200, resp.status)
+ server = self.client.update_server(self.server_id,
+ disk_config=disk_config)
self.client.wait_for_server_status(server['id'], 'ACTIVE')
- resp, server = self.client.get_server(server['id'])
+ server = self.client.get_server(server['id'])
self.assertEqual(disk_config, server['OS-DCF:diskConfig'])
@test.attr(type='gate')
@@ -57,7 +56,7 @@
self.client.wait_for_server_status(server['id'], 'ACTIVE')
# Verify the specified attributes are set correctly
- resp, server = self.client.get_server(server['id'])
+ server = self.client.get_server(server['id'])
self.assertEqual('MANUAL', server['OS-DCF:diskConfig'])
@test.attr(type='gate')
@@ -73,11 +72,11 @@
self.client.wait_for_server_status(server['id'], 'ACTIVE')
# Verify the specified attributes are set correctly
- resp, server = self.client.get_server(server['id'])
+ server = self.client.get_server(server['id'])
self.assertEqual('AUTO', server['OS-DCF:diskConfig'])
def _get_alternative_flavor(self):
- resp, server = self.client.get_server(self.server_id)
+ server = self.client.get_server(self.server_id)
if server['flavor']['id'] == self.flavor_ref:
return self.flavor_ref_alt
@@ -98,7 +97,7 @@
self.client.confirm_resize(self.server_id)
self.client.wait_for_server_status(self.server_id, 'ACTIVE')
- resp, server = self.client.get_server(self.server_id)
+ server = self.client.get_server(self.server_id)
self.assertEqual('AUTO', server['OS-DCF:diskConfig'])
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
@@ -115,7 +114,7 @@
self.client.confirm_resize(self.server_id)
self.client.wait_for_server_status(self.server_id, 'ACTIVE')
- resp, server = self.client.get_server(self.server_id)
+ server = self.client.get_server(self.server_id)
self.assertEqual('MANUAL', server['OS-DCF:diskConfig'])
@test.attr(type='gate')
@@ -124,11 +123,10 @@
self._update_server_with_disk_config(disk_config='AUTO')
# Update the disk_config attribute to manual
- resp, server = self.client.update_server(self.server_id,
- disk_config='MANUAL')
- self.assertEqual(200, resp.status)
+ server = self.client.update_server(self.server_id,
+ disk_config='MANUAL')
self.client.wait_for_server_status(server['id'], 'ACTIVE')
# Verify the disk_config attribute is set correctly
- resp, server = self.client.get_server(server['id'])
+ server = self.client.get_server(server['id'])
self.assertEqual('MANUAL', server['OS-DCF:diskConfig'])
diff --git a/tempest/api/compute/servers/test_instance_actions.py b/tempest/api/compute/servers/test_instance_actions.py
index 80b2a69..103c241 100644
--- a/tempest/api/compute/servers/test_instance_actions.py
+++ b/tempest/api/compute/servers/test_instance_actions.py
@@ -23,8 +23,8 @@
def resource_setup(cls):
super(InstanceActionsTestJSON, cls).resource_setup()
cls.client = cls.servers_client
- resp, server = cls.create_test_server(wait_until='ACTIVE')
- cls.request_id = resp['x-compute-request-id']
+ server = cls.create_test_server(wait_until='ACTIVE')
+ cls.request_id = server.response['x-compute-request-id']
cls.server_id = server['id']
@test.attr(type='gate')
diff --git a/tempest/api/compute/servers/test_instance_actions_negative.py b/tempest/api/compute/servers/test_instance_actions_negative.py
index 116191c..2f9216f 100644
--- a/tempest/api/compute/servers/test_instance_actions_negative.py
+++ b/tempest/api/compute/servers/test_instance_actions_negative.py
@@ -26,7 +26,7 @@
def resource_setup(cls):
super(InstanceActionsNegativeTestJSON, cls).resource_setup()
cls.client = cls.servers_client
- resp, server = cls.create_test_server(wait_until='ACTIVE')
+ server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/compute/servers/test_list_server_filters.py b/tempest/api/compute/servers/test_list_server_filters.py
index cb90873..58740fd 100644
--- a/tempest/api/compute/servers/test_list_server_filters.py
+++ b/tempest/api/compute/servers/test_list_server_filters.py
@@ -28,11 +28,19 @@
class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
cls.set_network_resources(network=True, subnet=True, dhcp=True)
- super(ListServerFiltersTestJSON, cls).resource_setup()
+ super(ListServerFiltersTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(ListServerFiltersTestJSON, cls).setup_clients()
cls.client = cls.servers_client
+ @classmethod
+ def resource_setup(cls):
+ super(ListServerFiltersTestJSON, cls).resource_setup()
+
# Check to see if the alternate image ref actually exists...
images_client = cls.images_client
images = images_client.list_images()
@@ -59,18 +67,18 @@
cls.image_ref_alt)
cls.s1_name = data_utils.rand_name(cls.__name__ + '-instance')
- resp, cls.s1 = cls.create_test_server(name=cls.s1_name,
- wait_until='ACTIVE')
+ cls.s1 = cls.create_test_server(name=cls.s1_name,
+ wait_until='ACTIVE')
cls.s2_name = data_utils.rand_name(cls.__name__ + '-instance')
- resp, cls.s2 = cls.create_test_server(name=cls.s2_name,
- image_id=cls.image_ref_alt,
- wait_until='ACTIVE')
+ cls.s2 = cls.create_test_server(name=cls.s2_name,
+ image_id=cls.image_ref_alt,
+ wait_until='ACTIVE')
cls.s3_name = data_utils.rand_name(cls.__name__ + '-instance')
- resp, cls.s3 = cls.create_test_server(name=cls.s3_name,
- flavor=cls.flavor_ref_alt,
- wait_until='ACTIVE')
+ cls.s3 = cls.create_test_server(name=cls.s3_name,
+ flavor=cls.flavor_ref_alt,
+ wait_until='ACTIVE')
cls.fixed_network_name = CONF.compute.fixed_network_name
if CONF.service_available.neutron:
@@ -261,7 +269,7 @@
def test_list_servers_filtered_by_ip(self):
# Filter servers by ip
# Here should be listed 1 server
- resp, self.s1 = self.client.get_server(self.s1['id'])
+ self.s1 = self.client.get_server(self.s1['id'])
ip = self.s1['addresses'][self.fixed_network_name][0]['addr']
params = {'ip': ip}
resp, body = self.client.list_servers(params)
@@ -278,7 +286,7 @@
# Filter servers by regex ip
# List all servers filtered by part of ip address.
# Here should be listed all servers
- resp, self.s1 = self.client.get_server(self.s1['id'])
+ self.s1 = self.client.get_server(self.s1['id'])
ip = self.s1['addresses'][self.fixed_network_name][0]['addr'][0:-3]
params = {'ip': ip}
resp, body = self.client.list_servers(params)
diff --git a/tempest/api/compute/servers/test_list_servers_negative.py b/tempest/api/compute/servers/test_list_servers_negative.py
index 4655f7f..2f12882 100644
--- a/tempest/api/compute/servers/test_list_servers_negative.py
+++ b/tempest/api/compute/servers/test_list_servers_negative.py
@@ -14,9 +14,9 @@
# under the License.
from six import moves
+from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
-from tempest import exceptions
from tempest import test
@@ -35,10 +35,10 @@
cls.existing_fixtures = []
cls.deleted_fixtures = []
for x in moves.xrange(2):
- resp, srv = cls.create_test_server(wait_until='ACTIVE')
+ srv = cls.create_test_server(wait_until='ACTIVE')
cls.existing_fixtures.append(srv)
- resp, srv = cls.create_test_server()
+ srv = cls.create_test_server()
cls.client.delete_server(srv['id'])
# We ignore errors on termination because the server may
# be put into ERROR status on a quick spawn, then delete,
@@ -113,19 +113,19 @@
@test.attr(type=['negative', 'gate'])
def test_list_servers_by_limits_pass_string(self):
# Return an error if a string value is passed for limit
- self.assertRaises(exceptions.BadRequest, self.client.list_servers,
+ self.assertRaises(lib_exc.BadRequest, self.client.list_servers,
{'limit': 'testing'})
@test.attr(type=['negative', 'gate'])
def test_list_servers_by_limits_pass_negative_value(self):
# Return an error if a negative value for limit is passed
- self.assertRaises(exceptions.BadRequest, self.client.list_servers,
+ self.assertRaises(lib_exc.BadRequest, self.client.list_servers,
{'limit': -1})
@test.attr(type=['negative', 'gate'])
def test_list_servers_by_changes_since_invalid_date(self):
# Return an error when invalid date format is passed
- self.assertRaises(exceptions.BadRequest, self.client.list_servers,
+ self.assertRaises(lib_exc.BadRequest, self.client.list_servers,
{'changes-since': '2011/01/01'})
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/compute/servers/test_multiple_create.py b/tempest/api/compute/servers/test_multiple_create.py
index 6fd2a75..cffda95 100644
--- a/tempest/api/compute/servers/test_multiple_create.py
+++ b/tempest/api/compute/servers/test_multiple_create.py
@@ -30,26 +30,24 @@
created servers into the servers list to be cleaned up after all.
"""
kwargs['name'] = kwargs.get('name', self._generate_name())
- resp, body = self.create_test_server(**kwargs)
+ body = self.create_test_server(**kwargs)
- return resp, body
+ return body
@test.attr(type='gate')
def test_multiple_create(self):
- resp, body = self._create_multiple_servers(wait_until='ACTIVE',
- min_count=1,
- max_count=2)
+ body = self._create_multiple_servers(wait_until='ACTIVE',
+ min_count=1,
+ max_count=2)
# NOTE(maurosr): do status response check and also make sure that
# reservation_id is not in the response body when the request send
# contains return_reservation_id=False
- self.assertEqual('202', resp['status'])
self.assertNotIn('reservation_id', body)
@test.attr(type='gate')
def test_multiple_create_with_reservation_return(self):
- resp, body = self._create_multiple_servers(wait_until='ACTIVE',
- min_count=1,
- max_count=2,
- return_reservation_id=True)
- self.assertEqual(resp['status'], '202')
+ body = self._create_multiple_servers(wait_until='ACTIVE',
+ min_count=1,
+ max_count=2,
+ return_reservation_id=True)
self.assertIn('reservation_id', body)
diff --git a/tempest/api/compute/servers/test_multiple_create_negative.py b/tempest/api/compute/servers/test_multiple_create_negative.py
index 55db605..eca97c1 100644
--- a/tempest/api/compute/servers/test_multiple_create_negative.py
+++ b/tempest/api/compute/servers/test_multiple_create_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
@@ -31,38 +32,38 @@
created servers into the servers list to be cleaned up after all.
"""
kwargs['name'] = kwargs.get('name', self._generate_name())
- resp, body = self.create_test_server(**kwargs)
+ body = self.create_test_server(**kwargs)
- return resp, body
+ return body
@test.attr(type=['negative', 'gate'])
def test_min_count_less_than_one(self):
invalid_min_count = 0
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
min_count=invalid_min_count)
@test.attr(type=['negative', 'gate'])
def test_min_count_non_integer(self):
invalid_min_count = 2.5
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
min_count=invalid_min_count)
@test.attr(type=['negative', 'gate'])
def test_max_count_less_than_one(self):
invalid_max_count = 0
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
max_count=invalid_max_count)
@test.attr(type=['negative', 'gate'])
def test_max_count_non_integer(self):
invalid_max_count = 2.5
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
max_count=invalid_max_count)
@test.attr(type=['negative', 'gate'])
def test_max_count_less_than_min_count(self):
min_count = 3
max_count = 2
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
min_count=min_count,
max_count=max_count)
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index f948a3a..f849b8c 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -47,7 +47,7 @@
self.__class__.server_id = self.rebuild_server(self.server_id)
def tearDown(self):
- _, server = self.client.get_server(self.server_id)
+ server = self.client.get_server(self.server_id)
self.assertEqual(self.image_ref, server['image']['id'])
self.server_check_teardown()
super(ServerActionsTestJSON, self).tearDown()
@@ -71,7 +71,7 @@
if self.run_ssh:
# Verify that the user can authenticate with the new password
- resp, server = self.client.get_server(self.server_id)
+ server = self.client.get_server(self.server_id)
linux_client = remote_client.RemoteClient(server, self.ssh_user,
new_password)
linux_client.validate_authentication()
@@ -79,7 +79,7 @@
def _test_reboot_server(self, reboot_type):
if self.run_ssh:
# Get the time the server was last rebooted,
- resp, server = self.client.get_server(self.server_id)
+ server = self.client.get_server(self.server_id)
linux_client = remote_client.RemoteClient(server, self.ssh_user,
self.password)
boot_time = linux_client.get_boot_time()
@@ -131,7 +131,7 @@
# Verify the server properties after the rebuild completes
self.client.wait_for_server_status(rebuilt_server['id'], 'ACTIVE')
- resp, server = self.client.get_server(rebuilt_server['id'])
+ server = self.client.get_server(rebuilt_server['id'])
rebuilt_image_id = server['image']['id']
self.assertTrue(self.image_ref_alt.endswith(rebuilt_image_id))
self.assertEqual(new_name, server['name'])
@@ -148,7 +148,7 @@
def test_rebuild_server_in_stop_state(self):
# The server in stop state should be rebuilt using the provided
# image and remain in SHUTOFF state
- resp, server = self.client.get_server(self.server_id)
+ server = self.client.get_server(self.server_id)
old_image = server['image']['id']
new_image = self.image_ref_alt \
if old_image == self.image_ref else self.image_ref
@@ -165,7 +165,7 @@
# Verify the server properties after the rebuild completes
self.client.wait_for_server_status(rebuilt_server['id'], 'SHUTOFF')
- resp, server = self.client.get_server(rebuilt_server['id'])
+ server = self.client.get_server(rebuilt_server['id'])
rebuilt_image_id = server['image']['id']
self.assertEqual(new_image, rebuilt_image_id)
@@ -177,7 +177,7 @@
def _detect_server_image_flavor(self, server_id):
# Detects the current server image flavor ref.
- resp, server = self.client.get_server(server_id)
+ server = self.client.get_server(server_id)
current_flavor = server['flavor']['id']
new_flavor_ref = self.flavor_ref_alt \
if current_flavor == self.flavor_ref else self.flavor_ref
@@ -204,7 +204,7 @@
expected_status = 'SHUTOFF' if stop else 'ACTIVE'
self.client.wait_for_server_status(self.server_id, expected_status)
- resp, server = self.client.get_server(self.server_id)
+ server = self.client.get_server(self.server_id)
self.assertEqual(new_flavor_ref, server['flavor']['id'])
if stop:
@@ -240,7 +240,7 @@
self.client.revert_resize(self.server_id)
self.client.wait_for_server_status(self.server_id, 'ACTIVE')
- resp, server = self.client.get_server(self.server_id)
+ server = self.client.get_server(self.server_id)
self.assertEqual(previous_flavor_ref, server['flavor']['id'])
@testtools.skipUnless(CONF.compute_feature_enabled.snapshot,
@@ -358,7 +358,7 @@
'Console output not supported.')
@test.attr(type='gate')
def test_get_console_output_with_unlimited_size(self):
- _, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
def _check_full_length_console_log():
_, output = self.servers_client.get_console_output(server['id'],
@@ -383,7 +383,7 @@
# NOTE: SHUTOFF is irregular status. To avoid test instability,
# one server is created only for this test without using
# the server that was created in setupClass.
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
temp_server_id = server['id']
resp, server = self.servers_client.stop(temp_server_id)
@@ -435,7 +435,7 @@
self.client.wait_for_server_status(self.server_id,
'SHELVED_OFFLOADED')
- resp, server = self.client.get_server(self.server_id)
+ server = self.client.get_server(self.server_id)
image_name = server['name'] + '-shelved'
params = {'name': image_name}
images = self.images_client.list_images(params)
@@ -460,8 +460,7 @@
# Lock the server,try server stop(exceptions throw),unlock it and retry
resp, server = self.servers_client.lock_server(self.server_id)
self.assertEqual(202, resp.status)
- resp, server = self.servers_client.get_server(self.server_id)
- self.assertEqual(200, resp.status)
+ server = self.servers_client.get_server(self.server_id)
self.assertEqual(server['status'], 'ACTIVE')
# Locked server is not allowed to be stopped by non-admin user
self.assertRaises(lib_exc.Conflict,
diff --git a/tempest/api/compute/servers/test_server_addresses.py b/tempest/api/compute/servers/test_server_addresses.py
index 3d1d964..5a63033 100644
--- a/tempest/api/compute/servers/test_server_addresses.py
+++ b/tempest/api/compute/servers/test_server_addresses.py
@@ -20,13 +20,21 @@
class ServerAddressesTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
# This test module might use a network and a subnet
cls.set_network_resources(network=True, subnet=True)
- super(ServerAddressesTestJSON, cls).resource_setup()
+ super(ServerAddressesTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(ServerAddressesTestJSON, cls).setup_clients()
cls.client = cls.servers_client
- resp, cls.server = cls.create_test_server(wait_until='ACTIVE')
+ @classmethod
+ def resource_setup(cls):
+ super(ServerAddressesTestJSON, cls).resource_setup()
+
+ cls.server = cls.create_test_server(wait_until='ACTIVE')
@test.attr(type='smoke')
@test.services('network')
diff --git a/tempest/api/compute/servers/test_server_addresses_negative.py b/tempest/api/compute/servers/test_server_addresses_negative.py
index 77a041a..b32231a 100644
--- a/tempest/api/compute/servers/test_server_addresses_negative.py
+++ b/tempest/api/compute/servers/test_server_addresses_negative.py
@@ -22,12 +22,19 @@
class ServerAddressesNegativeTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
cls.set_network_resources(network=True, subnet=True)
- super(ServerAddressesNegativeTestJSON, cls).resource_setup()
+ super(ServerAddressesNegativeTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(ServerAddressesNegativeTestJSON, cls).setup_clients()
cls.client = cls.servers_client
- resp, cls.server = cls.create_test_server(wait_until='ACTIVE')
+ @classmethod
+ def resource_setup(cls):
+ super(ServerAddressesNegativeTestJSON, cls).resource_setup()
+ cls.server = cls.create_test_server(wait_until='ACTIVE')
@test.attr(type=['negative', 'gate'])
@test.services('network')
diff --git a/tempest/api/compute/servers/test_server_metadata.py b/tempest/api/compute/servers/test_server_metadata.py
index 6fd6a6d..7e8247f 100644
--- a/tempest/api/compute/servers/test_server_metadata.py
+++ b/tempest/api/compute/servers/test_server_metadata.py
@@ -24,7 +24,7 @@
super(ServerMetadataTestJSON, cls).resource_setup()
cls.client = cls.servers_client
cls.quotas = cls.quotas_client
- resp, server = cls.create_test_server(meta={}, wait_until='ACTIVE')
+ server = cls.create_test_server(meta={}, wait_until='ACTIVE')
cls.server_id = server['id']
def setUp(self):
diff --git a/tempest/api/compute/servers/test_server_metadata_negative.py b/tempest/api/compute/servers/test_server_metadata_negative.py
index 7fe95dd..441c965 100644
--- a/tempest/api/compute/servers/test_server_metadata_negative.py
+++ b/tempest/api/compute/servers/test_server_metadata_negative.py
@@ -17,7 +17,6 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -29,7 +28,7 @@
cls.client = cls.servers_client
cls.quotas = cls.quotas_client
cls.tenant_id = cls.client.tenant_id
- resp, server = cls.create_test_server(meta={}, wait_until='ACTIVE')
+ server = cls.create_test_server(meta={}, wait_until='ACTIVE')
cls.server_id = server['id']
@@ -42,7 +41,7 @@
for sz in [256, 257, 511, 1023]:
key = "k" * sz
meta = {key: 'data1'}
- self.assertRaises((exceptions.BadRequest, lib_exc.OverLimit),
+ self.assertRaises((lib_exc.BadRequest, lib_exc.OverLimit),
self.create_test_server,
meta=meta)
@@ -52,7 +51,7 @@
def test_create_server_metadata_blank_key(self):
# Blank key should trigger an error.
meta = {'': 'data1'}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
meta=meta)
@@ -78,7 +77,7 @@
# Raise BadRequest if key in uri does not match
# the key passed in body.
meta = {'testkey': 'testvalue'}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.set_server_metadata_item,
self.server_id, 'key', meta)
@@ -106,7 +105,7 @@
def test_update_metadata_with_blank_key(self):
# Blank key should trigger an error
meta = {'': 'data1'}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_server_metadata,
self.server_id, meta=meta)
@@ -148,7 +147,7 @@
# Raise a bad request error for blank key.
# set_server_metadata will replace all metadata with new value
meta = {'': 'data1'}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.set_server_metadata,
self.server_id, meta=meta)
@@ -157,6 +156,6 @@
# Raise a bad request error for a missing metadata field
# set_server_metadata will replace all metadata with new value
meta = {'meta1': 'data1'}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.set_server_metadata,
self.server_id, meta=meta, no_metadata_field=True)
diff --git a/tempest/api/compute/servers/test_server_password.py b/tempest/api/compute/servers/test_server_password.py
index 994caa4..b2e09f2 100644
--- a/tempest/api/compute/servers/test_server_password.py
+++ b/tempest/api/compute/servers/test_server_password.py
@@ -24,7 +24,7 @@
def resource_setup(cls):
super(ServerPasswordTestJSON, cls).resource_setup()
cls.client = cls.servers_client
- resp, cls.server = cls.create_test_server(wait_until="ACTIVE")
+ cls.server = cls.create_test_server(wait_until="ACTIVE")
@test.attr(type='gate')
def test_get_server_password(self):
diff --git a/tempest/api/compute/servers/test_server_personality.py b/tempest/api/compute/servers/test_server_personality.py
index bd3ebb0..ca6e28c 100644
--- a/tempest/api/compute/servers/test_server_personality.py
+++ b/tempest/api/compute/servers/test_server_personality.py
@@ -63,5 +63,4 @@
'path': path,
'contents': base64.b64encode(file_contents),
})
- resp, server = self.create_test_server(personality=person)
- self.assertEqual('202', resp['status'])
+ self.create_test_server(personality=person)
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index b04fe69..8d5c8f8 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -24,16 +24,23 @@
class ServerRescueTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(ServerRescueTestJSON, cls).skip_checks()
if not CONF.compute_feature_enabled.rescue:
msg = "Server rescue not available."
raise cls.skipException(msg)
+ @classmethod
+ def setup_credentials(cls):
cls.set_network_resources(network=True, subnet=True, router=True)
+ super(ServerRescueTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def resource_setup(cls):
super(ServerRescueTestJSON, cls).resource_setup()
# Floating IP creation
- resp, body = cls.floating_ips_client.create_floating_ip()
+ body = cls.floating_ips_client.create_floating_ip()
cls.floating_ip_id = str(body['id']).strip()
cls.floating_ip = str(body['ip']).strip()
@@ -46,7 +53,7 @@
cls.sg_id = cls.sg['id']
# Server for positive tests
- resp, server = cls.create_test_server(wait_until='BUILD')
+ server = cls.create_test_server(wait_until='BUILD')
cls.server_id = server['id']
cls.password = server['adminPass']
cls.servers_client.wait_for_server_status(cls.server_id, 'ACTIVE')
@@ -90,15 +97,12 @@
# Association of floating IP to a rescued vm
client = self.floating_ips_client
- resp, body = client.associate_floating_ip_to_server(self.floating_ip,
- self.server_id)
- self.assertEqual(202, resp.status)
+ client.associate_floating_ip_to_server(self.floating_ip,
+ self.server_id)
# Disassociation of floating IP that was associated in this method
- resp, body = \
- client.disassociate_floating_ip_from_server(self.floating_ip,
- self.server_id)
- self.assertEqual(202, resp.status)
+ client.disassociate_floating_ip_from_server(self.floating_ip,
+ self.server_id)
@test.attr(type='gate')
def test_rescued_vm_add_remove_security_group(self):
diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py
index 6780455..58353e7 100644
--- a/tempest/api/compute/servers/test_server_rescue_negative.py
+++ b/tempest/api/compute/servers/test_server_rescue_negative.py
@@ -27,18 +27,25 @@
class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(ServerRescueNegativeTestJSON, cls).skip_checks()
if not CONF.compute_feature_enabled.rescue:
msg = "Server rescue not available."
raise cls.skipException(msg)
+ @classmethod
+ def setup_credentials(cls):
cls.set_network_resources(network=True, subnet=True, router=True)
+ super(ServerRescueNegativeTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def resource_setup(cls):
super(ServerRescueNegativeTestJSON, cls).resource_setup()
cls.device = CONF.compute.volume_device_name
# Server for negative tests
- resp, server = cls.create_test_server(wait_until='BUILD')
- resp, resc_server = cls.create_test_server(wait_until='ACTIVE')
+ server = cls.create_test_server(wait_until='BUILD')
+ resc_server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
cls.password = server['adminPass']
cls.rescue_id = resc_server['id']
diff --git a/tempest/api/compute/servers/test_servers.py b/tempest/api/compute/servers/test_servers.py
index d31b320..1375039 100644
--- a/tempest/api/compute/servers/test_servers.py
+++ b/tempest/api/compute/servers/test_servers.py
@@ -33,7 +33,7 @@
def test_create_server_with_admin_password(self):
# If an admin password is provided on server creation, the server's
# root password should be set to that password.
- resp, server = self.create_test_server(adminPass='testpassword')
+ server = self.create_test_server(adminPass='testpassword')
# Verify the password is set correctly in the response
self.assertEqual('testpassword', server['adminPass'])
@@ -44,16 +44,16 @@
# TODO(sdague): clear out try, we do cleanup one layer up
server_name = data_utils.rand_name('server')
- resp, server = self.create_test_server(name=server_name,
- wait_until='ACTIVE')
+ server = self.create_test_server(name=server_name,
+ wait_until='ACTIVE')
id1 = server['id']
- resp, server = self.create_test_server(name=server_name,
- wait_until='ACTIVE')
+ server = self.create_test_server(name=server_name,
+ wait_until='ACTIVE')
id2 = server['id']
self.assertNotEqual(id1, id2, "Did not create a new server")
- resp, server = self.client.get_server(id1)
+ server = self.client.get_server(id1)
name1 = server['name']
- resp, server = self.client.get_server(id2)
+ server = self.client.get_server(id2)
name2 = server['name']
self.assertEqual(name1, name2)
@@ -64,36 +64,35 @@
key_name = data_utils.rand_name('key')
self.keypairs_client.create_keypair(key_name)
self.keypairs_client.list_keypairs()
- resp, server = self.create_test_server(key_name=key_name)
- self.assertEqual('202', resp['status'])
+ server = self.create_test_server(key_name=key_name)
self.client.wait_for_server_status(server['id'], 'ACTIVE')
- resp, server = self.client.get_server(server['id'])
+ server = self.client.get_server(server['id'])
self.assertEqual(key_name, server['key_name'])
def _update_server_name(self, server_id, status):
# The server name should be changed to the the provided value
new_name = data_utils.rand_name('server')
# Update the server with a new name
- resp, server = self.client.update_server(server_id,
- name=new_name)
+ self.client.update_server(server_id,
+ name=new_name)
self.client.wait_for_server_status(server_id, status)
# Verify the name of the server has changed
- resp, server = self.client.get_server(server_id)
+ server = self.client.get_server(server_id)
self.assertEqual(new_name, server['name'])
return server
@test.attr(type='gate')
def test_update_server_name(self):
# The server name should be changed to the the provided value
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
self._update_server_name(server['id'], 'ACTIVE')
@test.attr(type='gate')
def test_update_server_name_in_stop_state(self):
# The server name should be changed to the the provided value
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
self.client.stop(server['id'])
self.client.wait_for_server_status(server['id'], 'SHUTOFF')
updated_server = self._update_server_name(server['id'], 'SHUTOFF')
@@ -102,25 +101,23 @@
@test.attr(type='gate')
def test_update_access_server_address(self):
# The server's access addresses should reflect the provided values
- resp, server = self.create_test_server(wait_until='ACTIVE')
+ server = self.create_test_server(wait_until='ACTIVE')
# Update the IPv4 and IPv6 access addresses
- resp, body = self.client.update_server(server['id'],
- accessIPv4='1.1.1.1',
- accessIPv6='::babe:202:202')
- self.assertEqual(200, resp.status)
+ self.client.update_server(server['id'],
+ accessIPv4='1.1.1.1',
+ accessIPv6='::babe:202:202')
self.client.wait_for_server_status(server['id'], 'ACTIVE')
# Verify the access addresses have been updated
- resp, server = self.client.get_server(server['id'])
+ server = self.client.get_server(server['id'])
self.assertEqual('1.1.1.1', server['accessIPv4'])
self.assertEqual('::babe:202:202', server['accessIPv6'])
@test.attr(type='gate')
def test_create_server_with_ipv6_addr_only(self):
# Create a server without an IPv4 address(only IPv6 address).
- resp, server = self.create_test_server(accessIPv6='2001:2001::3')
- self.assertEqual('202', resp['status'])
+ server = self.create_test_server(accessIPv6='2001:2001::3')
self.client.wait_for_server_status(server['id'], 'ACTIVE')
- resp, server = self.client.get_server(server['id'])
+ server = self.client.get_server(server['id'])
self.assertEqual('2001:2001::3', server['accessIPv6'])
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index 845a71e..d89aff4 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -22,7 +22,6 @@
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
@@ -47,14 +46,14 @@
cls.client = cls.servers_client
cls.alt_os = clients.Manager(cls.isolated_creds.get_alt_creds())
cls.alt_client = cls.alt_os.servers_client
- resp, server = cls.create_test_server(wait_until='ACTIVE')
+ server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
@test.attr(type=['negative', 'gate'])
def test_server_name_blank(self):
# Create a server with name parameter empty
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
name='')
@@ -66,7 +65,7 @@
person = [{'path': '/etc/testfile.txt',
'contents': file_contents}]
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
personality=person)
@@ -74,7 +73,7 @@
def test_create_with_invalid_image(self):
# Create a server with an unknown image
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
image_id=-1)
@@ -82,7 +81,7 @@
def test_create_with_invalid_flavor(self):
# Create a server with an unknown flavor
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
flavor=-1,)
@@ -91,7 +90,7 @@
# An access IPv4 address must match a valid address pattern
IPv4 = '1.1.1.1.1.1'
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server, accessIPv4=IPv4)
@test.attr(type=['negative', 'gate'])
@@ -100,7 +99,7 @@
IPv6 = 'notvalid'
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server, accessIPv6=IPv6)
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
@@ -119,7 +118,7 @@
def test_resize_server_with_non_existent_flavor(self):
# Resize a server with non-existent flavor
nonexistent_flavor = data_utils.rand_uuid()
- self.assertRaises(exceptions.BadRequest, self.client.resize,
+ self.assertRaises(lib_exc.BadRequest, self.client.resize,
self.server_id, flavor_ref=nonexistent_flavor)
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
@@ -127,7 +126,7 @@
@test.attr(type=['negative', 'gate'])
def test_resize_server_with_null_flavor(self):
# Resize a server with null flavor
- self.assertRaises(exceptions.BadRequest, self.client.resize,
+ self.assertRaises(lib_exc.BadRequest, self.client.resize,
self.server_id, flavor_ref="")
@test.attr(type=['negative', 'gate'])
@@ -152,7 +151,7 @@
@test.attr(type=['negative', 'gate'])
def test_rebuild_reboot_deleted_server(self):
# Rebuild and Reboot a deleted server
- _, server = self.create_test_server()
+ server = self.create_test_server()
self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@@ -174,7 +173,7 @@
@test.attr(type=['negative', 'gate'])
def test_create_numeric_server_name(self):
server_name = 12345
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
name=server_name)
@@ -183,7 +182,7 @@
# Create a server with name length exceeding 256 characters
server_name = 'a' * 256
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
name=server_name)
@@ -193,7 +192,7 @@
networks = [{'fixed_ip': '10.0.1.1', 'uuid': 'a-b-c-d-e-f-g-h-i-j'}]
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
networks=networks)
@@ -202,7 +201,7 @@
# Pass a non-existent keypair while creating a server
key_name = data_utils.rand_name('key')
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
key_name=key_name)
@@ -211,7 +210,7 @@
# Pass really long metadata while creating a server
metadata = {'a': 'b' * 260}
- self.assertRaises((exceptions.BadRequest, lib_exc.OverLimit),
+ self.assertRaises((lib_exc.BadRequest, lib_exc.OverLimit),
self.create_test_server,
meta=metadata)
@@ -232,7 +231,7 @@
server_name = data_utils.rand_name('server')
new_name = ''
- self.assertRaises(exceptions.BadRequest, self.client.update_server,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_server,
server_name, name=new_name)
@test.attr(type=['negative', 'gate'])
@@ -249,7 +248,7 @@
# Update name of server exceed the name length limit
new_name = 'a' * 256
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_server,
self.server_id,
name=new_name)
@@ -287,7 +286,7 @@
# Create a server with a nonexistent security group
security_groups = [{'name': 'does_not_exist'}]
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
security_groups=security_groups)
@@ -429,7 +428,7 @@
self.client.wait_for_server_status(self.server_id,
'SHELVED')
- resp, server = self.client.get_server(self.server_id)
+ server = self.client.get_server(self.server_id)
image_name = server['name'] + '-shelved'
params = {'name': image_name}
images = self.images_client.list_images(params)
diff --git a/tempest/api/compute/servers/test_virtual_interfaces.py b/tempest/api/compute/servers/test_virtual_interfaces.py
index e07a7ed..5c76ba7 100644
--- a/tempest/api/compute/servers/test_virtual_interfaces.py
+++ b/tempest/api/compute/servers/test_virtual_interfaces.py
@@ -26,12 +26,20 @@
class VirtualInterfacesTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
# This test needs a network and a subnet
cls.set_network_resources(network=True, subnet=True)
- super(VirtualInterfacesTestJSON, cls).resource_setup()
+ super(VirtualInterfacesTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(VirtualInterfacesTestJSON, cls).setup_clients()
cls.client = cls.servers_client
- resp, server = cls.create_test_server(wait_until='ACTIVE')
+
+ @classmethod
+ def resource_setup(cls):
+ super(VirtualInterfacesTestJSON, cls).resource_setup()
+ server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
@decorators.skip_because(bug="1183436",
diff --git a/tempest/api/compute/servers/test_virtual_interfaces_negative.py b/tempest/api/compute/servers/test_virtual_interfaces_negative.py
index d66b7ba..58c4fcd 100644
--- a/tempest/api/compute/servers/test_virtual_interfaces_negative.py
+++ b/tempest/api/compute/servers/test_virtual_interfaces_negative.py
@@ -24,10 +24,14 @@
class VirtualInterfacesNegativeTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
# For this test no network resources are needed
cls.set_network_resources()
- super(VirtualInterfacesNegativeTestJSON, cls).resource_setup()
+ super(VirtualInterfacesNegativeTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(VirtualInterfacesNegativeTestJSON, cls).setup_clients()
cls.client = cls.servers_client
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index 16b7ed2..1211db3 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -21,7 +21,6 @@
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
from tempest import test
@@ -31,32 +30,44 @@
class AuthorizationTestJSON(base.BaseV2ComputeTest):
+
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(AuthorizationTestJSON, cls).skip_checks()
if not CONF.service_available.glance:
raise cls.skipException('Glance is not available.')
+
+ @classmethod
+ def setup_credentials(cls):
# No network resources required for this test
cls.set_network_resources()
- super(AuthorizationTestJSON, cls).resource_setup()
+ super(AuthorizationTestJSON, cls).setup_credentials()
if not cls.multi_user:
msg = "Need >1 user"
raise cls.skipException(msg)
+
+ creds = cls.isolated_creds.get_alt_creds()
+ cls.alt_manager = clients.Manager(credentials=creds)
+
+ @classmethod
+ def setup_clients(cls):
+ super(AuthorizationTestJSON, cls).setup_clients()
cls.client = cls.os.servers_client
cls.images_client = cls.os.images_client
cls.glance_client = cls.os.image_client
cls.keypairs_client = cls.os.keypairs_client
cls.security_client = cls.os.security_groups_client
- creds = cls.isolated_creds.get_alt_creds()
- cls.alt_manager = clients.Manager(credentials=creds)
-
cls.alt_client = cls.alt_manager.servers_client
cls.alt_images_client = cls.alt_manager.images_client
cls.alt_keypairs_client = cls.alt_manager.keypairs_client
cls.alt_security_client = cls.alt_manager.security_groups_client
- resp, server = cls.create_test_server(wait_until='ACTIVE')
- resp, cls.server = cls.client.get_server(server['id'])
+ @classmethod
+ def resource_setup(cls):
+ super(AuthorizationTestJSON, cls).resource_setup()
+ server = cls.create_test_server(wait_until='ACTIVE')
+ cls.server = cls.client.get_server(server['id'])
name = data_utils.rand_name('image')
body = cls.glance_client.create_image(name=name,
@@ -168,7 +179,7 @@
@test.attr(type='gate')
def test_create_server_with_unauthorized_image(self):
# Server creation with another user's image should fail
- self.assertRaises(exceptions.BadRequest, self.alt_client.create_server,
+ self.assertRaises(lib_exc.BadRequest, self.alt_client.create_server,
'test', self.image['id'], self.flavor_ref)
@test.attr(type='gate')
@@ -180,7 +191,7 @@
request_part='url',
auth_data=self.client.auth_provider.auth_data
)
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.alt_client.create_server, 'test',
self.image['id'], self.flavor_ref)
@@ -198,7 +209,7 @@
)
resp = {}
resp['status'] = None
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.alt_keypairs_client.create_keypair, k_name)
finally:
# Next request the base_url is back to normal
@@ -249,7 +260,7 @@
)
resp = {}
resp['status'] = None
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.alt_security_client.create_security_group,
s_name, s_description)
finally:
@@ -290,7 +301,7 @@
)
resp = {}
resp['status'] = None
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.alt_security_client.
create_security_group_rule,
parent_group_id, ip_protocol, from_port,
diff --git a/tempest/api/compute/test_extensions.py b/tempest/api/compute/test_extensions.py
index 46e7251..f40ae9f 100644
--- a/tempest/api/compute/test_extensions.py
+++ b/tempest/api/compute/test_extensions.py
@@ -32,8 +32,7 @@
# List of all extensions
if len(CONF.compute_feature_enabled.api_extensions) == 0:
raise self.skipException('There are not any extensions configured')
- resp, extensions = self.extensions_client.list_extensions()
- self.assertEqual(200, resp.status)
+ extensions = self.extensions_client.list_extensions()
ext = CONF.compute_feature_enabled.api_extensions[0]
if ext == 'all':
self.assertIn('Hosts', map(lambda x: x['name'], extensions))
@@ -49,6 +48,5 @@
@test.attr(type='gate')
def test_get_extension(self):
# get the specified extensions
- resp, extension = self.extensions_client.get_extension('os-consoles')
- self.assertEqual(200, resp.status)
+ extension = self.extensions_client.get_extension('os-consoles')
self.assertEqual('os-consoles', extension['alias'])
diff --git a/tempest/api/compute/test_live_block_migration.py b/tempest/api/compute/test_live_block_migration.py
index eb71d6d..6da6b79 100644
--- a/tempest/api/compute/test_live_block_migration.py
+++ b/tempest/api/compute/test_live_block_migration.py
@@ -44,7 +44,7 @@
]
def _get_server_details(self, server_id):
- _resp, body = self.admin_servers_client.get_server(server_id)
+ body = self.admin_servers_client.get_server(server_id)
return body
def _get_host_for_server(self, server_id):
@@ -69,10 +69,8 @@
if 'ACTIVE' == self._get_server_status(server_id):
return server_id
else:
- _, server = self.create_test_server(wait_until="ACTIVE")
+ server = self.create_test_server(wait_until="ACTIVE")
server_id = server['id']
- self.password = server['adminPass']
- self.password = 'password'
self.created_server_ids.append(server_id)
return server_id
diff --git a/tempest/api/compute/test_live_block_migration_negative.py b/tempest/api/compute/test_live_block_migration_negative.py
index 281b2b3..586bc5c 100644
--- a/tempest/api/compute/test_live_block_migration_negative.py
+++ b/tempest/api/compute/test_live_block_migration_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
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
@@ -45,9 +45,9 @@
def test_invalid_host_for_migration(self):
# Migrating to an invalid host should not change the status
target_host = data_utils.rand_name('host-')
- _, server = self.create_test_server(wait_until="ACTIVE")
+ server = self.create_test_server(wait_until="ACTIVE")
server_id = server['id']
- self.assertRaises(exceptions.BadRequest, self._migrate_server_to,
+ self.assertRaises(lib_exc.BadRequest, self._migrate_server_to,
server_id, target_host)
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 40b93a8..5b15a08 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -30,14 +30,22 @@
self.attachment = None
@classmethod
- def resource_setup(cls):
- cls.prepare_instance_network()
- super(AttachVolumeTestJSON, cls).resource_setup()
- cls.device = CONF.compute.volume_device_name
+ def skip_checks(cls):
+ super(AttachVolumeTestJSON, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+ @classmethod
+ def setup_credentials(cls):
+ cls.prepare_instance_network()
+ super(AttachVolumeTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def resource_setup(cls):
+ super(AttachVolumeTestJSON, cls).resource_setup()
+ cls.device = CONF.compute.volume_device_name
+
def _detach(self, server_id, volume_id):
if self.attachment:
self.servers_client.detach_volume(server_id, volume_id)
@@ -53,8 +61,8 @@
def _create_and_attach(self):
# Start a server and wait for it to become ready
admin_pass = self.image_ssh_password
- _, self.server = self.create_test_server(wait_until='ACTIVE',
- adminPass=admin_pass)
+ self.server = self.create_test_server(wait_until='ACTIVE',
+ adminPass=admin_pass)
# Record addresses so that we can ssh later
_, self.server['addresses'] = (
diff --git a/tempest/api/compute/volumes/test_volumes_get.py b/tempest/api/compute/volumes/test_volumes_get.py
index 69998d2..aa4fb52 100644
--- a/tempest/api/compute/volumes/test_volumes_get.py
+++ b/tempest/api/compute/volumes/test_volumes_get.py
@@ -27,13 +27,17 @@
class VolumesGetTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesGetTestJSON, cls).resource_setup()
- cls.client = cls.volumes_extensions_client
+ def skip_checks(cls):
+ super(VolumesGetTestJSON, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+ @classmethod
+ def setup_clients(cls):
+ super(VolumesGetTestJSON, cls).setup_clients()
+ cls.client = cls.volumes_extensions_client
+
@test.attr(type='smoke')
def test_volume_create_get_delete(self):
# CREATE, GET, DELETE Volume
diff --git a/tempest/api/compute/volumes/test_volumes_list.py b/tempest/api/compute/volumes/test_volumes_list.py
index ba7ee6b..cb74876 100644
--- a/tempest/api/compute/volumes/test_volumes_list.py
+++ b/tempest/api/compute/volumes/test_volumes_list.py
@@ -32,12 +32,20 @@
"""
@classmethod
- def resource_setup(cls):
- super(VolumesTestJSON, cls).resource_setup()
- cls.client = cls.volumes_extensions_client
+ def skip_checks(cls):
+ super(VolumesTestJSON, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+
+ @classmethod
+ def setup_clients(cls):
+ super(VolumesTestJSON, cls).setup_clients()
+ cls.client = cls.volumes_extensions_client
+
+ @classmethod
+ def resource_setup(cls):
+ super(VolumesTestJSON, cls).resource_setup()
# Create 3 Volumes
cls.volume_list = []
cls.volume_id_list = []
diff --git a/tempest/api/compute/volumes/test_volumes_negative.py b/tempest/api/compute/volumes/test_volumes_negative.py
index 53253c9..53217c9 100644
--- a/tempest/api/compute/volumes/test_volumes_negative.py
+++ b/tempest/api/compute/volumes/test_volumes_negative.py
@@ -20,7 +20,6 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -29,13 +28,17 @@
class VolumesNegativeTest(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesNegativeTest, cls).resource_setup()
- cls.client = cls.volumes_extensions_client
+ def skip_checks(cls):
+ super(VolumesNegativeTest, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+ @classmethod
+ def setup_clients(cls):
+ super(VolumesNegativeTest, cls).setup_clients()
+ cls.client = cls.volumes_extensions_client
+
@test.attr(type=['negative', 'gate'])
def test_volume_get_nonexistent_volume_id(self):
# Negative: Should not be able to get details of nonexistent volume
@@ -58,7 +61,7 @@
# in request
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.BadRequest, self.client.create_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
size='#$%', display_name=v_name, metadata=metadata)
@test.attr(type=['negative', 'gate'])
@@ -67,7 +70,7 @@
# in request
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.BadRequest, self.client.create_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
size='', display_name=v_name, metadata=metadata)
@test.attr(type=['negative', 'gate'])
@@ -75,7 +78,7 @@
# Negative: Should not be able to create volume with size zero
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.BadRequest, self.client.create_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
size='0', display_name=v_name, metadata=metadata)
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/database/base.py b/tempest/api/database/base.py
index 4f085b7..31c5d2a 100644
--- a/tempest/api/database/base.py
+++ b/tempest/api/database/base.py
@@ -25,19 +25,29 @@
"""Base test case class for all Database API tests."""
@classmethod
- def resource_setup(cls):
- super(BaseDatabaseTest, cls).resource_setup()
+ def skip_checks(cls):
+ super(BaseDatabaseTest, cls).skip_checks()
if not CONF.service_available.trove:
skip_msg = ("%s skipped as trove is not available" % cls.__name__)
raise cls.skipException(skip_msg)
- cls.catalog_type = CONF.database.catalog_type
- cls.db_flavor_ref = CONF.database.db_flavor_ref
- cls.db_current_version = CONF.database.db_current_version
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseDatabaseTest, cls).setup_credentials()
+ cls.os = cls.get_client_manager()
- os = cls.get_client_manager()
- cls.os = os
+ @classmethod
+ def setup_clients(cls):
+ super(BaseDatabaseTest, cls).setup_clients()
cls.database_flavors_client = cls.os.database_flavors_client
cls.os_flavors_client = cls.os.flavors_client
cls.database_limits_client = cls.os.database_limits_client
cls.database_versions_client = cls.os.database_versions_client
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseDatabaseTest, cls).resource_setup()
+
+ cls.catalog_type = CONF.database.catalog_type
+ cls.db_flavor_ref = CONF.database.db_flavor_ref
+ cls.db_current_version = CONF.database.db_current_version
diff --git a/tempest/api/database/flavors/test_flavors.py b/tempest/api/database/flavors/test_flavors.py
index ed172e9..bb7035b 100644
--- a/tempest/api/database/flavors/test_flavors.py
+++ b/tempest/api/database/flavors/test_flavors.py
@@ -20,8 +20,8 @@
class DatabaseFlavorsTest(base.BaseDatabaseTest):
@classmethod
- def resource_setup(cls):
- super(DatabaseFlavorsTest, cls).resource_setup()
+ def setup_clients(cls):
+ super(DatabaseFlavorsTest, cls).setup_clients()
cls.client = cls.database_flavors_client
@test.attr(type='smoke')
diff --git a/tempest/api/database/flavors/test_flavors_negative.py b/tempest/api/database/flavors/test_flavors_negative.py
index c6acacf..bb9c05d 100644
--- a/tempest/api/database/flavors/test_flavors_negative.py
+++ b/tempest/api/database/flavors/test_flavors_negative.py
@@ -22,8 +22,8 @@
class DatabaseFlavorsNegativeTest(base.BaseDatabaseTest):
@classmethod
- def resource_setup(cls):
- super(DatabaseFlavorsNegativeTest, cls).resource_setup()
+ def setup_clients(cls):
+ super(DatabaseFlavorsNegativeTest, cls).setup_clients()
cls.client = cls.database_flavors_client
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/database/versions/test_versions.py b/tempest/api/database/versions/test_versions.py
index 3a32d0f..37a7407 100644
--- a/tempest/api/database/versions/test_versions.py
+++ b/tempest/api/database/versions/test_versions.py
@@ -20,8 +20,8 @@
class DatabaseVersionsTest(base.BaseDatabaseTest):
@classmethod
- def resource_setup(cls):
- super(DatabaseVersionsTest, cls).resource_setup()
+ def setup_clients(cls):
+ super(DatabaseVersionsTest, cls).setup_clients()
cls.client = cls.database_versions_client
@test.attr(type='smoke')
diff --git a/tempest/api/identity/admin/test_roles_negative.py b/tempest/api/identity/admin/test_roles_negative.py
index 2c51715..c38e6e0 100644
--- a/tempest/api/identity/admin/test_roles_negative.py
+++ b/tempest/api/identity/admin/test_roles_negative.py
@@ -18,7 +18,6 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -49,7 +48,7 @@
@test.attr(type=['negative', 'gate'])
def test_role_create_blank_name(self):
# Should not be able to create a role with a blank name
- self.assertRaises(exceptions.BadRequest, self.client.create_role, '')
+ self.assertRaises(lib_exc.BadRequest, self.client.create_role, '')
@test.attr(type=['negative', 'gate'])
def test_create_role_by_unauthorized_user(self):
diff --git a/tempest/api/identity/admin/test_tenant_negative.py b/tempest/api/identity/admin/test_tenant_negative.py
index 16ea96a..db51f14 100644
--- a/tempest/api/identity/admin/test_tenant_negative.py
+++ b/tempest/api/identity/admin/test_tenant_negative.py
@@ -18,7 +18,6 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -99,14 +98,14 @@
@test.attr(type=['negative', 'gate'])
def test_create_tenant_with_empty_name(self):
# Tenant name should not be empty
- self.assertRaises(exceptions.BadRequest, self.client.create_tenant,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_tenant,
name='')
@test.attr(type=['negative', 'gate'])
def test_create_tenants_name_length_over_64(self):
# Tenant name length should not be greater than 64 characters
tenant_name = 'a' * 65
- self.assertRaises(exceptions.BadRequest, self.client.create_tenant,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_tenant,
tenant_name)
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/identity/admin/test_users_negative.py b/tempest/api/identity/admin/test_users_negative.py
index db8c564..99993b9 100644
--- a/tempest/api/identity/admin/test_users_negative.py
+++ b/tempest/api/identity/admin/test_users_negative.py
@@ -18,7 +18,6 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -44,7 +43,7 @@
def test_create_user_with_empty_name(self):
# User with an empty name should not be created
self.data.setup_test_tenant()
- self.assertRaises(exceptions.BadRequest, self.client.create_user, '',
+ self.assertRaises(lib_exc.BadRequest, self.client.create_user, '',
self.alt_password, self.data.tenant['id'],
self.alt_email)
@@ -52,7 +51,7 @@
def test_create_user_with_name_length_over_255(self):
# Length of user name filed should be restricted to 255 characters
self.data.setup_test_tenant()
- self.assertRaises(exceptions.BadRequest, self.client.create_user,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_user,
'a' * 256, self.alt_password,
self.data.tenant['id'], self.alt_email)
@@ -91,7 +90,7 @@
# Attempt to create a user with valid enabled para should fail
self.data.setup_test_tenant()
name = data_utils.rand_name('test_user_')
- self.assertRaises(exceptions.BadRequest, self.client.create_user,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_user,
name, self.alt_password,
self.data.tenant['id'],
self.alt_email, enabled=3)
diff --git a/tempest/api/identity/admin/v3/test_endpoints_negative.py b/tempest/api/identity/admin/v3/test_endpoints_negative.py
index 9846010..cf41f9c 100644
--- a/tempest/api/identity/admin/v3/test_endpoints_negative.py
+++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py
@@ -14,10 +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.identity import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -50,7 +50,7 @@
interface = 'public'
url = data_utils.rand_url()
region = data_utils.rand_name('region')
- self.assertRaises(exceptions.BadRequest, self.client.create_endpoint,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_endpoint,
self.service_id, interface, url, region=region,
force_enabled='False')
@@ -60,7 +60,7 @@
interface = 'public'
url = data_utils.rand_url()
region = data_utils.rand_name('region')
- self.assertRaises(exceptions.BadRequest, self.client.create_endpoint,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_endpoint,
self.service_id, interface, url, region=region,
force_enabled='True')
@@ -75,7 +75,7 @@
url1, region=region1, enabled=True))
self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
- self.assertRaises(exceptions.BadRequest, self.client.update_endpoint,
+ self.assertRaises(lib_exc.BadRequest, self.client.update_endpoint,
endpoint_for_update['id'], force_enabled=enabled)
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/identity/admin/v3/test_projects_negative.py b/tempest/api/identity/admin/v3/test_projects_negative.py
index fc013c5..a194198 100644
--- a/tempest/api/identity/admin/v3/test_projects_negative.py
+++ b/tempest/api/identity/admin/v3/test_projects_negative.py
@@ -17,7 +17,6 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -50,14 +49,14 @@
@test.attr(type=['negative', 'gate'])
def test_create_project_with_empty_name(self):
# Project name should not be empty
- self.assertRaises(exceptions.BadRequest, self.client.create_project,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_project,
name='')
@test.attr(type=['negative', 'gate'])
def test_create_projects_name_length_over_64(self):
# Project name length should not be greater than 64 characters
project_name = 'a' * 65
- self.assertRaises(exceptions.BadRequest, self.client.create_project,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_project,
project_name)
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py
index 15ca21e..747911b 100644
--- a/tempest/api/identity/admin/v3/test_roles.py
+++ b/tempest/api/identity/admin/v3/test_roles.py
@@ -139,9 +139,11 @@
self.client.add_group_user(self.group_body['id'], self.user_body['id'])
self.addCleanup(self.client.delete_group_user,
self.group_body['id'], self.user_body['id'])
- body = self.token.auth(self.user_body['id'], self.u_password,
- self.project['name'],
- domain=self.domain['name'])
+ body = self.token.auth(user=self.user_body['id'],
+ password=self.u_password,
+ user_domain=self.domain['name'],
+ project=self.project['name'],
+ project_domain=self.domain['name'])
roles = body['token']['roles']
self.assertEqual(len(roles), 1)
self.assertEqual(roles[0]['id'], self.role['id'])
diff --git a/tempest/api/identity/admin/v3/test_tokens.py b/tempest/api/identity/admin/v3/test_tokens.py
index 36be098..919eab9 100644
--- a/tempest/api/identity/admin/v3/test_tokens.py
+++ b/tempest/api/identity/admin/v3/test_tokens.py
@@ -108,8 +108,8 @@
# Use the unscoped token to get a scoped token.
token_auth = self.token.auth(token=token_id,
- tenant=project1_name,
- domain='Default')
+ project=project1_name,
+ project_domain='Default')
token1_id = token_auth.response['x-subject-token']
self.assertEqual(orig_expires_at, token_auth['token']['expires_at'],
@@ -138,8 +138,8 @@
# Now get another scoped token using the unscoped token.
token_auth = self.token.auth(token=token_id,
- tenant=project2_name,
- domain='Default')
+ project=project2_name,
+ project_domain='Default')
self.assertEqual(project2['id'],
token_auth['token']['project']['id'])
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index fd62004..48201ec 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -20,7 +20,6 @@
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 timeutils
from tempest import test
@@ -237,7 +236,7 @@
# is rejected with the correct error
# with an expiry specified
expires_str = 'bad.123Z'
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_trust,
expires=expires_str)
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 344742b..ffc3071 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -31,16 +31,24 @@
"""Base test class for Image API tests."""
@classmethod
+ def skip_checks(cls):
+ super(BaseImageTest, cls).skip_checks()
+ if not CONF.service_available.glance:
+ skip_msg = ("%s skipped as glance is not available" % cls.__name__)
+ raise cls.skipException(skip_msg)
+
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseImageTest, cls).setup_credentials()
+ cls.isolated_creds = credentials.get_isolated_credentials(
+ cls.__name__, network_resources=cls.network_resources)
+ cls.os = clients.Manager(cls.isolated_creds.get_primary_creds())
+
+ @classmethod
def resource_setup(cls):
cls.set_network_resources()
super(BaseImageTest, cls).resource_setup()
cls.created_images = []
- cls.isolated_creds = credentials.get_isolated_credentials(
- cls.__name__, network_resources=cls.network_resources)
- if not CONF.service_available.glance:
- skip_msg = ("%s skipped as glance is not available" % cls.__name__)
- raise cls.skipException(skip_msg)
- cls.os = clients.Manager(cls.isolated_creds.get_primary_creds())
@classmethod
def resource_cleanup(cls):
@@ -75,21 +83,33 @@
class BaseV1ImageTest(BaseImageTest):
@classmethod
- def resource_setup(cls):
- super(BaseV1ImageTest, cls).resource_setup()
- cls.client = cls.os.image_client
+ def skip_checks(cls):
+ super(BaseV1ImageTest, cls).skip_checks()
if not CONF.image_feature_enabled.api_v1:
msg = "Glance API v1 not supported"
raise cls.skipException(msg)
+ @classmethod
+ def setup_clients(cls):
+ super(BaseV1ImageTest, cls).setup_clients()
+ cls.client = cls.os.image_client
+
class BaseV1ImageMembersTest(BaseV1ImageTest):
+
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseV1ImageMembersTest, cls).setup_credentials()
+ cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseV1ImageMembersTest, cls).setup_clients()
+ cls.alt_img_cli = cls.os_alt.image_client
+
@classmethod
def resource_setup(cls):
super(BaseV1ImageMembersTest, cls).resource_setup()
- cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
-
- cls.alt_img_cli = cls.os_alt.image_client
cls.alt_tenant_id = cls.alt_img_cli.tenant_id
def _create_image(self):
@@ -105,23 +125,35 @@
class BaseV2ImageTest(BaseImageTest):
@classmethod
- def resource_setup(cls):
- super(BaseV2ImageTest, cls).resource_setup()
- cls.client = cls.os.image_client_v2
+ def skip_checks(cls):
+ super(BaseV2ImageTest, cls).skip_checks()
if not CONF.image_feature_enabled.api_v2:
msg = "Glance API v2 not supported"
raise cls.skipException(msg)
+ @classmethod
+ def setup_clients(cls):
+ super(BaseV2ImageTest, cls).setup_clients()
+ cls.client = cls.os.image_client_v2
+
class BaseV2MemberImageTest(BaseV2ImageTest):
@classmethod
- def resource_setup(cls):
- super(BaseV2MemberImageTest, cls).resource_setup()
+ def setup_credentials(cls):
+ super(BaseV2MemberImageTest, cls).setup_credentials()
creds = cls.isolated_creds.get_alt_creds()
cls.os_alt = clients.Manager(creds)
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseV2MemberImageTest, cls).setup_clients()
cls.os_img_client = cls.os.image_client_v2
cls.alt_img_client = cls.os_alt.image_client_v2
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseV2MemberImageTest, cls).resource_setup()
cls.alt_tenant_id = cls.alt_img_client.tenant_id
def _list_image_ids_as_alt(self):
diff --git a/tempest/api/image/v1/test_images_negative.py b/tempest/api/image/v1/test_images_negative.py
index b144a83..698bac0 100644
--- a/tempest/api/image/v1/test_images_negative.py
+++ b/tempest/api/image/v1/test_images_negative.py
@@ -16,7 +16,6 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.image import base
-from tempest import exceptions
from tempest import test
@@ -26,12 +25,12 @@
@test.attr(type=['negative', 'gate'])
def test_register_with_invalid_container_format(self):
# Negative tests for invalid data supplied to POST /images
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_image,
'test', 'wrong', 'vhd')
@test.attr(type=['negative', 'gate'])
def test_register_with_invalid_disk_format(self):
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_image,
'test', 'bare', 'wrong')
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index e307c5c..6b654ca 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -65,8 +65,8 @@
self.assertEqual(1024, body.get('size'))
# Now try get image file
- _, body = self.client.get_image_file(image_id)
- self.assertEqual(file_content, body)
+ body = self.client.get_image_file(image_id)
+ self.assertEqual(file_content, body.data)
@test.attr(type='gate')
def test_delete_image(self):
diff --git a/tempest/api/image/v2/test_images_member_negative.py b/tempest/api/image/v2/test_images_member_negative.py
index 4402af9..068a6e5 100644
--- a/tempest/api/image/v2/test_images_member_negative.py
+++ b/tempest/api/image/v2/test_images_member_negative.py
@@ -13,7 +13,6 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.image import base
-from tempest import exceptions
from tempest import test
@@ -25,7 +24,7 @@
member = self.os_img_client.add_member(image_id,
self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.alt_img_client.update_member_status,
image_id, self.alt_tenant_id, 'notavalidstatus')
diff --git a/tempest/api/image/v2/test_images_negative.py b/tempest/api/image/v2/test_images_negative.py
index d32fc3b..9f0ad2d 100644
--- a/tempest/api/image/v2/test_images_negative.py
+++ b/tempest/api/image/v2/test_images_negative.py
@@ -19,7 +19,6 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.image import base
-from tempest import exceptions
from tempest import test
@@ -85,10 +84,10 @@
@test.attr(type=['negative', 'gate'])
def test_register_with_invalid_container_format(self):
# Negative tests for invalid data supplied to POST /images
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_image,
'test', 'wrong', 'vhd')
@test.attr(type=['negative', 'gate'])
def test_register_with_invalid_disk_format(self):
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_image,
'test', 'bare', 'wrong')
diff --git a/tempest/api/messaging/base.py b/tempest/api/messaging/base.py
index 58511a9..eae0707 100644
--- a/tempest/api/messaging/base.py
+++ b/tempest/api/messaging/base.py
@@ -35,13 +35,25 @@
"""
@classmethod
- def resource_setup(cls):
- super(BaseMessagingTest, cls).resource_setup()
+ def skip_checks(cls):
+ super(BaseMessagingTest, cls).skip_checks()
if not CONF.service_available.zaqar:
raise cls.skipException("Zaqar support is required")
- os = cls.get_client_manager()
+
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseMessagingTest, cls).setup_credentials()
+ cls.os = cls.get_client_manager()
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseMessagingTest, cls).setup_clients()
+ cls.client = cls.os.messaging_client
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseMessagingTest, cls).resource_setup()
cls.messaging_cfg = CONF.messaging
- cls.client = os.messaging_client
@classmethod
def create_queue(cls, queue_name):
diff --git a/tempest/api/network/admin/test_routers_dvr.py b/tempest/api/network/admin/test_routers_dvr.py
new file mode 100644
index 0000000..c6d8165
--- /dev/null
+++ b/tempest/api/network/admin/test_routers_dvr.py
@@ -0,0 +1,98 @@
+# Copyright 2015 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.api.network import base_routers as base
+from tempest.common.utils import data_utils
+from tempest import test
+
+
+class RoutersTestDVR(base.BaseRouterTest):
+
+ @classmethod
+ def resource_setup(cls):
+ for ext in ['router', 'dvr']:
+ if not test.is_extension_enabled(ext, 'network'):
+ msg = "%s extension not enabled." % ext
+ raise cls.skipException(msg)
+ # The check above will pass if api_extensions=all, which does
+ # not mean DVR extension itself is present.
+ # Instead, we have to check whether DVR is actually present by using
+ # admin credentials to create router with distributed=True attribute
+ # and checking for BadRequest exception and that the resulting router
+ # has a distributed attribute.
+ super(RoutersTestDVR, cls).resource_setup()
+ name = data_utils.rand_name('pretest-check')
+ router = cls.admin_client.create_router(name)
+ if 'distributed' not in router['router']:
+ msg = "'distributed' attribute not found. DVR Possibly not enabled"
+ raise cls.skipException(msg)
+ cls.admin_client.delete_router(router['router']['id'])
+
+ @test.attr(type='smoke')
+ def test_distributed_router_creation(self):
+ """
+ Test uses administrative credentials to creates a
+ DVR (Distributed Virtual Routing) router using the
+ distributed=True.
+
+ Acceptance
+ The router is created and the "distributed" attribute is
+ set to True
+ """
+ name = data_utils.rand_name('router')
+ router = self.admin_client.create_router(name, distributed=True)
+ self.addCleanup(self.admin_client.delete_router,
+ router['router']['id'])
+ self.assertTrue(router['router']['distributed'])
+
+ @test.attr(type='smoke')
+ def test_centralized_router_creation(self):
+ """
+ Test uses administrative credentials to creates a
+ CVR (Centralized Virtual Routing) router using the
+ distributed=False.
+
+ Acceptance
+ The router is created and the "distributed" attribute is
+ set to False, thus making it a "Centralized Virtual Router"
+ as opposed to a "Distributed Virtual Router"
+ """
+ name = data_utils.rand_name('router')
+ router = self.admin_client.create_router(name, distributed=False)
+ self.addCleanup(self.admin_client.delete_router,
+ router['router']['id'])
+ self.assertFalse(router['router']['distributed'])
+
+ @test.attr(type='smoke')
+ def test_centralized_router_update_to_dvr(self):
+ """
+ Test uses administrative credentials to creates a
+ CVR (Centralized Virtual Routing) router using the
+ distributed=False.Then it will "update" the router
+ distributed attribute to True
+
+ Acceptance
+ The router is created and the "distributed" attribute is
+ set to False. Once the router is updated, the distributed
+ attribute will be set to True
+ """
+ name = data_utils.rand_name('router')
+ router = self.admin_client.create_router(name, distributed=False)
+ self.addCleanup(self.admin_client.delete_router,
+ router['router']['id'])
+ self.assertFalse(router['router']['distributed'])
+ router = self.admin_client.update_router(router['router']['id'],
+ distributed=True)
+ self.assertTrue(router['router']['distributed'])
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 4cb1485..e8c8de3 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -223,7 +223,7 @@
gateway_ip=gateway_ip,
**kwargs)
break
- except exceptions.BadRequest as e:
+ except lib_exc.BadRequest as e:
is_overlapping_cidr = 'overlaps with another subnet' in str(e)
if not is_overlapping_cidr:
raise
diff --git a/tempest/api/network/test_dhcp_ipv6.py b/tempest/api/network/test_dhcp_ipv6.py
index f7a6fb7..1b28bac 100644
--- a/tempest/api/network/test_dhcp_ipv6.py
+++ b/tempest/api/network/test_dhcp_ipv6.py
@@ -21,7 +21,6 @@
from tempest.api.network import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
CONF = config.CONF
@@ -146,7 +145,7 @@
):
kwargs = {'ipv6_ra_mode': ra_mode,
'ipv6_address_mode': add_mode}
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_subnet,
self.network,
**kwargs)
@@ -329,7 +328,7 @@
subnet["allocation_pools"][0]["end"])
ip = netaddr.IPAddress(random.randrange(
ip_range.last + 1, ip_range.last + 10)).format()
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.create_port,
self.network,
fixed_ips=[{'subnet_id': subnet['id'],
diff --git a/tempest/api/network/test_floating_ips_negative.py b/tempest/api/network/test_floating_ips_negative.py
index 81eedd4..7d70976 100644
--- a/tempest/api/network/test_floating_ips_negative.py
+++ b/tempest/api/network/test_floating_ips_negative.py
@@ -19,7 +19,6 @@
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
@@ -59,7 +58,7 @@
@test.attr(type=['negative', 'smoke'])
def test_create_floatingip_in_private_network(self):
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.create_floatingip,
floating_network_id=self.network['id'],
port_id=self.port['id'],
diff --git a/tempest/api/network/test_routers_negative.py b/tempest/api/network/test_routers_negative.py
index 655fa58..67a6c94 100644
--- a/tempest/api/network/test_routers_negative.py
+++ b/tempest/api/network/test_routers_negative.py
@@ -19,7 +19,6 @@
from tempest.api.network import base_routers as base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -54,7 +53,7 @@
network_name=data_utils.rand_name('router-negative-'))
sub_cidr = netaddr.IPNetwork(self.tenant_cidr).next()
self.create_subnet(alt_network, cidr=sub_cidr)
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.update_router,
self.router['id'],
external_gateway_info={
@@ -70,7 +69,7 @@
subnet02 = self.create_subnet(network02)
self._add_router_interface_with_subnet_id(self.router['id'],
subnet01['id'])
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self._add_router_interface_with_subnet_id,
self.router['id'],
subnet02['id'])
diff --git a/tempest/api/network/test_security_groups.py b/tempest/api/network/test_security_groups.py
index 3d26b48..f9af3cc 100644
--- a/tempest/api/network/test_security_groups.py
+++ b/tempest/api/network/test_security_groups.py
@@ -162,7 +162,7 @@
"""Verify security group rule for icmp protocol works.
Specify icmp type (port_range_min) and icmp code
- (port_range_max) with different values. A seperate testcase
+ (port_range_max) with different values. A separate testcase
is added for icmp protocol as icmp validation would be
different from tcp/udp.
"""
diff --git a/tempest/api/network/test_security_groups_negative.py b/tempest/api/network/test_security_groups_negative.py
index 47b218c..0da1aac 100644
--- a/tempest/api/network/test_security_groups_negative.py
+++ b/tempest/api/network/test_security_groups_negative.py
@@ -19,7 +19,6 @@
from tempest.api.network import base_security_groups as base
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
@@ -64,7 +63,7 @@
# Create rule with bad protocol name
pname = 'bad_protocol_name'
self.assertRaises(
- exceptions.BadRequest, self.client.create_security_group_rule,
+ lib_exc.BadRequest, self.client.create_security_group_rule,
security_group_id=group_create_body['security_group']['id'],
protocol=pname, direction='ingress', ethertype=self.ethertype)
@@ -76,7 +75,7 @@
prefix = ['192.168.1./24', '192.168.1.1/33', 'bad_prefix', '256']
for remote_ip_prefix in prefix:
self.assertRaises(
- exceptions.BadRequest, self.client.create_security_group_rule,
+ lib_exc.BadRequest, self.client.create_security_group_rule,
security_group_id=group_create_body['security_group']['id'],
protocol='tcp', direction='ingress', ethertype=self.ethertype,
remote_ip_prefix=remote_ip_prefix)
@@ -103,7 +102,7 @@
# Create rule specifying both remote_ip_prefix and remote_group_id
prefix = self._tenant_network_cidr
self.assertRaises(
- exceptions.BadRequest, self.client.create_security_group_rule,
+ lib_exc.BadRequest, self.client.create_security_group_rule,
security_group_id=sg1_body['security_group']['id'],
protocol='tcp', direction='ingress',
ethertype=self.ethertype, remote_ip_prefix=prefix,
@@ -116,7 +115,7 @@
# Create rule with bad ethertype
ethertype = 'bad_ethertype'
self.assertRaises(
- exceptions.BadRequest, self.client.create_security_group_rule,
+ lib_exc.BadRequest, self.client.create_security_group_rule,
security_group_id=group_create_body['security_group']['id'],
protocol='udp', direction='ingress', ethertype=ethertype)
@@ -132,7 +131,7 @@
(-16, 65536, 'Invalid value for port')]
for pmin, pmax, msg in states:
ex = self.assertRaises(
- exceptions.BadRequest, self.client.create_security_group_rule,
+ lib_exc.BadRequest, self.client.create_security_group_rule,
security_group_id=group_create_body['security_group']['id'],
protocol='tcp', port_range_min=pmin, port_range_max=pmax,
direction='ingress', ethertype=self.ethertype)
@@ -144,7 +143,7 @@
(300, 1, 'Invalid value for ICMP type')]
for pmin, pmax, msg in states:
ex = self.assertRaises(
- exceptions.BadRequest, self.client.create_security_group_rule,
+ lib_exc.BadRequest, self.client.create_security_group_rule,
security_group_id=group_create_body['security_group']['id'],
protocol='icmp', port_range_min=pmin, port_range_max=pmax,
direction='ingress', ethertype=self.ethertype)
@@ -207,7 +206,7 @@
'ip_prefix': CONF.network.tenant_network_v6_cidr})
for pair in pairs:
self.assertRaisesRegexp(
- exceptions.BadRequest,
+ lib_exc.BadRequest,
"Conflicting value ethertype",
self.client.create_security_group_rule,
security_group_id=group_create_body['security_group']['id'],
diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py
index 79a1960..6a025d9 100644
--- a/tempest/api/object_storage/base.py
+++ b/tempest/api/object_storage/base.py
@@ -28,21 +28,31 @@
class BaseObjectTest(tempest.test.BaseTestCase):
@classmethod
- def resource_setup(cls):
- cls.set_network_resources()
- super(BaseObjectTest, cls).resource_setup()
+ def skip_checks(cls):
+ super(BaseObjectTest, cls).skip_checks()
if not CONF.service_available.swift:
skip_msg = ("%s skipped as swift is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+
+ @classmethod
+ def setup_credentials(cls):
+ cls.set_network_resources()
+ super(BaseObjectTest, cls).setup_credentials()
+
cls.isolated_creds = credentials.get_isolated_credentials(
cls.__name__, network_resources=cls.network_resources)
# Get isolated creds for normal user
cls.os = clients.Manager(cls.isolated_creds.get_primary_creds())
# Get isolated creds for admin user
cls.os_admin = clients.Manager(cls.isolated_creds.get_admin_creds())
+ cls.data = SwiftDataGenerator(cls.os_admin.identity_client)
# Get isolated creds for alt user
cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
+ @classmethod
+ def setup_clients(cls):
+ super(BaseObjectTest, cls).setup_clients()
+
cls.object_client = cls.os.object_client
cls.container_client = cls.os.container_client
cls.account_client = cls.os.account_client
@@ -52,6 +62,10 @@
cls.container_client_alt = cls.os_alt.container_client
cls.identity_client_alt = cls.os_alt.identity_client
+ @classmethod
+ def resource_setup(cls):
+ super(BaseObjectTest, cls).resource_setup()
+
# Make sure we get fresh auth data after assigning swift role
cls.object_client.auth_provider.clear_auth()
cls.container_client.auth_provider.clear_auth()
@@ -59,8 +73,6 @@
cls.object_client_alt.auth_provider.clear_auth()
cls.container_client_alt.auth_provider.clear_auth()
- cls.data = SwiftDataGenerator(cls.identity_admin_client)
-
@classmethod
def resource_cleanup(cls):
cls.data.teardown_all()
diff --git a/tempest/api/object_storage/test_account_quotas.py b/tempest/api/object_storage/test_account_quotas.py
index 1832b37..e3f5f3d 100644
--- a/tempest/api/object_storage/test_account_quotas.py
+++ b/tempest/api/object_storage/test_account_quotas.py
@@ -26,15 +26,17 @@
class AccountQuotasTest(base.BaseObjectTest):
@classmethod
+ def setup_credentials(cls):
+ super(AccountQuotasTest, cls).setup_credentials()
+ cls.data.setup_test_user(reseller=True)
+ cls.os_reselleradmin = clients.Manager(cls.data.test_credentials)
+
+ @classmethod
def resource_setup(cls):
super(AccountQuotasTest, cls).resource_setup()
cls.container_name = data_utils.rand_name(name="TestContainer")
cls.container_client.create_container(cls.container_name)
- cls.data.setup_test_user(reseller=True)
-
- cls.os_reselleradmin = clients.Manager(cls.data.test_credentials)
-
# Retrieve a ResellerAdmin auth data and use it to set a quota
# on the client's account
cls.reselleradmin_auth_data = \
diff --git a/tempest/api/object_storage/test_account_quotas_negative.py b/tempest/api/object_storage/test_account_quotas_negative.py
index 0e136bf..783bf1a 100644
--- a/tempest/api/object_storage/test_account_quotas_negative.py
+++ b/tempest/api/object_storage/test_account_quotas_negative.py
@@ -29,15 +29,17 @@
class AccountQuotasNegativeTest(base.BaseObjectTest):
@classmethod
+ def setup_credentials(cls):
+ super(AccountQuotasNegativeTest, cls).setup_credentials()
+ cls.data.setup_test_user(reseller=True)
+ cls.os_reselleradmin = clients.Manager(cls.data.test_credentials)
+
+ @classmethod
def resource_setup(cls):
super(AccountQuotasNegativeTest, cls).resource_setup()
cls.container_name = data_utils.rand_name(name="TestContainer")
cls.container_client.create_container(cls.container_name)
- cls.data.setup_test_user(reseller=True)
-
- cls.os_reselleradmin = clients.Manager(cls.data.test_credentials)
-
# Retrieve a ResellerAdmin auth data and use it to set a quota
# on the client's account
cls.reselleradmin_auth_data = \
diff --git a/tempest/api/object_storage/test_container_acl.py b/tempest/api/object_storage/test_container_acl.py
index 205bc91..44763a1 100644
--- a/tempest/api/object_storage/test_container_acl.py
+++ b/tempest/api/object_storage/test_container_acl.py
@@ -20,12 +20,17 @@
class ObjectTestACLs(base.BaseObjectTest):
+
+ @classmethod
+ def setup_credentials(cls):
+ super(ObjectTestACLs, cls).setup_credentials()
+ cls.data.setup_test_user()
+ cls.test_os = clients.Manager(cls.data.test_credentials)
+
@classmethod
def resource_setup(cls):
super(ObjectTestACLs, cls).resource_setup()
- cls.data.setup_test_user()
- test_os = clients.Manager(cls.data.test_credentials)
- cls.test_auth_data = test_os.auth_provider.auth_data
+ cls.test_auth_data = cls.test_os.auth_provider.auth_data
def setUp(self):
super(ObjectTestACLs, self).setUp()
diff --git a/tempest/api/object_storage/test_container_acl_negative.py b/tempest/api/object_storage/test_container_acl_negative.py
index 7fe472c..edc052e 100644
--- a/tempest/api/object_storage/test_container_acl_negative.py
+++ b/tempest/api/object_storage/test_container_acl_negative.py
@@ -23,12 +23,17 @@
class ObjectACLsNegativeTest(base.BaseObjectTest):
+
+ @classmethod
+ def setup_credentials(cls):
+ super(ObjectACLsNegativeTest, cls).setup_credentials()
+ cls.data.setup_test_user()
+ cls.test_os = clients.Manager(cls.data.test_credentials)
+
@classmethod
def resource_setup(cls):
super(ObjectACLsNegativeTest, cls).resource_setup()
- cls.data.setup_test_user()
- test_os = clients.Manager(cls.data.test_credentials)
- cls.test_auth_data = test_os.auth_provider.auth_data
+ cls.test_auth_data = cls.test_os.auth_provider.auth_data
def setUp(self):
super(ObjectACLsNegativeTest, self).setUp()
diff --git a/tempest/api/object_storage/test_healthcheck.py b/tempest/api/object_storage/test_healthcheck.py
index 53c0347..6fbd77b 100644
--- a/tempest/api/object_storage/test_healthcheck.py
+++ b/tempest/api/object_storage/test_healthcheck.py
@@ -22,10 +22,6 @@
class HealthcheckTest(base.BaseObjectTest):
- @classmethod
- def resource_setup(cls):
- super(HealthcheckTest, cls).resource_setup()
-
def setUp(self):
super(HealthcheckTest, self).setUp()
# Turning http://.../v1/foobar into http://.../
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index 6873756..b8b0562 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -30,14 +30,19 @@
"""Base test case class for all Orchestration API tests."""
@classmethod
- def resource_setup(cls):
- super(BaseOrchestrationTest, cls).resource_setup()
- cls.os = clients.Manager()
+ def skip_checks(cls):
+ super(BaseOrchestrationTest, cls).skip_checks()
if not CONF.service_available.heat:
raise cls.skipException("Heat support is required")
- cls.build_timeout = CONF.orchestration.build_timeout
- cls.build_interval = CONF.orchestration.build_interval
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseOrchestrationTest, cls).setup_credentials()
+ cls.os = clients.Manager()
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseOrchestrationTest, cls).setup_clients()
cls.orchestration_client = cls.os.orchestration_client
cls.client = cls.orchestration_client
cls.servers_client = cls.os.servers_client
@@ -45,6 +50,12 @@
cls.network_client = cls.os.network_client
cls.volumes_client = cls.os.volumes_client
cls.images_v2_client = cls.os.image_client_v2
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseOrchestrationTest, cls).resource_setup()
+ cls.build_timeout = CONF.orchestration.build_timeout
+ cls.build_interval = CONF.orchestration.build_interval
cls.stacks = []
cls.keypairs = []
cls.images = []
diff --git a/tempest/api/orchestration/stacks/test_limits.py b/tempest/api/orchestration/stacks/test_limits.py
index 8ee62ab..5f7f954 100644
--- a/tempest/api/orchestration/stacks/test_limits.py
+++ b/tempest/api/orchestration/stacks/test_limits.py
@@ -11,11 +11,11 @@
# under the License.
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
CONF = config.CONF
@@ -34,7 +34,7 @@
Description: '%s'
Outputs:
Foo: bar''' % fill
- ex = self.assertRaises(exceptions.BadRequest, self.create_stack,
+ ex = self.assertRaises(lib_exc.BadRequest, self.create_stack,
stack_name, template)
self.assertIn('Template exceeds maximum allowed size', str(ex))
@@ -48,6 +48,6 @@
for i in range(num_resources):
template += rsrc_snippet % i
- ex = self.assertRaises(exceptions.BadRequest, self.create_stack,
+ ex = self.assertRaises(lib_exc.BadRequest, self.create_stack,
stack_name, template)
self.assertIn('Maximum resources per stack exceeded', str(ex))
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index ea6d4be..3987ee3 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -30,15 +30,27 @@
class NeutronResourcesTestJSON(base.BaseOrchestrationTest):
@classmethod
- def resource_setup(cls):
- super(NeutronResourcesTestJSON, cls).resource_setup()
+ def skip_checks(cls):
+ super(NeutronResourcesTestJSON, cls).skip_checks()
if not CONF.orchestration.image_ref:
raise cls.skipException("No image available to test")
- os = clients.Manager()
if not CONF.service_available.neutron:
raise cls.skipException("Neutron support is required")
+
+ @classmethod
+ def setup_credentials(cls):
+ super(NeutronResourcesTestJSON, cls).setup_credentials()
+ cls.os = clients.Manager()
+
+ @classmethod
+ def setup_clients(cls):
+ super(NeutronResourcesTestJSON, cls).setup_clients()
+ cls.network_client = cls.os.network_client
+
+ @classmethod
+ def resource_setup(cls):
+ super(NeutronResourcesTestJSON, cls).resource_setup()
cls.neutron_basic_template = cls.load_template('neutron_basic')
- cls.network_client = os.network_client
cls.stack_name = data_utils.rand_name('heat')
template = cls.read_template('neutron_basic')
cls.keypair_name = (CONF.orchestration.keypair_name or
@@ -173,7 +185,7 @@
def test_created_server(self):
"""Verifies created sever."""
server_id = self.test_resources.get('Server')['physical_resource_id']
- _, server = self.servers_client.get_server(server_id)
+ server = self.servers_client.get_server(server_id)
self.assertEqual(self.keypair_name, server['key_name'])
self.assertEqual('ACTIVE', server['status'])
network = server['addresses'][self.neutron_basic_template['resources'][
diff --git a/tempest/api/orchestration/stacks/test_swift_resources.py b/tempest/api/orchestration/stacks/test_swift_resources.py
index 0288fd4..83abc91 100644
--- a/tempest/api/orchestration/stacks/test_swift_resources.py
+++ b/tempest/api/orchestration/stacks/test_swift_resources.py
@@ -26,15 +26,27 @@
class SwiftResourcesTestJSON(base.BaseOrchestrationTest):
@classmethod
+ def skip_checks(cls):
+ super(SwiftResourcesTestJSON, cls).skip_checks()
+ if not CONF.service_available.swift:
+ raise cls.skipException("Swift support is required")
+
+ @classmethod
+ def setup_credentials(cls):
+ super(SwiftResourcesTestJSON, cls).setup_credentials()
+ cls.os = clients.Manager()
+
+ @classmethod
+ def setup_clients(cls):
+ super(SwiftResourcesTestJSON, cls).setup_clients()
+ cls.account_client = cls.os.account_client
+ cls.container_client = cls.os.container_client
+
+ @classmethod
def resource_setup(cls):
super(SwiftResourcesTestJSON, cls).resource_setup()
cls.stack_name = data_utils.rand_name('heat')
template = cls.read_template('swift_basic')
- os = clients.Manager()
- if not CONF.service_available.swift:
- raise cls.skipException("Swift support is required")
- cls.account_client = os.account_client
- cls.container_client = os.container_client
# create the stack
cls.stack_identifier = cls.create_stack(
cls.stack_name,
diff --git a/tempest/api/orchestration/stacks/test_templates_negative.py b/tempest/api/orchestration/stacks/test_templates_negative.py
index 9082107..9a5bc68 100644
--- a/tempest/api/orchestration/stacks/test_templates_negative.py
+++ b/tempest/api/orchestration/stacks/test_templates_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.orchestration import base
-from tempest import exceptions
from tempest import test
@@ -37,7 +38,7 @@
@test.attr(type=['gate', 'negative'])
def test_validate_template_url(self):
"""Validating template passing url to it."""
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.validate_template_url,
template_url=self.invalid_template_url,
parameters=self.parameters)
diff --git a/tempest/api/orchestration/stacks/test_volumes.py b/tempest/api/orchestration/stacks/test_volumes.py
index 322bdf1..8356497 100644
--- a/tempest/api/orchestration/stacks/test_volumes.py
+++ b/tempest/api/orchestration/stacks/test_volumes.py
@@ -27,8 +27,8 @@
class CinderResourcesTest(base.BaseOrchestrationTest):
@classmethod
- def resource_setup(cls):
- super(CinderResourcesTest, cls).resource_setup()
+ def skip_checks(cls):
+ super(CinderResourcesTest, cls).skip_checks()
if not CONF.service_available.cinder:
raise cls.skipException('Cinder support is required')
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index dc7a8f5..c521b37 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -28,18 +28,29 @@
"""Base test case class for all Telemetry API tests."""
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(BaseTelemetryTest, cls).skip_checks()
if not CONF.service_available.ceilometer:
raise cls.skipException("Ceilometer support is required")
- cls.set_network_resources()
- super(BaseTelemetryTest, cls).resource_setup()
- os = cls.get_client_manager()
- cls.telemetry_client = os.telemetry_client
- cls.servers_client = os.servers_client
- cls.flavors_client = os.flavors_client
- cls.image_client = os.image_client
- cls.image_client_v2 = os.image_client_v2
+ @classmethod
+ def setup_credentials(cls):
+ cls.set_network_resources()
+ super(BaseTelemetryTest, cls).setup_credentials()
+ cls.os = cls.get_client_manager()
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseTelemetryTest, cls).setup_clients()
+ cls.telemetry_client = cls.os.telemetry_client
+ cls.servers_client = cls.os.servers_client
+ cls.flavors_client = cls.os.flavors_client
+ cls.image_client = cls.os.image_client
+ cls.image_client_v2 = cls.os.image_client_v2
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseTelemetryTest, cls).resource_setup()
cls.nova_notifications = ['memory', 'vcpus', 'disk.root.size',
'disk.ephemeral.size']
@@ -62,12 +73,12 @@
@classmethod
def create_server(cls):
- resp, body = cls.servers_client.create_server(
+ body = cls.servers_client.create_server(
data_utils.rand_name('ceilometer-instance'),
CONF.compute.image_ref, CONF.compute.flavor_ref,
wait_until='ACTIVE')
cls.server_ids.append(body['id'])
- return resp, body
+ return body
@classmethod
def create_image(cls, client):
diff --git a/tempest/api/telemetry/test_telemetry_alarming_api.py b/tempest/api/telemetry/test_telemetry_alarming_api.py
index 05aed08..cb2d2bd 100644
--- a/tempest/api/telemetry/test_telemetry_alarming_api.py
+++ b/tempest/api/telemetry/test_telemetry_alarming_api.py
@@ -80,12 +80,12 @@
# Set alarm state and verify
new_state =\
[elem for elem in alarm_states if elem != alarm['state']][0]
- _, state = self.telemetry_client.alarm_set_state(alarm['alarm_id'],
- new_state)
- self.assertEqual(new_state, state)
+ state = self.telemetry_client.alarm_set_state(alarm['alarm_id'],
+ new_state)
+ self.assertEqual(new_state, state.data)
# Get alarm state and verify
- _, state = self.telemetry_client.alarm_get_state(alarm['alarm_id'])
- self.assertEqual(new_state, state)
+ state = self.telemetry_client.alarm_get_state(alarm['alarm_id'])
+ self.assertEqual(new_state, state.data)
@test.attr(type="gate")
def test_create_delete_alarm_with_combination_rule(self):
diff --git a/tempest/api/telemetry/test_telemetry_notification_api.py b/tempest/api/telemetry/test_telemetry_notification_api.py
index 147020e..a0256af 100644
--- a/tempest/api/telemetry/test_telemetry_notification_api.py
+++ b/tempest/api/telemetry/test_telemetry_notification_api.py
@@ -23,19 +23,18 @@
class TelemetryNotificationAPITestJSON(base.BaseTelemetryTest):
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(TelemetryNotificationAPITestJSON, cls).skip_checks()
if CONF.telemetry.too_slow_to_test:
raise cls.skipException("Ceilometer feature for fast work mysql "
"is disabled")
- super(TelemetryNotificationAPITestJSON, cls).resource_setup()
@test.attr(type="gate")
@testtools.skipIf(not CONF.service_available.nova,
"Nova is not available.")
def test_check_nova_notification(self):
- resp, body = self.create_server()
- self.assertEqual(resp.status, 202)
+ body = self.create_server()
query = ('resource', 'eq', body['id'])
diff --git a/tempest/api/volume/admin/test_multi_backend.py b/tempest/api/volume/admin/test_multi_backend.py
index 245161a..32cdb01 100644
--- a/tempest/api/volume/admin/test_multi_backend.py
+++ b/tempest/api/volume/admin/test_multi_backend.py
@@ -24,11 +24,16 @@
class VolumeMultiBackendV2Test(base.BaseVolumeAdminTest):
@classmethod
- def resource_setup(cls):
- super(VolumeMultiBackendV2Test, cls).resource_setup()
+ def skip_checks(cls):
+ super(VolumeMultiBackendV2Test, cls).skip_checks()
+
if not CONF.volume_feature_enabled.multi_backend:
raise cls.skipException("Cinder multi-backend feature disabled")
+ @classmethod
+ def resource_setup(cls):
+ super(VolumeMultiBackendV2Test, cls).resource_setup()
+
cls.backend1_name = CONF.volume.backend1_name
cls.backend2_name = CONF.volume.backend2_name
diff --git a/tempest/api/volume/admin/test_snapshots_actions.py b/tempest/api/volume/admin/test_snapshots_actions.py
index e7d9d7b..a4b4e3e 100644
--- a/tempest/api/volume/admin/test_snapshots_actions.py
+++ b/tempest/api/volume/admin/test_snapshots_actions.py
@@ -21,9 +21,13 @@
class SnapshotsActionsV2Test(base.BaseVolumeAdminTest):
@classmethod
+ def setup_clients(cls):
+ super(SnapshotsActionsV2Test, cls).setup_clients()
+ cls.client = cls.snapshots_client
+
+ @classmethod
def resource_setup(cls):
super(SnapshotsActionsV2Test, cls).resource_setup()
- cls.client = cls.snapshots_client
# Create a test shared volume for tests
vol_name = data_utils.rand_name(cls.__name__ + '-Volume-')
diff --git a/tempest/api/volume/admin/test_volume_quotas.py b/tempest/api/volume/admin/test_volume_quotas.py
index 2a30b54..f41a97e 100644
--- a/tempest/api/volume/admin/test_volume_quotas.py
+++ b/tempest/api/volume/admin/test_volume_quotas.py
@@ -26,8 +26,8 @@
force_tenant_isolation = True
@classmethod
- def resource_setup(cls):
- super(BaseVolumeQuotasAdminV2TestJSON, cls).resource_setup()
+ def setup_credentials(cls):
+ super(BaseVolumeQuotasAdminV2TestJSON, cls).setup_credentials()
cls.demo_tenant_id = cls.isolated_creds.get_primary_creds().tenant_id
@test.attr(type='gate')
diff --git a/tempest/api/volume/admin/test_volume_quotas_negative.py b/tempest/api/volume/admin/test_volume_quotas_negative.py
index f972457..e37d8f2 100644
--- a/tempest/api/volume/admin/test_volume_quotas_negative.py
+++ b/tempest/api/volume/admin/test_volume_quotas_negative.py
@@ -23,10 +23,14 @@
force_tenant_isolation = True
@classmethod
+ def setup_credentials(cls):
+ super(BaseVolumeQuotasNegativeV2TestJSON, cls).setup_credentials()
+ cls.demo_user = cls.isolated_creds.get_primary_creds()
+ cls.demo_tenant_id = cls.demo_user.tenant_id
+
+ @classmethod
def resource_setup(cls):
super(BaseVolumeQuotasNegativeV2TestJSON, cls).resource_setup()
- demo_user = cls.isolated_creds.get_primary_creds()
- cls.demo_tenant_id = demo_user.tenant_id
cls.shared_quota_set = {'gigabytes': 3, 'volumes': 1, 'snapshots': 1}
# NOTE(gfidente): no need to restore original quota set
diff --git a/tempest/api/volume/admin/test_volume_types.py b/tempest/api/volume/admin/test_volume_types.py
index f2c1dda..d4062cc 100644
--- a/tempest/api/volume/admin/test_volume_types.py
+++ b/tempest/api/volume/admin/test_volume_types.py
@@ -37,45 +37,54 @@
self.assertIsInstance(body, list)
@test.attr(type='smoke')
- def test_create_get_delete_volume_with_volume_type_and_extra_specs(self):
- # Create/get/delete volume with volume_type and extra spec.
- volume = {}
+ def test_volume_crud_with_volume_type_and_extra_specs(self):
+ # Create/update/get/delete volume with volume_type and extra spec.
+ volume_types = list()
vol_name = data_utils.rand_name("volume-")
- vol_type_name = data_utils.rand_name("volume-type-")
self.name_field = self.special_fields['name_field']
proto = CONF.volume.storage_protocol
vendor = CONF.volume.vendor_name
extra_specs = {"storage_protocol": proto,
"vendor_name": vendor}
- body = {}
- body = self.volume_types_client.create_volume_type(
- vol_type_name,
- extra_specs=extra_specs)
- self.assertIn('id', body)
- self.addCleanup(self._delete_volume_type, body['id'])
- self.assertIn('name', body)
- params = {self.name_field: vol_name, 'volume_type': vol_type_name}
- volume = self.volumes_client.create_volume(
- size=1, **params)
- self.assertIn('id', volume)
+ # Create two volume_types
+ for i in range(2):
+ vol_type_name = data_utils.rand_name("volume-type-")
+ vol_type = self.volume_types_client.create_volume_type(
+ vol_type_name,
+ extra_specs=extra_specs)
+ volume_types.append(vol_type)
+ self.addCleanup(self._delete_volume_type, vol_type['id'])
+ params = {self.name_field: vol_name,
+ 'volume_type': volume_types[0]['id']}
+
+ # Create volume
+ volume = self.volumes_client.create_volume(size=1, **params)
self.addCleanup(self._delete_volume, volume['id'])
- self.assertIn(self.name_field, volume)
+ self.assertEqual(volume_types[0]['name'], volume["volume_type"])
self.assertEqual(volume[self.name_field], vol_name,
"The created volume name is not equal "
"to the requested name")
- self.assertTrue(volume['id'] is not None,
- "Field volume id is empty or not found.")
+ self.assertIsNotNone(volume['id'],
+ "Field volume id is empty or not found.")
self.volumes_client.wait_for_volume_status(volume['id'], 'available')
+
+ # Update volume with new volume_type
+ self.volumes_client.retype_volume(volume['id'],
+ volume_type=volume_types[1]['id'])
+ self.volumes_client.wait_for_volume_status(volume['id'], 'available')
+
+ # Get volume details and Verify
fetched_volume = self.volumes_client.get_volume(volume['id'])
+ self.assertEqual(volume_types[1]['name'],
+ fetched_volume['volume_type'],
+ 'The fetched Volume type is different '
+ 'from updated volume type')
self.assertEqual(vol_name, fetched_volume[self.name_field],
'The fetched Volume is different '
'from the created Volume')
self.assertEqual(volume['id'], fetched_volume['id'],
'The fetched Volume is different '
'from the created Volume')
- self.assertEqual(vol_type_name, fetched_volume['volume_type'],
- 'The fetched Volume is different '
- 'from the created Volume')
@test.attr(type='smoke')
def test_volume_type_create_get_delete(self):
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 2f3b382..23979cd 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
@@ -19,7 +19,6 @@
from tempest.api.volume import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
@@ -44,7 +43,7 @@
# Should not update volume type extra specs with no body
extra_spec = {"spec1": "val2"}
self.assertRaises(
- exceptions.BadRequest,
+ lib_exc.BadRequest,
self.volume_types_client.update_volume_type_extra_specs,
self.volume_type['id'], extra_spec.keys()[0], None)
@@ -53,7 +52,7 @@
# Should not update volume type extra specs with nonexistent id.
extra_spec = {"spec1": "val2"}
self.assertRaises(
- exceptions.BadRequest,
+ lib_exc.BadRequest,
self.volume_types_client.update_volume_type_extra_specs,
self.volume_type['id'], str(uuid.uuid4()),
extra_spec)
@@ -63,7 +62,7 @@
# Should not update volume type extra specs with none id.
extra_spec = {"spec1": "val2"}
self.assertRaises(
- exceptions.BadRequest,
+ lib_exc.BadRequest,
self.volume_types_client.update_volume_type_extra_specs,
self.volume_type['id'], None, extra_spec)
@@ -73,7 +72,7 @@
# body.
extra_spec = {"spec1": "val2", 'spec2': 'val1'}
self.assertRaises(
- exceptions.BadRequest,
+ lib_exc.BadRequest,
self.volume_types_client.update_volume_type_extra_specs,
self.volume_type['id'], extra_spec.keys()[0],
extra_spec)
@@ -92,7 +91,7 @@
def test_create_none_body(self):
# Should not create volume type extra spec for none POST body.
self.assertRaises(
- exceptions.BadRequest,
+ lib_exc.BadRequest,
self.volume_types_client.create_volume_type_extra_specs,
self.volume_type['id'], None)
@@ -100,7 +99,7 @@
def test_create_invalid_body(self):
# Should not create volume type extra spec for invalid POST body.
self.assertRaises(
- exceptions.BadRequest,
+ lib_exc.BadRequest,
self.volume_types_client.create_volume_type_extra_specs,
self.volume_type['id'], ['invalid'])
diff --git a/tempest/api/volume/admin/test_volume_types_negative.py b/tempest/api/volume/admin/test_volume_types_negative.py
index 77ca34c..a40f1c4 100644
--- a/tempest/api/volume/admin/test_volume_types_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_negative.py
@@ -18,7 +18,6 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.volume import base
-from tempest import exceptions
from tempest import test
@@ -37,7 +36,7 @@
@test.attr(type='gate')
def test_create_with_empty_name(self):
# Should not be able to create volume type with an empty name.
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.volume_types_client.create_volume_type, '')
@test.attr(type='gate')
diff --git a/tempest/api/volume/admin/test_volumes_actions.py b/tempest/api/volume/admin/test_volumes_actions.py
index 439dd35..fb16872 100644
--- a/tempest/api/volume/admin/test_volumes_actions.py
+++ b/tempest/api/volume/admin/test_volumes_actions.py
@@ -21,9 +21,13 @@
class VolumesActionsV2Test(base.BaseVolumeAdminTest):
@classmethod
+ def setup_clients(cls):
+ super(VolumesActionsV2Test, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesActionsV2Test, cls).resource_setup()
- cls.client = cls.volumes_client
# Create a test shared volume for tests
vol_name = utils.rand_name(cls.__name__ + '-Volume-')
diff --git a/tempest/api/volume/admin/test_volumes_backup.py b/tempest/api/volume/admin/test_volumes_backup.py
index d572893..4db9f7e 100644
--- a/tempest/api/volume/admin/test_volumes_backup.py
+++ b/tempest/api/volume/admin/test_volumes_backup.py
@@ -26,12 +26,15 @@
class VolumesBackupsV2Test(base.BaseVolumeAdminTest):
@classmethod
- def resource_setup(cls):
- super(VolumesBackupsV2Test, cls).resource_setup()
-
+ def skip_checks(cls):
+ super(VolumesBackupsV2Test, cls).skip_checks()
if not CONF.volume_feature_enabled.backup:
raise cls.skipException("Cinder backup feature disabled")
+ @classmethod
+ def resource_setup(cls):
+ super(VolumesBackupsV2Test, cls).resource_setup()
+
cls.volume = cls.create_volume()
@test.attr(type='smoke')
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 2489b79..c672607 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -33,28 +33,37 @@
_api_version = 2
@classmethod
- def resource_setup(cls):
- cls.set_network_resources()
- super(BaseVolumeTest, cls).resource_setup()
+ def skip_checks(cls):
+ super(BaseVolumeTest, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
-
- cls.os = cls.get_client_manager()
-
- cls.servers_client = cls.os.servers_client
- cls.image_ref = CONF.compute.image_ref
- cls.flavor_ref = CONF.compute.flavor_ref
- cls.build_interval = CONF.volume.build_interval
- cls.build_timeout = CONF.volume.build_timeout
- cls.snapshots = []
- cls.volumes = []
-
if cls._api_version == 1:
if not CONF.volume_feature_enabled.api_v1:
msg = "Volume API v1 is disabled"
raise cls.skipException(msg)
+ elif cls._api_version == 2:
+ if not CONF.volume_feature_enabled.api_v2:
+ msg = "Volume API v2 is disabled"
+ raise cls.skipException(msg)
+ else:
+ msg = ("Invalid Cinder API version (%s)" % cls._api_version)
+ raise exceptions.InvalidConfiguration(message=msg)
+
+ @classmethod
+ def setup_credentials(cls):
+ cls.set_network_resources()
+ super(BaseVolumeTest, cls).setup_credentials()
+ cls.os = cls.get_client_manager()
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseVolumeTest, cls).setup_clients()
+
+ cls.servers_client = cls.os.servers_client
+
+ if cls._api_version == 1:
cls.snapshots_client = cls.os.snapshots_client
cls.volumes_client = cls.os.volumes_client
cls.backups_client = cls.os.backups_client
@@ -62,27 +71,33 @@
cls.volumes_extension_client = cls.os.volumes_extension_client
cls.availability_zone_client = (
cls.os.volume_availability_zone_client)
- # Special fields and resp code for cinder v1
- cls.special_fields = {'name_field': 'display_name',
- 'descrip_field': 'display_description'}
-
- elif cls._api_version == 2:
- if not CONF.volume_feature_enabled.api_v2:
- msg = "Volume API v2 is disabled"
- raise cls.skipException(msg)
+ else:
cls.snapshots_client = cls.os.snapshots_v2_client
cls.volumes_client = cls.os.volumes_v2_client
cls.volumes_extension_client = cls.os.volumes_v2_extension_client
cls.availability_zone_client = (
cls.os.volume_v2_availability_zone_client)
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseVolumeTest, cls).resource_setup()
+
+ cls.snapshots = []
+ cls.volumes = []
+ cls.image_ref = CONF.compute.image_ref
+ cls.flavor_ref = CONF.compute.flavor_ref
+ cls.build_interval = CONF.volume.build_interval
+ cls.build_timeout = CONF.volume.build_timeout
+
+ if cls._api_version == 1:
+ # Special fields and resp code for cinder v1
+ cls.special_fields = {'name_field': 'display_name',
+ 'descrip_field': 'display_description'}
+ else:
# Special fields and resp code for cinder v2
cls.special_fields = {'name_field': 'name',
'descrip_field': 'description'}
- else:
- msg = ("Invalid Cinder API version (%s)" % cls._api_version)
- raise exceptions.InvalidConfiguration(message=msg)
-
@classmethod
def resource_cleanup(cls):
cls.clear_snapshots()
@@ -148,10 +163,10 @@
class BaseVolumeAdminTest(BaseVolumeTest):
"""Base test case class for all Volume Admin API tests."""
- @classmethod
- def resource_setup(cls):
- super(BaseVolumeAdminTest, cls).resource_setup()
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseVolumeAdminTest, cls).setup_credentials()
try:
cls.adm_creds = cls.isolated_creds.get_admin_creds()
cls.os_adm = clients.Manager(credentials=cls.adm_creds)
@@ -159,12 +174,11 @@
msg = "Missing Volume Admin API credentials in configuration."
raise cls.skipException(msg)
- cls.qos_specs = []
+ @classmethod
+ def setup_clients(cls):
+ super(BaseVolumeAdminTest, cls).setup_clients()
if cls._api_version == 1:
- if not CONF.volume_feature_enabled.api_v1:
- msg = "Volume API v1 is disabled"
- raise cls.skipException(msg)
cls.volume_qos_client = cls.os_adm.volume_qos_client
cls.admin_volume_services_client = \
cls.os_adm.volume_services_client
@@ -175,9 +189,6 @@
cls.backups_adm_client = cls.os_adm.backups_client
cls.quotas_client = cls.os_adm.volume_quotas_client
elif cls._api_version == 2:
- if not CONF.volume_feature_enabled.api_v2:
- msg = "Volume API v2 is disabled"
- raise cls.skipException(msg)
cls.volume_qos_client = cls.os_adm.volume_qos_v2_client
cls.admin_volume_services_client = \
cls.os_adm.volume_services_v2_client
@@ -189,6 +200,12 @@
cls.quotas_client = cls.os_adm.volume_quotas_v2_client
@classmethod
+ def resource_setup(cls):
+ super(BaseVolumeAdminTest, cls).resource_setup()
+
+ cls.qos_specs = []
+
+ @classmethod
def resource_cleanup(cls):
cls.clear_qos_specs()
super(BaseVolumeAdminTest, cls).resource_cleanup()
diff --git a/tempest/api/volume/test_availability_zone.py b/tempest/api/volume/test_availability_zone.py
index bd3d2a1..b6e226d 100644
--- a/tempest/api/volume/test_availability_zone.py
+++ b/tempest/api/volume/test_availability_zone.py
@@ -24,8 +24,8 @@
"""
@classmethod
- def resource_setup(cls):
- super(AvailabilityZoneV2TestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(AvailabilityZoneV2TestJSON, cls).setup_clients()
cls.client = cls.availability_zone_client
@test.attr(type='gate')
diff --git a/tempest/api/volume/test_snapshot_metadata.py b/tempest/api/volume/test_snapshot_metadata.py
index 03474ba..e1fe779 100644
--- a/tempest/api/volume/test_snapshot_metadata.py
+++ b/tempest/api/volume/test_snapshot_metadata.py
@@ -20,9 +20,13 @@
class SnapshotV2MetadataTestJSON(base.BaseVolumeTest):
@classmethod
+ def setup_clients(cls):
+ super(SnapshotV2MetadataTestJSON, cls).setup_clients()
+ cls.client = cls.snapshots_client
+
+ @classmethod
def resource_setup(cls):
super(SnapshotV2MetadataTestJSON, cls).resource_setup()
- cls.client = cls.snapshots_client
# Create a volume
cls.volume = cls.create_volume()
# Create a snapshot
diff --git a/tempest/api/volume/test_volume_transfers.py b/tempest/api/volume/test_volume_transfers.py
index 7451050..6f75403 100644
--- a/tempest/api/volume/test_volume_transfers.py
+++ b/tempest/api/volume/test_volume_transfers.py
@@ -17,6 +17,7 @@
from tempest.api.volume import base
from tempest import clients
+from tempest.common import credentials
from tempest import config
from tempest import test
@@ -26,18 +27,24 @@
class VolumesV2TransfersTest(base.BaseVolumeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesV2TransfersTest, cls).resource_setup()
+ def skip_checks(cls):
+ super(VolumesV2TransfersTest, cls).skip_checks()
+ if not credentials.is_admin_available():
+ msg = "Missing Volume Admin API credentials in configuration."
+ raise cls.skipException(msg)
+ @classmethod
+ def setup_credentials(cls):
+ super(VolumesV2TransfersTest, cls).setup_credentials()
# Add another tenant to test volume-transfer
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)
- except NotImplementedError:
- msg = "Missing Volume Admin API credentials in configuration."
- raise cls.skipException(msg)
+ creds = cls.isolated_creds.get_admin_creds()
+ cls.os_adm = clients.Manager(credentials=creds)
+
+ @classmethod
+ def setup_clients(cls):
+ super(VolumesV2TransfersTest, cls).setup_clients()
cls.client = cls.volumes_client
cls.alt_client = cls.os_alt.volumes_client
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index ceabb1c..e5f7aa4 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -24,20 +24,25 @@
class VolumesV2ActionsTest(base.BaseVolumeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesV2ActionsTest, cls).resource_setup()
+ def setup_clients(cls):
+ super(VolumesV2ActionsTest, cls).setup_clients()
cls.client = cls.volumes_client
cls.image_client = cls.os.image_client
+ @classmethod
+ def resource_setup(cls):
+ super(VolumesV2ActionsTest, cls).resource_setup()
+
# Create a test shared instance
srv_name = data_utils.rand_name(cls.__name__ + '-Instance-')
- resp, cls.server = cls.servers_client.create_server(srv_name,
- cls.image_ref,
- cls.flavor_ref)
+ cls.server = cls.servers_client.create_server(srv_name,
+ cls.image_ref,
+ cls.flavor_ref)
cls.servers_client.wait_for_server_status(cls.server['id'], 'ACTIVE')
# Create a test shared volume for attach/detach tests
cls.volume = cls.create_volume()
+ cls.client.wait_for_volume_status(cls.volume['id'], 'available')
def _delete_image_with_wait(self, image_id):
self.image_client.delete_image(image_id)
diff --git a/tempest/api/volume/test_volumes_extend.py b/tempest/api/volume/test_volumes_extend.py
index ebe6084..fab25ec 100644
--- a/tempest/api/volume/test_volumes_extend.py
+++ b/tempest/api/volume/test_volumes_extend.py
@@ -23,8 +23,8 @@
class VolumesV2ExtendTest(base.BaseVolumeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesV2ExtendTest, cls).resource_setup()
+ def setup_clients(cls):
+ super(VolumesV2ExtendTest, cls).setup_clients()
cls.client = cls.volumes_client
@test.attr(type='gate')
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index 2a49210..3133df4 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -26,9 +26,13 @@
class VolumesV2GetTest(base.BaseVolumeTest):
@classmethod
+ def setup_clients(cls):
+ super(VolumesV2GetTest, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2GetTest, cls).resource_setup()
- cls.client = cls.volumes_client
cls.name_field = cls.special_fields['name_field']
cls.descrip_field = cls.special_fields['descrip_field']
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index 91beae9..9a8746a 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -55,9 +55,13 @@
[str_vol(v) for v in fetched_list]))
@classmethod
+ def setup_clients(cls):
+ super(VolumesV2ListTestJSON, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2ListTestJSON, cls).resource_setup()
- cls.client = cls.volumes_client
cls.name = cls.VOLUME_FIELDS[1]
# Create 3 test volumes
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 57fcaee..c827f9e 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -19,16 +19,19 @@
from tempest.api.volume import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
class VolumesV2NegativeTest(base.BaseVolumeTest):
@classmethod
+ def setup_clients(cls):
+ super(VolumesV2NegativeTest, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2NegativeTest, cls).resource_setup()
- cls.client = cls.volumes_client
cls.name_field = cls.special_fields['name_field']
@@ -54,7 +57,7 @@
# in request
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.BadRequest, self.client.create_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
size='#$%', display_name=v_name, metadata=metadata)
@test.attr(type=['negative', 'gate'])
@@ -63,7 +66,7 @@
# in request
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.BadRequest, self.client.create_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
size='', display_name=v_name, metadata=metadata)
@test.attr(type=['negative', 'gate'])
@@ -71,7 +74,7 @@
# Should not be able to create volume with size zero
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.BadRequest, self.client.create_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
size='0', display_name=v_name, metadata=metadata)
@test.attr(type=['negative', 'gate'])
@@ -79,7 +82,7 @@
# Should not be able to create volume with size negative
v_name = data_utils.rand_name('Volume-')
metadata = {'Type': 'work'}
- self.assertRaises(exceptions.BadRequest, self.client.create_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
size='-1', display_name=v_name, metadata=metadata)
@test.attr(type=['negative', 'gate'])
@@ -159,9 +162,9 @@
@test.services('compute')
def test_attach_volumes_with_nonexistent_volume_id(self):
srv_name = data_utils.rand_name('Instance-')
- resp, server = self.servers_client.create_server(srv_name,
- self.image_ref,
- self.flavor_ref)
+ server = self.servers_client.create_server(srv_name,
+ self.image_ref,
+ self.flavor_ref)
self.addCleanup(self.servers_client.delete_server, server['id'])
self.servers_client.wait_for_server_status(server['id'], 'ACTIVE')
self.assertRaises(lib_exc.NotFound,
@@ -180,21 +183,21 @@
def test_volume_extend_with_size_smaller_than_original_size(self):
# Extend volume with smaller size than original size.
extend_size = 0
- self.assertRaises(exceptions.BadRequest, self.client.extend_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.extend_volume,
self.volume['id'], extend_size)
@test.attr(type=['negative', 'gate'])
def test_volume_extend_with_non_number_size(self):
# Extend volume when size is non number.
extend_size = 'abc'
- self.assertRaises(exceptions.BadRequest, self.client.extend_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.extend_volume,
self.volume['id'], extend_size)
@test.attr(type=['negative', 'gate'])
def test_volume_extend_with_None_size(self):
# Extend volume with None size.
extend_size = None
- self.assertRaises(exceptions.BadRequest, self.client.extend_volume,
+ self.assertRaises(lib_exc.BadRequest, self.client.extend_volume,
self.volume['id'], extend_size)
@test.attr(type=['negative', 'gate'])
@@ -228,7 +231,7 @@
# Mark volume as reserved.
self.client.reserve_volume(self.volume['id'])
# Mark volume which is marked as reserved before
- self.assertRaises(exceptions.BadRequest,
+ self.assertRaises(lib_exc.BadRequest,
self.client.reserve_volume,
self.volume['id'])
# Unmark volume as reserved.
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index d667dfd..c4f8096 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -23,13 +23,16 @@
class VolumesV2SnapshotTestJSON(base.BaseVolumeTest):
@classmethod
+ def skip_checks(cls):
+ super(VolumesV2SnapshotTestJSON, cls).skip_checks()
+ if not CONF.volume_feature_enabled.snapshot:
+ raise cls.skipException("Cinder volume snapshots are disabled")
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2SnapshotTestJSON, cls).resource_setup()
cls.volume_origin = cls.create_volume()
- if not CONF.volume_feature_enabled.snapshot:
- raise cls.skipException("Cinder volume snapshots are disabled")
-
cls.name_field = cls.special_fields['name_field']
cls.descrip_field = cls.special_fields['descrip_field']
@@ -64,9 +67,9 @@
# Create a snapshot when volume status is in-use
# Create a test instance
server_name = data_utils.rand_name('instance-')
- resp, server = self.servers_client.create_server(server_name,
- self.image_ref,
- self.flavor_ref)
+ server = self.servers_client.create_server(server_name,
+ self.image_ref,
+ self.flavor_ref)
self.addCleanup(self.servers_client.delete_server, server['id'])
self.servers_client.wait_for_server_status(server['id'], 'ACTIVE')
mountpoint = '/dev/%s' % CONF.compute.volume_device_name
diff --git a/tempest/api/volume/test_volumes_snapshots_negative.py b/tempest/api/volume/test_volumes_snapshots_negative.py
index 8b68ea9..3ad23f7 100644
--- a/tempest/api/volume/test_volumes_snapshots_negative.py
+++ b/tempest/api/volume/test_volumes_snapshots_negative.py
@@ -25,9 +25,8 @@
class VolumesV2SnapshotNegativeTestJSON(base.BaseVolumeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesV2SnapshotNegativeTestJSON, cls).resource_setup()
-
+ def skip_checks(cls):
+ super(VolumesV2SnapshotNegativeTestJSON, cls).skip_checks()
if not CONF.volume_feature_enabled.snapshot:
raise cls.skipException("Cinder volume snapshots are disabled")
diff --git a/tempest/api/volume/v2/test_volumes_list.py b/tempest/api/volume/v2/test_volumes_list.py
index bc14b2c..3a21f41 100644
--- a/tempest/api/volume/v2/test_volumes_list.py
+++ b/tempest/api/volume/v2/test_volumes_list.py
@@ -31,9 +31,13 @@
"""
@classmethod
+ def setup_clients(cls):
+ super(VolumesV2ListTestJSON, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2ListTestJSON, cls).resource_setup()
- cls.client = cls.volumes_client
# Create 3 test volumes
cls.volume_list = []
diff --git a/tempest/api_schema/response/compute/baremetal_nodes.py b/tempest/api_schema/response/compute/baremetal_nodes.py
new file mode 100644
index 0000000..2f67d37
--- /dev/null
+++ b/tempest/api_schema/response/compute/baremetal_nodes.py
@@ -0,0 +1,53 @@
+# Copyright 2015 NEC Corporation. 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.
+
+node = {
+ 'type': 'object',
+ 'properties': {
+ 'id': {'type': 'string'},
+ 'interfaces': {'type': 'array'},
+ 'host': {'type': 'string'},
+ 'task_state': {'type': ['string', 'null']},
+ 'cpus': {'type': 'integer'},
+ 'memory_mb': {'type': 'integer'},
+ 'disk_gb': {'type': 'integer'},
+ },
+ 'required': ['id', 'interfaces', 'host', 'task_state', 'cpus', 'memory_mb',
+ 'disk_gb']
+}
+
+list_baremetal_nodes = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'nodes': {
+ 'type': 'array',
+ 'items': node
+ }
+ },
+ 'required': ['nodes']
+ }
+}
+
+get_baremetal_node = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'node': node
+ },
+ 'required': ['node']
+ }
+}
diff --git a/tempest/api_schema/response/compute/v2/images.py b/tempest/api_schema/response/compute/v2/images.py
index 923c744..2317e6b 100644
--- a/tempest/api_schema/response/compute/v2/images.py
+++ b/tempest/api_schema/response/compute/v2/images.py
@@ -12,15 +12,20 @@
# License for the specific language governing permissions and limitations
# under the License.
+import copy
+
from tempest.api_schema.response.compute import parameter_types
+image_links = copy.deepcopy(parameter_types.links)
+image_links['items']['properties'].update({'type': {'type': 'string'}})
+
common_image_schema = {
'type': 'object',
'properties': {
'id': {'type': 'string'},
'status': {'type': 'string'},
'updated': {'type': 'string'},
- 'links': parameter_types.links,
+ 'links': image_links,
'name': {'type': 'string'},
'created': {'type': 'string'},
'minDisk': {'type': 'integer'},
@@ -67,7 +72,7 @@
'type': 'object',
'properties': {
'id': {'type': 'string'},
- 'links': parameter_types.links,
+ 'links': image_links,
'name': {'type': 'string'}
},
'required': ['id', 'links', 'name']
diff --git a/tempest/auth.py b/tempest/auth.py
index 7e1928f..f78bb20 100644
--- a/tempest/auth.py
+++ b/tempest/auth.py
@@ -22,13 +22,11 @@
import six
-from tempest import config
from tempest.openstack.common import log as logging
from tempest.services.identity.json import token_client as json_id
from tempest.services.identity.v3.json import token_client as json_v3id
-CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -323,8 +321,9 @@
return dict(
user=self.credentials.username,
password=self.credentials.password,
- tenant=self.credentials.tenant_name,
- domain=self.credentials.user_domain_name,
+ project=self.credentials.tenant_name,
+ user_domain=self.credentials.user_domain_name,
+ project_domain=self.credentials.project_domain_name,
auth_data=True)
def _fill_credentials(self, auth_data_body):
@@ -564,16 +563,6 @@
'project_name', 'tenant_id', 'tenant_name', 'user_domain_id',
'user_domain_name', 'user_id']
- def __init__(self, **kwargs):
- """
- If domain is not specified, load the one configured for the
- identity manager.
- """
- domain_fields = set(x for x in self.ATTRIBUTES if 'domain' in x)
- if not domain_fields.intersection(kwargs.keys()):
- kwargs['user_domain_name'] = CONF.identity.admin_domain_name
- super(KeystoneV3Credentials, self).__init__(**kwargs)
-
def __setattr__(self, key, value):
parent = super(KeystoneV3Credentials, self)
# for tenant_* set both project and tenant
diff --git a/tempest/clients.py b/tempest/clients.py
index 1836173..bb08d87 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -29,6 +29,8 @@
AggregatesClientJSON
from tempest.services.compute.json.availability_zone_client import \
AvailabilityZoneClientJSON
+from tempest.services.compute.json.baremetal_nodes_client import \
+ BaremetalNodesClientJSON
from tempest.services.compute.json.certificates_client import \
CertificatesClientJSON
from tempest.services.compute.json.extensions_client import \
@@ -64,7 +66,8 @@
TenantUsagesClientJSON
from tempest.services.compute.json.volumes_extensions_client import \
VolumesExtensionsClientJSON
-from tempest.services.data_processing.v1_1.client import DataProcessingClient
+from tempest.services.data_processing.v1_1.data_processing_client import \
+ DataProcessingClient
from tempest.services.database.json.flavors_client import \
DatabaseFlavorsClientJSON
from tempest.services.database.json.limits_client import \
@@ -201,6 +204,12 @@
build_interval=CONF.orchestration.build_interval,
build_timeout=CONF.orchestration.build_timeout,
**self.default_params)
+ self.data_processing_client = DataProcessingClient(
+ self.auth_provider,
+ CONF.data_processing.catalog_type,
+ CONF.identity.region,
+ endpoint_type=CONF.data_processing.endpoint_type,
+ **self.default_params_with_timeout_values)
self.negative_client = negative_rest_client.NegativeRestClient(
self.auth_provider, service)
@@ -211,8 +220,6 @@
self.credentials.tenant_name)
self.ec2api_client = botoclients.APIClientEC2(*ec2_client_args)
self.s3_client = botoclients.ObjectClientS3(*ec2_client_args)
- self.data_processing_client = DataProcessingClient(
- self.auth_provider)
def _set_compute_clients(self):
params = {
@@ -264,6 +271,8 @@
InstanceUsagesAuditLogClientJSON(self.auth_provider, **params)
self.tenant_networks_client = \
TenantNetworksClientJSON(self.auth_provider, **params)
+ self.baremetal_nodes_client = BaremetalNodesClientJSON(
+ self.auth_provider, **params)
# NOTE: The following client needs special timeout values because
# the API is a proxy for the other component.
@@ -293,16 +302,27 @@
**self.default_params_with_timeout_values)
def _set_identity_clients(self):
- self.identity_client = IdentityClientJSON(self.auth_provider)
- self.identity_v3_client = IdentityV3ClientJSON(self.auth_provider)
- self.endpoints_client = EndPointClientJSON(self.auth_provider)
- self.service_client = ServiceClientJSON(self.auth_provider)
- self.policy_client = PolicyClientJSON(self.auth_provider)
- self.region_client = RegionClientJSON(self.auth_provider)
+ params = {
+ 'service': CONF.identity.catalog_type,
+ 'region': CONF.identity.region,
+ 'endpoint_type': 'adminURL'
+ }
+ params.update(self.default_params_with_timeout_values)
+
+ self.identity_client = IdentityClientJSON(self.auth_provider,
+ **params)
+ self.identity_v3_client = IdentityV3ClientJSON(self.auth_provider,
+ **params)
+ self.endpoints_client = EndPointClientJSON(self.auth_provider,
+ **params)
+ self.service_client = ServiceClientJSON(self.auth_provider, **params)
+ self.policy_client = PolicyClientJSON(self.auth_provider, **params)
+ self.region_client = RegionClientJSON(self.auth_provider, **params)
+ self.credentials_client = CredentialsClientJSON(self.auth_provider,
+ **params)
self.token_client = TokenClientJSON()
if CONF.identity_feature_enabled.api_v3:
self.token_v3_client = V3TokenClientJSON()
- self.credentials_client = CredentialsClientJSON(self.auth_provider)
def _set_volume_clients(self):
params = {
@@ -327,9 +347,12 @@
**params)
self.snapshots_v2_client = SnapshotsV2ClientJSON(self.auth_provider,
**params)
- self.volumes_client = VolumesClientJSON(self.auth_provider, **params)
- self.volumes_v2_client = VolumesV2ClientJSON(self.auth_provider,
- **params)
+ self.volumes_client = VolumesClientJSON(
+ self.auth_provider, default_volume_size=CONF.volume.volume_size,
+ **params)
+ self.volumes_v2_client = VolumesV2ClientJSON(
+ self.auth_provider, default_volume_size=CONF.volume.volume_size,
+ **params)
self.volume_types_client = VolumeTypesClientJSON(self.auth_provider,
**params)
self.volume_services_client = VolumesServicesClientJSON(
diff --git a/tempest/cmd/cleanup.py b/tempest/cmd/cleanup.py
index c52704a..669f506 100755
--- a/tempest/cmd/cleanup.py
+++ b/tempest/cmd/cleanup.py
@@ -222,7 +222,7 @@
needs_role = False
LOG.debug("User already had admin privilege for this tenant")
if needs_role:
- LOG.debug("Adding admin priviledge for : %s" % tenant_id)
+ LOG.debug("Adding admin privilege for : %s" % tenant_id)
id_cl.assign_user_role(tenant_id, self.admin_id,
self.admin_role_id)
self.admin_role_added.append(tenant_id)
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index 9c4a5dc..67eb182 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -297,7 +297,7 @@
def list(self):
client = self.client
- _, floating_ips = client.list_floating_ips()
+ floating_ips = client.list_floating_ips()
LOG.debug("List count, %s Floating IPs" % len(floating_ips))
return floating_ips
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 4af2108..503745c 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -115,7 +115,6 @@
import tempest.auth
from tempest import config
-from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.openstack.common import timeutils
from tempest.services.compute.json import flavors_client
@@ -178,7 +177,12 @@
password=pw,
tenant_name=tenant)
_auth = tempest.auth.KeystoneV2AuthProvider(_creds)
- self.identity = identity_client.IdentityClientJSON(_auth)
+ self.identity = identity_client.IdentityClientJSON(
+ _auth,
+ CONF.identity.catalog_type,
+ CONF.identity.region,
+ endpoint_type='adminURL',
+ **default_params_with_timeout_values)
self.servers = servers_client.ServersClientJSON(_auth,
**compute_params)
self.flavors = flavors_client.FlavorsClientJSON(_auth,
@@ -233,9 +237,6 @@
LOG.error("%s not found in USERS: %s" % (name, USERS))
-def resp_ok(response):
- return 200 >= int(response['status']) < 300
-
###################
#
# TENANTS
@@ -433,7 +434,7 @@
found,
"Couldn't find expected server %s" % server['name'])
- r, found = client.servers.get_server(found['id'])
+ found = client.servers.get_server(found['id'])
# validate neutron is enabled and ironic disabled:
if (CONF.service_available.neutron and
not CONF.baremetal.driver_enabled):
@@ -708,7 +709,7 @@
cidr=subnet['range'],
name=subnet['name'],
ip_version=ip_version)
- except exceptions.BadRequest as e:
+ except lib_exc.BadRequest as e:
is_overlapping_cidr = 'overlaps with another subnet' in str(e)
if not is_overlapping_cidr:
raise
@@ -817,7 +818,7 @@
client.networks, 'networks', x)['id'])
kwargs['networks'] = [{'uuid': get_net_id(network)}
for network in server['networks']]
- resp, body = client.servers.create_server(
+ body = client.servers.create_server(
server['name'], image_id, flavor_id, **kwargs)
server_id = body['id']
client.servers.wait_for_server_status(server_id, 'ACTIVE')
diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py
index 87f5ca6..697965f 100755
--- a/tempest/cmd/verify_tempest_config.py
+++ b/tempest/cmd/verify_tempest_config.py
@@ -154,7 +154,7 @@
def verify_extensions(os, service, results):
extensions_client = get_extension_client(os, service)
- if service == 'neutron' or service == 'cinder':
+ if service != 'swift':
resp = extensions_client.list_extensions()
else:
__, resp = extensions_client.list_extensions()
diff --git a/tempest/common/cred_provider.py b/tempest/common/cred_provider.py
index f40ed7a..d899303 100644
--- a/tempest/common/cred_provider.py
+++ b/tempest/common/cred_provider.py
@@ -70,6 +70,12 @@
# is none is specified
def get_credentials(fill_in=True, identity_version=None, **kwargs):
identity_version = identity_version or CONF.identity.auth_version
+ # In case of "v3" add the domain from config if not specified
+ if identity_version == 'v3':
+ domain_fields = set(x for x in auth.KeystoneV3Credentials.ATTRIBUTES
+ if 'domain' in x)
+ if not domain_fields.intersection(kwargs.keys()):
+ kwargs['user_domain_name'] = CONF.identity.admin_domain_name
return auth.get_credentials(fill_in=fill_in,
identity_version=identity_version,
**kwargs)
diff --git a/tempest/common/credentials.py b/tempest/common/credentials.py
index 08b592f..6a4ee08c 100644
--- a/tempest/common/credentials.py
+++ b/tempest/common/credentials.py
@@ -12,6 +12,7 @@
# limitations under the License.
from tempest.common import accounts
+from tempest.common import cred_provider
from tempest.common import isolated_creds
from tempest import config
@@ -37,3 +38,22 @@
return accounts.Accounts(name=name)
else:
return accounts.NotLockingAccounts(name=name)
+
+
+# We want a helper function here to check and see if admin credentials
+# are available so we can do a single call from skip_checks if admin
+# creds area vailable.
+def is_admin_available():
+ is_admin = True
+ # In the case of a pre-provisioned account, if even if creds were
+ # configured, the admin credentials won't be available
+ if (CONF.auth.locking_credentials_provider and
+ not CONF.auth.allow_tenant_isolation):
+ is_admin = False
+ else:
+ try:
+ cred_provider.get_configured_credentials('identity_admin')
+ except NotImplementedError:
+ is_admin = False
+
+ return is_admin
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index 1664839..3eed689 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -198,7 +198,7 @@
tenant_id=tenant_id,
ip_version=4)
break
- except exceptions.BadRequest as e:
+ except lib_exc.BadRequest as e:
if 'overlaps with another subnet' not in str(e):
raise
else:
diff --git a/tempest/common/service_client.py b/tempest/common/service_client.py
index 9aeb243..8949609 100644
--- a/tempest/common/service_client.py
+++ b/tempest/common/service_client.py
@@ -16,7 +16,6 @@
from tempest_lib import exceptions as lib_exceptions
from tempest import config
-from tempest import exceptions
CONF = config.CONF
@@ -59,8 +58,6 @@
method, url,
extra_headers=extra_headers,
headers=headers, body=body)
- except lib_exceptions.BadRequest as ex:
- raise exceptions.BadRequest(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
@@ -86,6 +83,18 @@
return "response: %s\nBody: %s" % (self.response, body)
+class ResponseBodyData(object):
+ """Class that wraps an http response and string data into a single value.
+ """
+
+ def __init__(self, response, data):
+ self.response = response
+ self.data = data
+
+ def __str__(self):
+ return "response: %s\nBody: %s" % (self.response, self.data)
+
+
class ResponseBodyList(list):
"""Class that wraps an http response and list body into a single value.
diff --git a/tempest/common/waiters.py b/tempest/common/waiters.py
index c77c81e..9b11676 100644
--- a/tempest/common/waiters.py
+++ b/tempest/common/waiters.py
@@ -32,7 +32,7 @@
# NOTE(afazekas): UNKNOWN status possible on ERROR
# or in a very early stage.
- resp, body = client.get_server(server_id)
+ body = client.get_server(server_id)
old_status = server_status = body['status']
old_task_state = task_state = _get_task_state(body)
start_time = int(time.time())
@@ -59,7 +59,7 @@
return
time.sleep(client.build_interval)
- resp, body = client.get_server(server_id)
+ body = client.get_server(server_id)
server_status = body['status']
task_state = _get_task_state(body)
if (server_status != old_status) or (task_state != old_task_state):
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 7da7b12..eb7265f 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -187,8 +187,8 @@
LOG.debug("Creating a server (name: %s, image: %s, flavor: %s)",
name, image, flavor)
- _, server = self.servers_client.create_server(name, image, flavor,
- **create_kwargs)
+ server = self.servers_client.create_server(name, image, flavor,
+ **create_kwargs)
if wait_on_delete:
self.addCleanup(self.servers_client.wait_for_server_termination,
server['id'])
@@ -203,7 +203,7 @@
# The instance retrieved on creation is missing network
# details, necessitating retrieval after it becomes active to
# ensure correct details.
- _, server = self.servers_client.get_server(server['id'])
+ server = self.servers_client.get_server(server['id'])
self.assertEqual(server['name'], name)
return server
@@ -513,7 +513,7 @@
Nova clients
"""
- _, floating_ip = self.floating_ips_client.create_floating_ip(pool_name)
+ floating_ip = self.floating_ips_client.create_floating_ip(pool_name)
self.addCleanup(self.delete_wrapper,
self.floating_ips_client.delete_floating_ip,
floating_ip['id'])
@@ -1249,7 +1249,7 @@
self.servers_client.wait_for_server_status(self.instance['id'],
'ACTIVE')
self.node = self.get_node(instance_id=self.instance['id'])
- _, self.instance = self.servers_client.get_server(self.instance['id'])
+ self.instance = self.servers_client.get_server(self.instance['id'])
def terminate_instance(self):
self.servers_client.delete_server(self.instance['id'])
diff --git a/tempest/scenario/orchestration/test_server_cfn_init.py b/tempest/scenario/orchestration/test_server_cfn_init.py
index 6052e0b..9c38d2f 100644
--- a/tempest/scenario/orchestration/test_server_cfn_init.py
+++ b/tempest/scenario/orchestration/test_server_cfn_init.py
@@ -81,7 +81,7 @@
server_resource = self.client.get_resource(sid, 'SmokeServer')
server_id = server_resource['physical_resource_id']
- _, server = self.servers_client.get_server(server_id)
+ server = self.servers_client.get_server(server_id)
server_ip =\
server['addresses'][CONF.compute.network_for_ssh][0]['addr']
diff --git a/tempest/scenario/test_baremetal_basic_ops.py b/tempest/scenario/test_baremetal_basic_ops.py
index fd4449a..fe49dc1 100644
--- a/tempest/scenario/test_baremetal_basic_ops.py
+++ b/tempest/scenario/test_baremetal_basic_ops.py
@@ -104,7 +104,7 @@
return int(ephemeral)
def add_floating_ip(self):
- _, floating_ip = self.floating_ips_client.create_floating_ip()
+ floating_ip = self.floating_ips_client.create_floating_ip()
self.floating_ips_client.associate_floating_ip_to_server(
floating_ip['ip'], self.instance['id'])
return floating_ip['ip']
diff --git a/tempest/scenario/test_load_balancer_basic.py b/tempest/scenario/test_load_balancer_basic.py
index 57a5406..426ada3 100644
--- a/tempest/scenario/test_load_balancer_basic.py
+++ b/tempest/scenario/test_load_balancer_basic.py
@@ -161,7 +161,7 @@
"""
for server_id, ip in self.server_ips.iteritems():
private_key = self.servers_keypairs[server_id]['private_key']
- server_name = self.servers_client.get_server(server_id)[1]['name']
+ server_name = self.servers_client.get_server(server_id)['name']
username = config.scenario.ssh_user
ssh_client = self.get_remote_client(
server_or_ip=ip,
@@ -185,7 +185,7 @@
# Start netcat
start_server = ('while true; do '
- 'sudo nc -l -p %(port)s -e sh /tmp/%(script)s; '
+ 'sudo nc -ll -p %(port)s -e sh /tmp/%(script)s; '
'done &')
cmd = start_server % {'port': self.port1,
'script': 'script1'}
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 4624038..f13ff0f 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -59,7 +59,7 @@
self.assertIn(self.server['id'], [x['id'] for x in servers])
def nova_show(self):
- _, got_server = self.servers_client.get_server(self.server['id'])
+ got_server = self.servers_client.get_server(self.server['id'])
self.assertThat(
self.server, custom_matchers.MatchesDictExceptForKeys(
got_server, excluded_keys=['OS-EXT-AZ:availability_zone']))
@@ -109,7 +109,7 @@
self.server['id'], secgroup['name'])
def wait_for_secgroup_add():
- _, body = self.servers_client.get_server(self.server['id'])
+ body = self.servers_client.get_server(self.server['id'])
return {'name': secgroup['name']} in body['security_groups']
if not test.call_until_true(wait_for_secgroup_add,
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index ae326c4..aeb73a9 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -243,7 +243,7 @@
def check_ports():
self.new_port_list = [port for port in
self._list_ports(device_id=server['id'])
- if port != old_port]
+ if port['id'] != old_port['id']]
return len(self.new_port_list) == 1
if not test.call_until_true(check_ports, CONF.network.build_timeout,
@@ -492,6 +492,9 @@
ssh_client.renew_lease(fixed_ip=floating_ip['fixed_ip_address'])
self._check_dns_server(ssh_client, [alt_dns_server])
+ @testtools.skipIf(CONF.baremetal.driver_enabled,
+ 'admin_state of instance ports cannot be altered '
+ 'for baremetal nodes')
@test.attr(type='smoke')
@test.services('compute', 'network')
def test_update_instance_port_admin_state(self):
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index 55ab18f..394aed0 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -76,6 +76,8 @@
* test that traffic is blocked with default security group
* test that traffic is enabled after updating port with new security
group having appropriate rule
+ 8. _test_multiple_security_groups: test multiple security groups can be
+ associated with the vm
assumptions:
1. alt_tenant/user existed and is different from primary_tenant/user
@@ -512,3 +514,37 @@
for tenant in self.tenants.values():
self._log_console_output(servers=tenant.servers)
raise
+
+ @test.attr(type='smoke')
+ @test.services('compute', 'network')
+ def test_multiple_security_groups(self):
+ """
+ This test verifies multiple security groups and checks that rules
+ provided in the both the groups is applied onto VM
+ """
+ tenant = self.primary_tenant
+ ip = self._get_server_ip(tenant.access_point,
+ floating=self.floating_ip_access)
+ ssh_login = CONF.compute.image_ssh_user
+ private_key = tenant.keypair['private_key']
+ self.check_vm_connectivity(ip,
+ should_connect=False)
+ ruleset = dict(
+ protocol='icmp',
+ direction='ingress'
+ )
+ self._create_security_group_rule(
+ secgroup=tenant.security_groups['default'],
+ **ruleset
+ )
+ """
+ Vm now has 2 security groups one with ssh rule(
+ already added in setUp() method),and other with icmp rule
+ (added in the above step).The check_vm_connectivity tests
+ -that vm ping test is successful
+ -ssh to vm is successful
+ """
+ self.check_vm_connectivity(ip,
+ username=ssh_login,
+ private_key=private_key,
+ should_connect=True)
diff --git a/tempest/scenario/test_server_advanced_ops.py b/tempest/scenario/test_server_advanced_ops.py
index d10fcce..0e0e174 100644
--- a/tempest/scenario/test_server_advanced_ops.py
+++ b/tempest/scenario/test_server_advanced_ops.py
@@ -74,19 +74,19 @@
self.servers_client.suspend_server(instance_id)
self.servers_client.wait_for_server_status(instance_id,
'SUSPENDED')
- _, fetched_instance = self.servers_client.get_server(instance_id)
+ fetched_instance = self.servers_client.get_server(instance_id)
LOG.debug("Resuming instance %s. Current status: %s",
instance_id, fetched_instance['status'])
self.servers_client.resume_server(instance_id)
self.servers_client.wait_for_server_status(instance_id,
'ACTIVE')
- _, fetched_instance = self.servers_client.get_server(instance_id)
+ fetched_instance = self.servers_client.get_server(instance_id)
LOG.debug("Suspending instance %s. Current status: %s",
instance_id, fetched_instance['status'])
self.servers_client.suspend_server(instance_id)
self.servers_client.wait_for_server_status(instance_id,
'SUSPENDED')
- _, fetched_instance = self.servers_client.get_server(instance_id)
+ fetched_instance = self.servers_client.get_server(instance_id)
LOG.debug("Resuming instance %s. Current status: %s",
instance_id, fetched_instance['status'])
self.servers_client.resume_server(instance_id)
diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py
index 23743c5..509ce60 100644
--- a/tempest/scenario/test_server_basic_ops.py
+++ b/tempest/scenario/test_server_basic_ops.py
@@ -80,7 +80,7 @@
def verify_ssh(self):
if self.run_ssh:
# Obtain a floating IP
- _, floating_ip = self.floating_ips_client.create_floating_ip()
+ floating_ip = self.floating_ips_client.create_floating_ip()
self.addCleanup(self.delete_wrapper,
self.floating_ips_client.delete_floating_ip,
floating_ip['id'])
diff --git a/tempest/scenario/test_shelve_instance.py b/tempest/scenario/test_shelve_instance.py
index 8882177..5ba650d 100644
--- a/tempest/scenario/test_shelve_instance.py
+++ b/tempest/scenario/test_shelve_instance.py
@@ -77,7 +77,7 @@
create_kwargs=create_kwargs)
if CONF.compute.use_floatingip_for_ssh:
- _, floating_ip = self.floating_ips_client.create_floating_ip()
+ floating_ip = self.floating_ips_client.create_floating_ip()
self.addCleanup(self.delete_wrapper,
self.floating_ips_client.delete_floating_ip,
floating_ip['id'])
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index c8f438e..21a399c 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -101,7 +101,7 @@
def _ssh_to_server(self, server, keypair):
if CONF.compute.use_floatingip_for_ssh:
- _, floating_ip = self.floating_ips_client.create_floating_ip()
+ floating_ip = self.floating_ips_client.create_floating_ip()
self.addCleanup(self.delete_wrapper,
self.floating_ips_client.delete_floating_ip,
floating_ip['id'])
diff --git a/tempest/scenario/utils.py b/tempest/scenario/utils.py
index 061f5c8..68ec6e7 100644
--- a/tempest/scenario/utils.py
+++ b/tempest/scenario/utils.py
@@ -120,12 +120,15 @@
if not CONF.service_available.glance:
return []
if not hasattr(self, '_scenario_images'):
- images = self.images_client.list_images()
- self._scenario_images = [
- (self._normalize_name(i['name']), dict(image_ref=i['id']))
- for i in images if re.search(self.image_pattern,
- str(i['name']))
- ]
+ try:
+ images = self.images_client.list_images()
+ self._scenario_images = [
+ (self._normalize_name(i['name']), dict(image_ref=i['id']))
+ for i in images if re.search(self.image_pattern,
+ str(i['name']))
+ ]
+ except Exception:
+ self._scenario_images = []
return self._scenario_images
@property
@@ -134,12 +137,15 @@
:return: a scenario with name and uuid of flavors
"""
if not hasattr(self, '_scenario_flavors'):
- flavors = self.flavors_client.list_flavors()
- self._scenario_flavors = [
- (self._normalize_name(f['name']), dict(flavor_ref=f['id']))
- for f in flavors if re.search(self.flavor_pattern,
- str(f['name']))
- ]
+ try:
+ flavors = self.flavors_client.list_flavors()
+ self._scenario_flavors = [
+ (self._normalize_name(f['name']), dict(flavor_ref=f['id']))
+ for f in flavors if re.search(self.flavor_pattern,
+ str(f['name']))
+ ]
+ except Exception:
+ self._scenario_flavors = []
return self._scenario_flavors
diff --git a/tempest/services/compute/json/availability_zone_client.py b/tempest/services/compute/json/availability_zone_client.py
index e37c9d9..343c412 100644
--- a/tempest/services/compute/json/availability_zone_client.py
+++ b/tempest/services/compute/json/availability_zone_client.py
@@ -25,11 +25,13 @@
resp, body = self.get('os-availability-zone')
body = json.loads(body)
self.validate_response(schema.get_availability_zone_list, resp, body)
- return resp, body['availabilityZoneInfo']
+ return service_client.ResponseBodyList(resp,
+ body['availabilityZoneInfo'])
def get_availability_zone_list_detail(self):
resp, body = self.get('os-availability-zone/detail')
body = json.loads(body)
self.validate_response(schema.get_availability_zone_list_detail, resp,
body)
- return resp, body['availabilityZoneInfo']
+ return service_client.ResponseBodyList(resp,
+ body['availabilityZoneInfo'])
diff --git a/tempest/services/compute/json/baremetal_nodes_client.py b/tempest/services/compute/json/baremetal_nodes_client.py
new file mode 100644
index 0000000..d8bbadd
--- /dev/null
+++ b/tempest/services/compute/json/baremetal_nodes_client.py
@@ -0,0 +1,43 @@
+# Copyright 2015 NEC Corporation. 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.
+
+import json
+import urllib
+
+from tempest.api_schema.response.compute import baremetal_nodes as schema
+from tempest.common import service_client
+
+
+class BaremetalNodesClientJSON(service_client.ServiceClient):
+ """
+ Tests Baremetal API
+ """
+
+ def list_baremetal_nodes(self, params=None):
+ """List all baremetal nodes."""
+ url = 'os-baremetal-nodes'
+ if params:
+ url += '?%s' % urllib.urlencode(params)
+ resp, body = self.get(url)
+ body = json.loads(body)
+ self.validate_response(schema.list_baremetal_nodes, resp, body)
+ return service_client.ResponseBodyList(resp, body['nodes'])
+
+ def get_baremetal_node(self, baremetal_node_id):
+ """Returns the details of a single baremetal node."""
+ url = 'os-baremetal-nodes/%s' % baremetal_node_id
+ resp, body = self.get(url)
+ body = json.loads(body)
+ self.validate_response(schema.get_baremetal_node, resp, body)
+ return service_client.ResponseBody(resp, body['node'])
diff --git a/tempest/services/compute/json/certificates_client.py b/tempest/services/compute/json/certificates_client.py
index b705c37..4a30f1e 100644
--- a/tempest/services/compute/json/certificates_client.py
+++ b/tempest/services/compute/json/certificates_client.py
@@ -27,7 +27,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_certificate, resp, body)
- return resp, body['certificate']
+ return service_client.ResponseBody(resp, body['certificate'])
def create_certificate(self):
"""create certificates."""
@@ -35,4 +35,4 @@
resp, body = self.post(url, None)
body = json.loads(body)
self.validate_response(v2schema.create_certificate, resp, body)
- return resp, body['certificate']
+ return service_client.ResponseBody(resp, body['certificate'])
diff --git a/tempest/services/compute/json/extensions_client.py b/tempest/services/compute/json/extensions_client.py
index d3148b4..09561b3 100644
--- a/tempest/services/compute/json/extensions_client.py
+++ b/tempest/services/compute/json/extensions_client.py
@@ -26,14 +26,14 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_extensions, resp, body)
- return resp, body['extensions']
+ return service_client.ResponseBodyList(resp, body['extensions'])
def is_enabled(self, extension):
- _, extensions = self.list_extensions()
+ extensions = self.list_extensions()
exts = extensions['extensions']
return any([e for e in exts if e['name'] == extension])
def get_extension(self, extension_alias):
resp, body = self.get('extensions/%s' % extension_alias)
body = json.loads(body)
- return resp, body['extension']
+ return service_client.ResponseBody(resp, body['extension'])
diff --git a/tempest/services/compute/json/fixed_ips_client.py b/tempest/services/compute/json/fixed_ips_client.py
index 5797c16..31cf5b2 100644
--- a/tempest/services/compute/json/fixed_ips_client.py
+++ b/tempest/services/compute/json/fixed_ips_client.py
@@ -26,11 +26,11 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.fixed_ips, resp, body)
- return resp, body['fixed_ip']
+ return service_client.ResponseBody(resp, body['fixed_ip'])
def reserve_fixed_ip(self, ip, body):
"""This reserves and unreserves fixed ips."""
url = "os-fixed-ips/%s/action" % (ip)
resp, body = self.post(url, json.dumps(body))
self.validate_response(schema.fixed_ip_action, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp)
diff --git a/tempest/services/compute/json/floating_ips_client.py b/tempest/services/compute/json/floating_ips_client.py
index d06386e..0354ba4 100644
--- a/tempest/services/compute/json/floating_ips_client.py
+++ b/tempest/services/compute/json/floating_ips_client.py
@@ -33,17 +33,15 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_floating_ips, resp, body)
- return resp, body['floating_ips']
+ return service_client.ResponseBodyList(resp, body['floating_ips'])
def get_floating_ip_details(self, floating_ip_id):
"""Get the details of a floating IP."""
url = "os-floating-ips/%s" % str(floating_ip_id)
resp, body = self.get(url)
body = json.loads(body)
- if resp.status == 404:
- raise lib_exc.NotFound(body)
self.validate_response(schema.floating_ip, resp, body)
- return resp, body['floating_ip']
+ return service_client.ResponseBody(resp, body['floating_ip'])
def create_floating_ip(self, pool_name=None):
"""Allocate a floating IP to the project."""
@@ -53,14 +51,14 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.validate_response(schema.floating_ip, resp, body)
- return resp, body['floating_ip']
+ return service_client.ResponseBody(resp, body['floating_ip'])
def delete_floating_ip(self, floating_ip_id):
"""Deletes the provided floating IP from the project."""
url = "os-floating-ips/%s" % str(floating_ip_id)
resp, body = self.delete(url)
self.validate_response(schema.add_remove_floating_ip, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def associate_floating_ip_to_server(self, floating_ip, server_id):
"""Associate the provided floating IP to a specific server."""
@@ -74,7 +72,7 @@
post_body = json.dumps(post_body)
resp, body = self.post(url, post_body)
self.validate_response(schema.add_remove_floating_ip, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def disassociate_floating_ip_from_server(self, floating_ip, server_id):
"""Disassociate the provided floating IP from a specific server."""
@@ -88,7 +86,7 @@
post_body = json.dumps(post_body)
resp, body = self.post(url, post_body)
self.validate_response(schema.add_remove_floating_ip, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def is_resource_deleted(self, id):
try:
@@ -111,7 +109,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.floating_ip_pools, resp, body)
- return resp, body['floating_ip_pools']
+ return service_client.ResponseBodyList(resp, body['floating_ip_pools'])
def create_floating_ips_bulk(self, ip_range, pool, interface):
"""Allocate floating IPs in bulk."""
@@ -124,14 +122,15 @@
resp, body = self.post('os-floating-ips-bulk', post_body)
body = json.loads(body)
self.validate_response(schema.create_floating_ips_bulk, resp, body)
- return resp, body['floating_ips_bulk_create']
+ return service_client.ResponseBody(resp,
+ body['floating_ips_bulk_create'])
def list_floating_ips_bulk(self):
"""Returns a list of all floating IPs bulk."""
resp, body = self.get('os-floating-ips-bulk')
body = json.loads(body)
self.validate_response(schema.list_floating_ips_bulk, resp, body)
- return resp, body['floating_ip_info']
+ return service_client.ResponseBodyList(resp, body['floating_ip_info'])
def delete_floating_ips_bulk(self, ip_range):
"""Deletes the provided floating IPs bulk."""
@@ -139,4 +138,5 @@
resp, body = self.put('os-floating-ips-bulk/delete', post_body)
body = json.loads(body)
self.validate_response(schema.delete_floating_ips_bulk, resp, body)
- return resp, body['floating_ips_bulk_delete']
+ data = body['floating_ips_bulk_delete']
+ return service_client.ResponseBodyData(resp, data)
diff --git a/tempest/services/compute/json/instance_usage_audit_log_client.py b/tempest/services/compute/json/instance_usage_audit_log_client.py
index 80d7334..551d751 100644
--- a/tempest/services/compute/json/instance_usage_audit_log_client.py
+++ b/tempest/services/compute/json/instance_usage_audit_log_client.py
@@ -28,11 +28,13 @@
body = json.loads(body)
self.validate_response(schema.list_instance_usage_audit_log,
resp, body)
- return resp, body["instance_usage_audit_logs"]
+ return service_client.ResponseBody(resp,
+ body["instance_usage_audit_logs"])
def get_instance_usage_audit_log(self, time_before):
url = 'os-instance_usage_audit_log/%s' % time_before
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_instance_usage_audit_log, resp, body)
- return resp, body["instance_usage_audit_log"]
+ return service_client.ResponseBody(resp,
+ body["instance_usage_audit_log"])
diff --git a/tempest/services/compute/json/migrations_client.py b/tempest/services/compute/json/migrations_client.py
index b41abc8..a65b655 100644
--- a/tempest/services/compute/json/migrations_client.py
+++ b/tempest/services/compute/json/migrations_client.py
@@ -31,4 +31,4 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_migrations, resp, body)
- return resp, body['migrations']
+ return service_client.ResponseBodyList(resp, body['migrations'])
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index fe3d02b..6a5bce7 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -92,13 +92,13 @@
# NOTE(maurosr): this deals with the case of multiple server create
# with return reservation id set True
if 'reservation_id' in body:
- return resp, body
+ return service_client.ResponseBody(resp, body)
if CONF.compute_feature_enabled.enable_instance_password:
create_schema = schema.create_server_with_admin_pass
else:
create_schema = schema.create_server
self.validate_response(create_schema, resp, body)
- return resp, body['server']
+ return service_client.ResponseBody(resp, body['server'])
def update_server(self, server_id, name=None, meta=None, accessIPv4=None,
accessIPv6=None, disk_config=None):
@@ -132,20 +132,20 @@
resp, body = self.put("servers/%s" % str(server_id), post_body)
body = json.loads(body)
self.validate_response(schema.update_server, resp, body)
- return resp, body['server']
+ return service_client.ResponseBody(resp, body['server'])
def get_server(self, server_id):
"""Returns the details of an existing server."""
resp, body = self.get("servers/%s" % str(server_id))
body = json.loads(body)
self.validate_response(schema.get_server, resp, body)
- return resp, body['server']
+ return service_client.ResponseBody(resp, body['server'])
def delete_server(self, server_id):
"""Deletes the given server."""
resp, body = self.delete("servers/%s" % str(server_id))
self.validate_response(common_schema.delete_server, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_servers(self, params=None):
"""Lists all servers for a user."""
@@ -184,7 +184,7 @@
start_time = int(time.time())
while True:
try:
- resp, body = self.get_server(server_id)
+ body = self.get_server(server_id)
except lib_exc.NotFound:
return
diff --git a/tempest/services/compute/json/tenant_usages_client.py b/tempest/services/compute/json/tenant_usages_client.py
index 5dc1d5d..bbc1051 100644
--- a/tempest/services/compute/json/tenant_usages_client.py
+++ b/tempest/services/compute/json/tenant_usages_client.py
@@ -30,7 +30,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_tenant, resp, body)
- return resp, body['tenant_usages'][0]
+ return service_client.ResponseBodyList(resp, body['tenant_usages'][0])
def get_tenant_usage(self, tenant_id, params=None):
url = 'os-simple-tenant-usage/%s' % tenant_id
@@ -40,4 +40,4 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_tenant, resp, body)
- return resp, body['tenant_usage']
+ return service_client.ResponseBodyList(resp, body['tenant_usage'])
diff --git a/tempest/services/data_processing/v1_1/client.py b/tempest/services/data_processing/v1_1/data_processing_client.py
similarity index 97%
rename from tempest/services/data_processing/v1_1/client.py
rename to tempest/services/data_processing/v1_1/data_processing_client.py
index 8879373..04cf9a3 100644
--- a/tempest/services/data_processing/v1_1/client.py
+++ b/tempest/services/data_processing/v1_1/data_processing_client.py
@@ -15,20 +15,10 @@
import json
from tempest.common import service_client
-from tempest import config
-
-CONF = config.CONF
class DataProcessingClient(service_client.ServiceClient):
- def __init__(self, auth_provider):
- super(DataProcessingClient, self).__init__(
- auth_provider,
- CONF.data_processing.catalog_type,
- CONF.identity.region,
- endpoint_type=CONF.data_processing.endpoint_type)
-
def _request_and_check_resp(self, request_func, uri, resp_status):
"""Make a request using specified request_func and check response
status code.
diff --git a/tempest/services/identity/json/identity_client.py b/tempest/services/identity/json/identity_client.py
index 6fbb3a9..6c4a6b4 100644
--- a/tempest/services/identity/json/identity_client.py
+++ b/tempest/services/identity/json/identity_client.py
@@ -14,20 +14,10 @@
from tempest_lib import exceptions as lib_exc
from tempest.common import service_client
-from tempest import config
-
-CONF = config.CONF
class IdentityClientJSON(service_client.ServiceClient):
- def __init__(self, auth_provider):
- super(IdentityClientJSON, self).__init__(
- auth_provider,
- CONF.identity.catalog_type,
- CONF.identity.region,
- endpoint_type='adminURL')
-
def has_admin_extensions(self):
"""
Returns True if the KSADM Admin Extensions are supported
diff --git a/tempest/services/identity/v3/json/base.py b/tempest/services/identity/v3/json/base.py
deleted file mode 100644
index cba480a..0000000
--- a/tempest/services/identity/v3/json/base.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2014 NEC Corporation. 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.common import service_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class IdentityV3Client(service_client.ServiceClient):
- """
- Base identity v3 client class
- """
-
- def __init__(self, auth_provider):
- super(IdentityV3Client, self).__init__(
- auth_provider,
- CONF.identity.catalog_type,
- CONF.identity.region,
- endpoint_type='adminURL')
- self.api_version = "v3"
diff --git a/tempest/services/identity/v3/json/credentials_client.py b/tempest/services/identity/v3/json/credentials_client.py
index 1289e48..0a614cd 100644
--- a/tempest/services/identity/v3/json/credentials_client.py
+++ b/tempest/services/identity/v3/json/credentials_client.py
@@ -16,10 +16,10 @@
import json
from tempest.common import service_client
-from tempest.services.identity.v3.json import base
-class CredentialsClientJSON(base.IdentityV3Client):
+class CredentialsClientJSON(service_client.ServiceClient):
+ api_version = "v3"
def create_credential(self, access_key, secret_key, user_id, project_id):
"""Creates a credential."""
diff --git a/tempest/services/identity/v3/json/endpoints_client.py b/tempest/services/identity/v3/json/endpoints_client.py
index d71836e..5b7e812 100644
--- a/tempest/services/identity/v3/json/endpoints_client.py
+++ b/tempest/services/identity/v3/json/endpoints_client.py
@@ -16,10 +16,10 @@
import json
from tempest.common import service_client
-from tempest.services.identity.v3.json import base
-class EndPointClientJSON(base.IdentityV3Client):
+class EndPointClientJSON(service_client.ServiceClient):
+ api_version = "v3"
def list_endpoints(self):
"""GET endpoints."""
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index 95c52bf..be5aa80 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -17,10 +17,10 @@
import urllib
from tempest.common import service_client
-from tempest.services.identity.v3.json import base
-class IdentityV3ClientJSON(base.IdentityV3Client):
+class IdentityV3ClientJSON(service_client.ServiceClient):
+ api_version = "v3"
def create_user(self, user_name, password=None, project_id=None,
email=None, domain_id='default', **kwargs):
diff --git a/tempest/services/identity/v3/json/policy_client.py b/tempest/services/identity/v3/json/policy_client.py
index 25931c8..8c9c9ce 100644
--- a/tempest/services/identity/v3/json/policy_client.py
+++ b/tempest/services/identity/v3/json/policy_client.py
@@ -16,10 +16,10 @@
import json
from tempest.common import service_client
-from tempest.services.identity.v3.json import base
-class PolicyClientJSON(base.IdentityV3Client):
+class PolicyClientJSON(service_client.ServiceClient):
+ api_version = "v3"
def create_policy(self, blob, type):
"""Creates a Policy."""
diff --git a/tempest/services/identity/v3/json/region_client.py b/tempest/services/identity/v3/json/region_client.py
index 482cbc6..faaf43c 100644
--- a/tempest/services/identity/v3/json/region_client.py
+++ b/tempest/services/identity/v3/json/region_client.py
@@ -17,10 +17,10 @@
import urllib
from tempest.common import service_client
-from tempest.services.identity.v3.json import base
-class RegionClientJSON(base.IdentityV3Client):
+class RegionClientJSON(service_client.ServiceClient):
+ api_version = "v3"
def create_region(self, description, **kwargs):
"""Create region."""
diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/service_client.py
index 2e2df13..e039dc6 100644
--- a/tempest/services/identity/v3/json/service_client.py
+++ b/tempest/services/identity/v3/json/service_client.py
@@ -16,10 +16,10 @@
import json
from tempest.common import service_client
-from tempest.services.identity.v3.json import base
-class ServiceClientJSON(base.IdentityV3Client):
+class ServiceClientJSON(service_client.ServiceClient):
+ api_version = "v3"
def update_service(self, service_id, **kwargs):
"""Updates a service."""
diff --git a/tempest/services/identity/v3/json/token_client.py b/tempest/services/identity/v3/json/token_client.py
index 1467d7c..5d75efa 100644
--- a/tempest/services/identity/v3/json/token_client.py
+++ b/tempest/services/identity/v3/json/token_client.py
@@ -36,23 +36,22 @@
self.auth_url = auth_url
- def auth(self, user=None, password=None, tenant=None, user_type='id',
- domain=None, token=None):
+ def auth(self, user=None, password=None, project=None, user_type='id',
+ user_domain=None, project_domain=None, token=None):
"""
:param user: user id or name, as specified in user_type
- :param domain: the user and tenant domain
+ :param user_domain: the user domain
+ :param project_domain: the project domain
:param token: a token to re-scope.
Accepts different combinations of credentials. Restrictions:
- - tenant and domain are only name (no id)
- - user domain and tenant domain are assumed identical
- - domain scope is not supported here
+ - project and domain are only name (no id)
Sample sample valid combinations:
- token
- - token, tenant, domain
+ - token, project, project_domain
- user_id, password
- - username, password, domain
- - username, password, tenant, domain
+ - username, password, user_domain
+ - username, password, project, user_domain, project_domain
Validation is left to the server side.
"""
creds = {
@@ -79,13 +78,13 @@
id_obj['password']['user']['id'] = user
else:
id_obj['password']['user']['name'] = user
- if domain is not None:
- _domain = dict(name=domain)
+ if user_domain is not None:
+ _domain = dict(name=user_domain)
id_obj['password']['user']['domain'] = _domain
- if tenant is not None:
- _domain = dict(name=domain)
- project = dict(name=tenant, domain=_domain)
- scope = dict(project=project)
+ if project is not None:
+ _domain = dict(name=project_domain)
+ _project = dict(name=project, domain=_domain)
+ scope = dict(project=_project)
creds['auth']['scope'] = scope
body = json.dumps(creds)
@@ -120,14 +119,15 @@
return resp, json.loads(resp_body)
- def get_token(self, user, password, tenant, domain='Default',
- auth_data=False):
+ def get_token(self, user, password, project=None, project_domain='Default',
+ user_domain='Default', auth_data=False):
"""
:param user: username
Returns (token id, token data) for supplied credentials
"""
- body = self.auth(user, password, tenant, user_type='name',
- domain=domain)
+ body = self.auth(user, password, project, user_type='name',
+ user_domain=user_domain,
+ project_domain=project_domain)
token = body.response.get('x-subject-token')
if auth_data:
diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/image_client.py
index 0c05118..4ea710f 100644
--- a/tempest/services/image/v1/json/image_client.py
+++ b/tempest/services/image/v1/json/image_client.py
@@ -239,8 +239,7 @@
url = 'v1/images/%s' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
- # We can't return a ResponseBody because the body is a string
- return resp, body
+ return service_client.ResponseBodyData(resp, body)
def is_resource_deleted(self, id):
try:
diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/image_client.py
index 4cddc59..50f273c 100644
--- a/tempest/services/image/v2/json/image_client.py
+++ b/tempest/services/image/v2/json/image_client.py
@@ -141,8 +141,7 @@
url = 'v2/images/%s/file' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
- # We can't return a ResponseBody because the body is a string
- return resp, body
+ return service_client.ResponseBodyData(resp, body)
def add_image_tag(self, image_id, tag):
url = 'v2/images/%s/tags/%s' % (image_id, tag)
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 5106225..ba069e8 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -320,6 +320,8 @@
cur_gw_info.pop('enable_snat', None)
update_body['external_gateway_info'] = kwargs.get(
'external_gateway_info', body['router']['external_gateway_info'])
+ if 'distributed' in kwargs:
+ update_body['distributed'] = kwargs['distributed']
update_body = dict(router=update_body)
update_body = json.dumps(update_body)
resp, body = self.put(uri, update_body)
diff --git a/tempest/services/telemetry/json/telemetry_client.py b/tempest/services/telemetry/json/telemetry_client.py
index dd899e4..a249625 100644
--- a/tempest/services/telemetry/json/telemetry_client.py
+++ b/tempest/services/telemetry/json/telemetry_client.py
@@ -127,7 +127,7 @@
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = self.deserialize(body)
- return resp, body
+ return service_client.ResponseBodyData(resp, body)
def alarm_set_state(self, alarm_id, state):
uri = "%s/alarms/%s/state" % (self.uri_prefix, alarm_id)
@@ -135,4 +135,4 @@
resp, body = self.put(uri, body)
self.expected_success(200, resp.status)
body = self.deserialize(body)
- return resp, body
+ return service_client.ResponseBodyData(resp, body)
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index b906cec..059664c 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -20,11 +20,8 @@
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
-
class BaseVolumesClientJSON(service_client.ServiceClient):
"""
@@ -33,6 +30,12 @@
create_resp = 200
+ def __init__(self, auth_provider, service, region,
+ default_volume_size=1, **kwargs):
+ super(BaseVolumesClientJSON, self).__init__(
+ auth_provider, service, region, **kwargs)
+ self.default_volume_size = default_volume_size
+
def get_attachment_from_volume(self, volume):
"""Return the element 'attachment' from input volumes."""
return volume['attachments'][0]
@@ -79,10 +82,8 @@
snapshot_id: When specified the volume is created from this snapshot
imageRef: When specified the volume is created from this image
"""
- # for bug #1293885:
- # If no size specified, read volume size from CONF
if size is None:
- size = CONF.volume.volume_size
+ size = self.default_volume_size
post_body = {'size': size}
post_body.update(kwargs)
post_body = json.dumps({'volume': post_body})
@@ -335,6 +336,14 @@
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body)
+ def retype_volume(self, volume_id, volume_type, **kwargs):
+ """Updates volume with new volume type."""
+ post_body = {'new_type': volume_type}
+ post_body.update(kwargs)
+ post_body = json.dumps({'os-retype': post_body})
+ resp, body = self.post('volumes/%s/action' % volume_id, post_body)
+ self.expected_success(202, resp.status)
+
class VolumesClientJSON(BaseVolumesClientJSON):
"""
diff --git a/tempest/stress/actions/server_create_destroy.py b/tempest/stress/actions/server_create_destroy.py
index 34e299d..d0e4eea 100644
--- a/tempest/stress/actions/server_create_destroy.py
+++ b/tempest/stress/actions/server_create_destroy.py
@@ -28,7 +28,7 @@
def run(self):
name = data_utils.rand_name("instance")
self.logger.info("creating %s" % name)
- _, server = self.manager.servers_client.create_server(
+ server = self.manager.servers_client.create_server(
name, self.image, self.flavor)
server_id = server['id']
self.manager.servers_client.wait_for_server_status(server_id,
diff --git a/tempest/stress/actions/ssh_floating.py b/tempest/stress/actions/ssh_floating.py
index c473df6..b2c612e 100644
--- a/tempest/stress/actions/ssh_floating.py
+++ b/tempest/stress/actions/ssh_floating.py
@@ -74,9 +74,9 @@
self.logger.info("creating %s" % name)
vm_args = self.vm_extra_args.copy()
vm_args['security_groups'] = [self.sec_grp]
- _, server = servers_client.create_server(name, self.image,
- self.flavor,
- **vm_args)
+ server = servers_client.create_server(name, self.image,
+ self.flavor,
+ **vm_args)
self.server_id = server['id']
if self.wait_after_vm_create:
self.manager.servers_client.wait_for_server_status(self.server_id,
@@ -104,7 +104,7 @@
def _create_floating_ip(self):
floating_cli = self.manager.floating_ips_client
- _, self.floating = floating_cli.create_floating_ip(self.floating_pool)
+ self.floating = floating_cli.create_floating_ip(self.floating_pool)
def _destroy_floating_ip(self):
cli = self.manager.floating_ips_client
@@ -144,7 +144,7 @@
cli = self.manager.floating_ips_client
def func():
- _, floating = cli.get_floating_ip_details(self.floating['id'])
+ floating = cli.get_floating_ip_details(self.floating['id'])
return floating['instance_id'] is None
if not tempest.test.call_until_true(func, self.check_timeout,
diff --git a/tempest/stress/actions/volume_attach_delete.py b/tempest/stress/actions/volume_attach_delete.py
index 9c4070f..2e1d623 100644
--- a/tempest/stress/actions/volume_attach_delete.py
+++ b/tempest/stress/actions/volume_attach_delete.py
@@ -28,7 +28,7 @@
# Step 1: create volume
name = data_utils.rand_name("volume")
self.logger.info("creating volume: %s" % name)
- _, volume = self.manager.volumes_client.create_volume(
+ volume = self.manager.volumes_client.create_volume(
size=1,
display_name=name)
self.manager.volumes_client.wait_for_volume_status(volume['id'],
@@ -38,7 +38,7 @@
# Step 2: create vm instance
vm_name = data_utils.rand_name("instance")
self.logger.info("creating vm: %s" % vm_name)
- _, server = self.manager.servers_client.create_server(
+ server = self.manager.servers_client.create_server(
vm_name, self.image, self.flavor)
server_id = server['id']
self.manager.servers_client.wait_for_server_status(server_id, 'ACTIVE')
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index 3c052ac..c013af3 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -36,9 +36,9 @@
vm_args = self.vm_extra_args.copy()
vm_args['security_groups'] = [self.sec_grp]
vm_args['key_name'] = self.key['name']
- _, server = servers_client.create_server(name, self.image,
- self.flavor,
- **vm_args)
+ server = servers_client.create_server(name, self.image,
+ self.flavor,
+ **vm_args)
self.server_id = server['id']
self.manager.servers_client.wait_for_server_status(self.server_id,
'ACTIVE')
@@ -65,7 +65,7 @@
def _create_floating_ip(self):
floating_cli = self.manager.floating_ips_client
- _, self.floating = floating_cli.create_floating_ip(self.floating_pool)
+ self.floating = floating_cli.create_floating_ip(self.floating_pool)
def _destroy_floating_ip(self):
cli = self.manager.floating_ips_client
@@ -77,7 +77,7 @@
name = data_utils.rand_name("volume")
self.logger.info("creating volume: %s" % name)
volumes_client = self.manager.volumes_client
- _, self.volume = volumes_client.create_volume(
+ self.volume = volumes_client.create_volume(
size=1,
display_name=name)
volumes_client.wait_for_volume_status(self.volume['id'],
@@ -95,7 +95,7 @@
cli = self.manager.floating_ips_client
def func():
- _, floating = cli.get_floating_ip_details(self.floating['id'])
+ floating = cli.get_floating_ip_details(self.floating['id'])
return floating['instance_id'] is None
if not tempest.test.call_until_true(func, CONF.compute.build_timeout,
diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py
index 9bc55fa..86325f5 100644
--- a/tempest/stress/cleanup.py
+++ b/tempest/stress/cleanup.py
@@ -55,7 +55,7 @@
except Exception:
pass
- _, floating_ips = admin_manager.floating_ips_client.list_floating_ips()
+ floating_ips = admin_manager.floating_ips_client.list_floating_ips()
LOG.info("Cleanup::remove %s floating ips" % len(floating_ips))
for f in floating_ips:
try:
diff --git a/tempest/test.py b/tempest/test.py
index 0c9cbfd..d4123a4 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -394,7 +394,7 @@
return admin_client
@classmethod
- def set_network_resources(self, network=False, router=False, subnet=False,
+ def set_network_resources(cls, network=False, router=False, subnet=False,
dhcp=False):
"""Specify which network resources should be created
@@ -407,8 +407,8 @@
# in order to ensure that even if it's called multiple times in
# a chain of overloaded methods, the attribute is set only
# in the leaf class
- if not self.network_resources:
- self.network_resources = {
+ if not cls.network_resources:
+ cls.network_resources = {
'network': network,
'router': router,
'subnet': subnet,
diff --git a/tempest/tests/cmd/test_verify_tempest_config.py b/tempest/tests/cmd/test_verify_tempest_config.py
index 1abe29a..17e2550 100644
--- a/tempest/tests/cmd/test_verify_tempest_config.py
+++ b/tempest/tests/cmd/test_verify_tempest_config.py
@@ -282,8 +282,8 @@
def test_verify_extensions_nova(self):
def fake_list_extensions():
- return (None, [{'alias': 'fake1'}, {'alias': 'fake2'},
- {'alias': 'not_fake'}])
+ return ([{'alias': 'fake1'}, {'alias': 'fake2'},
+ {'alias': 'not_fake'}])
fake_os = mock.MagicMock()
fake_os.extensions_client.list_extensions = fake_list_extensions
self.useFixture(mockpatch.PatchObject(
@@ -303,9 +303,9 @@
def test_verify_extensions_nova_all(self):
def fake_list_extensions():
- return (None, {'extensions': [{'alias': 'fake1'},
- {'alias': 'fake2'},
- {'alias': 'not_fake'}]})
+ return ({'extensions': [{'alias': 'fake1'},
+ {'alias': 'fake2'},
+ {'alias': 'not_fake'}]})
fake_os = mock.MagicMock()
fake_os.extensions_client.list_extensions = fake_list_extensions
self.useFixture(mockpatch.PatchObject(
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index 2b31d6b..afe4abc 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -43,8 +43,18 @@
from tempest.services.compute.json import tenant_usages_client
from tempest.services.compute.json import volumes_extensions_client \
as compute_volumes_extensions_client
+from tempest.services.data_processing.v1_1 import data_processing_client
from tempest.services.database.json import flavors_client as db_flavor_client
from tempest.services.database.json import versions_client as db_version_client
+from tempest.services.identity.json import identity_client as \
+ identity_v2_identity_client
+from tempest.services.identity.v3.json import credentials_client
+from tempest.services.identity.v3.json import endpoints_client
+from tempest.services.identity.v3.json import identity_client as \
+ identity_v3_identity_client
+from tempest.services.identity.v3.json import policy_client
+from tempest.services.identity.v3.json import region_client
+from tempest.services.identity.v3.json import service_client
from tempest.services.messaging.json import messaging_client
from tempest.services.network.json import network_client
from tempest.services.object_storage import account_client
@@ -117,6 +127,7 @@
services_client.ServicesClientJSON,
tenant_usages_client.TenantUsagesClientJSON,
compute_volumes_extensions_client.VolumesExtensionsClientJSON,
+ data_processing_client.DataProcessingClient,
db_flavor_client.DatabaseFlavorsClientJSON,
db_version_client.DatabaseVersionsClientJSON,
messaging_client.MessagingClientJSON,
@@ -146,6 +157,13 @@
volume_v2_qos_client.QosSpecsV2ClientJSON,
volume_v2_snapshots_client.SnapshotsV2ClientJSON,
volume_v2_volumes_client.VolumesV2ClientJSON,
+ identity_v2_identity_client.IdentityClientJSON,
+ credentials_client.CredentialsClientJSON,
+ endpoints_client.EndPointClientJSON,
+ identity_v3_identity_client.IdentityV3ClientJSON,
+ policy_client.PolicyClientJSON,
+ region_client.RegionClientJSON,
+ service_client.ServiceClientJSON
]
for client in test_clients: