Merge "Move tempest_roles options to auth group"
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 4feba59..4f2715f 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -271,7 +271,7 @@
def _delete_volume(volumes_client, volume_id):
"""Deletes the given volume and waits for it to be gone."""
try:
- resp, _ = volumes_client.delete_volume(volume_id)
+ volumes_client.delete_volume(volume_id)
# TODO(mriedem): We should move the wait_for_resource_deletion
# into the delete_volume method as a convenience to the caller.
volumes_client.wait_for_resource_deletion(volume_id)
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 1d22fbd..7fef52f 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -61,7 +61,7 @@
self.servers_client.list_addresses(self.server['id']))
# Create a volume and wait for it to become ready
- _, self.volume = self.volumes_client.create_volume(
+ self.volume = self.volumes_client.create_volume(
1, display_name='test')
self.addCleanup(self._delete_volume)
self.volumes_client.wait_for_volume_status(self.volume['id'],
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index e70519e..65aeb24 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -15,7 +15,6 @@
import itertools
import netaddr
-import testtools
from tempest.api.network import base
from tempest.common import custom_matchers
@@ -571,9 +570,16 @@
test_subnet_ids,
'Subnet are not in the same network')
- @testtools.skipUnless(CONF.network_feature_enabled.ipv6_subnet_attributes,
- "IPv6 extended attributes for subnets not "
- "available")
+
+class NetworksIpV6TestAttrs(NetworksIpV6TestJSON):
+
+ @classmethod
+ def resource_setup(cls):
+ if not CONF.network_feature_enabled.ipv6_subnet_attributes:
+ raise cls.skipException("IPv6 extended attributes for "
+ "subnets not available")
+ super(NetworksIpV6TestAttrs, cls).resource_setup()
+
@test.attr(type='smoke')
def test_create_delete_subnet_with_v6_attributes_stateful(self):
self._create_verify_delete_subnet(
@@ -581,20 +587,54 @@
ipv6_ra_mode='dhcpv6-stateful',
ipv6_address_mode='dhcpv6-stateful')
- @testtools.skipUnless(CONF.network_feature_enabled.ipv6_subnet_attributes,
- "IPv6 extended attributes for subnets not "
- "available")
@test.attr(type='smoke')
def test_create_delete_subnet_with_v6_attributes_slaac(self):
self._create_verify_delete_subnet(
ipv6_ra_mode='slaac',
ipv6_address_mode='slaac')
- @testtools.skipUnless(CONF.network_feature_enabled.ipv6_subnet_attributes,
- "IPv6 extended attributes for subnets not "
- "available")
@test.attr(type='smoke')
def test_create_delete_subnet_with_v6_attributes_stateless(self):
self._create_verify_delete_subnet(
ipv6_ra_mode='dhcpv6-stateless',
ipv6_address_mode='dhcpv6-stateless')
+
+ def _test_delete_subnet_with_ports(self, mode):
+ """Create subnet and delete it with existing ports"""
+ slaac_network = self.create_network()
+ subnet_slaac = self.create_subnet(slaac_network,
+ **{'ipv6_ra_mode': mode,
+ 'ipv6_address_mode': mode})
+ port = self.create_port(slaac_network)
+ self.assertIsNotNone(port['fixed_ips'][0]['ip_address'])
+ self.client.delete_subnet(subnet_slaac['id'])
+ self.subnets.pop()
+ subnets = self.client.list_subnets()
+ subnet_ids = [subnet['id'] for subnet in subnets['subnets']]
+ self.assertNotIn(subnet_slaac['id'], subnet_ids,
+ "Subnet wasn't deleted")
+ self.assertRaisesRegexp(
+ exceptions.Conflict,
+ "There are one or more ports still in use on the network",
+ self.client.delete_network,
+ slaac_network['id'])
+
+ @test.attr(type='smoke')
+ def test_create_delete_slaac_subnet_with_ports(self):
+ """Test deleting subnet with SLAAC ports
+
+ Create subnet with SLAAC, create ports in network
+ and then you shall be able to delete subnet without port
+ deletion. But you still can not delete the network.
+ """
+ self._test_delete_subnet_with_ports("slaac")
+
+ @test.attr(type='smoke')
+ def test_create_delete_stateless_subnet_with_ports(self):
+ """Test deleting subnet with DHCPv6 stateless ports
+
+ Create subnet with DHCPv6 stateless, create ports in network
+ and then you shall be able to delete subnet without port
+ deletion. But you still can not delete the network.
+ """
+ self._test_delete_subnet_with_ports("dhcpv6-stateless")
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index 7ab5ebd..bf85e90 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -13,9 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+import netaddr
import socket
from tempest.api.network import base
+from tempest.api.network import base_security_groups as sec_base
from tempest.common import custom_matchers
from tempest.common.utils import data_utils
from tempest import config
@@ -24,7 +26,7 @@
CONF = config.CONF
-class PortsTestJSON(base.BaseNetworkTest):
+class PortsTestJSON(sec_base.BaseSecGroupTest):
_interface = 'json'
"""
@@ -83,6 +85,35 @@
self.assertTrue(port1['admin_state_up'])
self.assertTrue(port2['admin_state_up'])
+ @classmethod
+ def _get_ipaddress_from_tempest_conf(cls):
+ """Return first subnet gateway for configured CIDR """
+ if cls._ip_version == 4:
+ cidr = netaddr.IPNetwork(CONF.network.tenant_network_cidr)
+
+ elif cls._ip_version == 6:
+ cidr = netaddr.IPNetwork(CONF.network.tenant_network_v6_cidr)
+
+ return netaddr.IPAddress(cidr)
+
+ @test.attr(type='smoke')
+ def test_create_port_in_allowed_allocation_pools(self):
+ network = self.create_network()
+ net_id = network['id']
+ address = self._get_ipaddress_from_tempest_conf()
+ allocation_pools = {'allocation_pools': [{'start': str(address + 4),
+ 'end': str(address + 6)}]}
+ subnet = self.create_subnet(network, **allocation_pools)
+ self.addCleanup(self.client.delete_subnet, subnet['id'])
+ body = self.client.create_port(network_id=net_id)
+ self.addCleanup(self.client.delete_port, body['port']['id'])
+ port = body['port']
+ ip_address = port['fixed_ips'][0]['ip_address']
+ start_ip_address = allocation_pools['allocation_pools'][0]['start']
+ end_ip_address = allocation_pools['allocation_pools'][0]['end']
+ ip_range = netaddr.IPRange(start_ip_address, end_ip_address)
+ self.assertIn(ip_address, ip_range)
+
@test.attr(type='smoke')
def test_show_port(self):
# Verify the details of port
@@ -119,8 +150,11 @@
def test_port_list_filter_by_router_id(self):
# Create a router
network = self.create_network()
- self.create_subnet(network)
+ self.addCleanup(self.client.delete_network, network['id'])
+ subnet = self.create_subnet(network)
+ self.addCleanup(self.client.delete_subnet, subnet['id'])
router = self.create_router(data_utils.rand_name('router-'))
+ self.addCleanup(self.client.delete_router, router['id'])
port = self.client.create_port(network_id=network['id'])
# Add router interface to port created above
self.client.add_router_interface_with_port_id(
@@ -146,31 +180,41 @@
self.assertEqual(sorted(fields), sorted(port.keys()))
@test.attr(type='smoke')
- def test_update_port_with_second_ip(self):
+ def test_create_update_port_with_second_ip(self):
# Create a network with two subnets
network = self.create_network()
+ self.addCleanup(self.client.delete_network, network['id'])
subnet_1 = self.create_subnet(network)
+ self.addCleanup(self.client.delete_subnet, subnet_1['id'])
subnet_2 = self.create_subnet(network)
+ self.addCleanup(self.client.delete_subnet, subnet_2['id'])
fixed_ip_1 = [{'subnet_id': subnet_1['id']}]
fixed_ip_2 = [{'subnet_id': subnet_2['id']}]
- # Create a port with a single IP address from first subnet
- port = self.create_port(network,
- fixed_ips=fixed_ip_1)
- self.assertEqual(1, len(port['fixed_ips']))
-
- # Update the port with a second IP address from second subnet
fixed_ips = fixed_ip_1 + fixed_ip_2
- port = self.update_port(port, fixed_ips=fixed_ips)
+
+ # Create a port with multiple IP addresses
+ port = self.create_port(network,
+ fixed_ips=fixed_ips)
+ self.addCleanup(self.client.delete_port, port['id'])
self.assertEqual(2, len(port['fixed_ips']))
+ check_fixed_ips = [subnet_1['id'], subnet_2['id']]
+ for item in port['fixed_ips']:
+ self.assertIn(item['subnet_id'], check_fixed_ips)
# Update the port to return to a single IP address
port = self.update_port(port, fixed_ips=fixed_ip_1)
self.assertEqual(1, len(port['fixed_ips']))
+ # Update the port with a second IP address from second subnet
+ port = self.update_port(port, fixed_ips=fixed_ips)
+ self.assertEqual(2, len(port['fixed_ips']))
+
def _update_port_with_security_groups(self, security_groups_names):
- post_body = {"network_id": self.network['id']}
- self.create_subnet(self.network)
+ subnet_1 = self.create_subnet(self.network)
+ self.addCleanup(self.client.delete_subnet, subnet_1['id'])
+ fixed_ip_1 = [{'subnet_id': subnet_1['id']}]
+
security_groups_list = list()
for name in security_groups_names:
group_create_body = self.client.create_security_group(
@@ -180,24 +224,48 @@
security_groups_list.append(group_create_body['security_group']
['id'])
# Create a port
+ sec_grp_name = data_utils.rand_name('secgroup')
+ security_group = self.client.create_security_group(name=sec_grp_name)
+ self.addCleanup(self.client.delete_security_group,
+ security_group['security_group']['id'])
+ post_body = {
+ "name": data_utils.rand_name('port-'),
+ "security_groups": [security_group['security_group']['id']],
+ "network_id": self.network['id'],
+ "admin_state_up": True,
+ "fixed_ips": fixed_ip_1}
body = self.client.create_port(**post_body)
self.addCleanup(self.client.delete_port, body['port']['id'])
port = body['port']
+
# Update the port with security groups
- update_body = {"security_groups": security_groups_list}
+ subnet_2 = self.create_subnet(self.network)
+ fixed_ip_2 = [{'subnet_id': subnet_2['id']}]
+ update_body = {"name": data_utils.rand_name('port-'),
+ "admin_state_up": False,
+ "fixed_ips": fixed_ip_2,
+ "security_groups": security_groups_list}
body = self.client.update_port(port['id'], **update_body)
- # Verify the security groups updated to port
port_show = body['port']
+ # Verify the security groups and other attributes updated to port
+ exclude_keys = set(port_show).symmetric_difference(update_body)
+ exclude_keys.add('fixed_ips')
+ exclude_keys.add('security_groups')
+ self.assertThat(port_show, custom_matchers.MatchesDictExceptForKeys(
+ update_body, exclude_keys))
+ self.assertEqual(fixed_ip_2[0]['subnet_id'],
+ port_show['fixed_ips'][0]['subnet_id'])
+
for security_group in security_groups_list:
self.assertIn(security_group, port_show['security_groups'])
@test.attr(type='smoke')
- def test_update_port_with_security_group(self):
+ def test_update_port_with_security_group_and_extra_attributes(self):
self._update_port_with_security_groups(
[data_utils.rand_name('secgroup')])
@test.attr(type='smoke')
- def test_update_port_with_two_security_groups(self):
+ def test_update_port_with_two_security_groups_and_extra_attributes(self):
self._update_port_with_security_groups(
[data_utils.rand_name('secgroup'),
data_utils.rand_name('secgroup')])
@@ -222,23 +290,14 @@
@test.attr(type='smoke')
def test_create_port_with_no_securitygroups(self):
network = self.create_network()
- self.create_subnet(network)
+ self.addCleanup(self.client.delete_network, network['id'])
+ subnet = self.create_subnet(network)
+ self.addCleanup(self.client.delete_subnet, subnet['id'])
port = self.create_port(network, security_groups=[])
+ self.addCleanup(self.client.delete_port, port['id'])
self.assertIsNotNone(port['security_groups'])
self.assertEmpty(port['security_groups'])
- @test.attr(type='smoke')
- def test_update_port_with_no_securitygroups(self):
- network = self.create_network()
- self.create_subnet(network)
- port = self.create_port(network)
- # Verify that port is created with default security group
- self.assertIsNotNone(port['security_groups'])
- self.assertNotEmpty(port['security_groups'])
- updated_port = self.update_port(port, security_groups=[])
- self.assertIsNotNone(updated_port['security_groups'])
- self.assertEmpty(updated_port['security_groups'])
-
class PortsAdminExtendedAttrsTestJSON(base.BaseAdminNetworkTest):
_interface = 'json'
diff --git a/tempest/api/orchestration/stacks/test_volumes.py b/tempest/api/orchestration/stacks/test_volumes.py
index f47078c..6fddb21 100644
--- a/tempest/api/orchestration/stacks/test_volumes.py
+++ b/tempest/api/orchestration/stacks/test_volumes.py
@@ -33,7 +33,7 @@
def _cinder_verify(self, volume_id, template):
self.assertIsNotNone(volume_id)
- _, volume = self.volumes_client.get_volume(volume_id)
+ volume = self.volumes_client.get_volume(volume_id)
self.assertEqual('available', volume.get('status'))
self.assertEqual(template['resources']['volume']['properties'][
'size'], volume.get('size'))
diff --git a/tempest/api/volume/admin/test_multi_backend.py b/tempest/api/volume/admin/test_multi_backend.py
index 9e24993..65c4bd3 100644
--- a/tempest/api/volume/admin/test_multi_backend.py
+++ b/tempest/api/volume/admin/test_multi_backend.py
@@ -60,14 +60,14 @@
extra_specs = {spec_key_with_prefix: backend_name_key}
else:
extra_specs = {spec_key_without_prefix: backend_name_key}
- _, self.type = self.volume_types_client.create_volume_type(
+ self.type = self.volume_types_client.create_volume_type(
type_name, extra_specs=extra_specs)
self.volume_type_id_list.append(self.type['id'])
params = {self.name_field: vol_name, 'volume_type': type_name}
- _, self.volume = self.admin_volume_client.create_volume(size=1,
- **params)
+ self.volume = self.admin_volume_client.create_volume(size=1,
+ **params)
if with_prefix:
self.volume_id_list_with_prefix.append(self.volume['id'])
else:
@@ -131,7 +131,7 @@
# the multi backend feature has been enabled
# if multi-backend is enabled: os-vol-attr:host should be like:
# host@backend_name
- _, volume = self.admin_volume_client.get_volume(volume_id)
+ volume = self.admin_volume_client.get_volume(volume_id)
volume1_host = volume['os-vol-host-attr:host']
msg = ("multi-backend reporting incorrect values for volume %s" %
@@ -142,10 +142,10 @@
# this test checks that the two volumes created at setUp don't
# belong to the same backend (if they are, than the
# volume backend distinction is not working properly)
- _, volume = self.admin_volume_client.get_volume(volume1_id)
+ volume = self.admin_volume_client.get_volume(volume1_id)
volume1_host = volume['os-vol-host-attr:host']
- _, volume = self.admin_volume_client.get_volume(volume2_id)
+ volume = self.admin_volume_client.get_volume(volume2_id)
volume2_host = volume['os-vol-host-attr:host']
msg = ("volumes %s and %s were created in the same backend" %
diff --git a/tempest/api/volume/admin/test_snapshots_actions.py b/tempest/api/volume/admin/test_snapshots_actions.py
index 31dc09f..6c64298 100644
--- a/tempest/api/volume/admin/test_snapshots_actions.py
+++ b/tempest/api/volume/admin/test_snapshots_actions.py
@@ -30,7 +30,7 @@
vol_name = data_utils.rand_name(cls.__name__ + '-Volume-')
cls.name_field = cls.special_fields['name_field']
params = {cls.name_field: vol_name}
- _, cls.volume = \
+ cls.volume = \
cls.volumes_client.create_volume(size=1, **params)
cls.volumes_client.wait_for_volume_status(cls.volume['id'],
'available')
@@ -38,7 +38,7 @@
# Create a test shared snapshot for tests
snap_name = data_utils.rand_name(cls.__name__ + '-Snapshot-')
params = {cls.name_field: snap_name}
- _, cls.snapshot = \
+ cls.snapshot = \
cls.client.create_snapshot(cls.volume['id'], **params)
cls.client.wait_for_snapshot_status(cls.snapshot['id'],
'available')
@@ -68,9 +68,9 @@
# and force delete temp snapshot
temp_snapshot = self.create_snapshot(self.volume['id'])
if status:
- _, body = self.admin_snapshots_client.\
+ self.admin_snapshots_client.\
reset_snapshot_status(temp_snapshot['id'], status)
- _, volume_delete = self.admin_snapshots_client.\
+ self.admin_snapshots_client.\
force_delete_snapshot(temp_snapshot['id'])
self.client.wait_for_resource_deletion(temp_snapshot['id'])
@@ -81,9 +81,9 @@
def test_reset_snapshot_status(self):
# Reset snapshot status to creating
status = 'creating'
- _, body = self.admin_snapshots_client.\
+ self.admin_snapshots_client.\
reset_snapshot_status(self.snapshot['id'], status)
- _, snapshot_get \
+ snapshot_get \
= self.admin_snapshots_client.get_snapshot(self.snapshot['id'])
self.assertEqual(status, snapshot_get['status'])
@@ -98,9 +98,9 @@
progress = '80%'
status = 'error'
progress_alias = self._get_progress_alias()
- _, body = self.client.update_snapshot_status(self.snapshot['id'],
- status, progress)
- _, snapshot_get \
+ self.client.update_snapshot_status(self.snapshot['id'],
+ status, progress)
+ snapshot_get \
= self.admin_snapshots_client.get_snapshot(self.snapshot['id'])
self.assertEqual(status, snapshot_get['status'])
self.assertEqual(progress, snapshot_get[progress_alias])
diff --git a/tempest/api/volume/admin/test_volume_hosts.py b/tempest/api/volume/admin/test_volume_hosts.py
index e966613..a214edf 100644
--- a/tempest/api/volume/admin/test_volume_hosts.py
+++ b/tempest/api/volume/admin/test_volume_hosts.py
@@ -22,7 +22,7 @@
@test.attr(type='gate')
def test_list_hosts(self):
- _, hosts = self.hosts_client.list_hosts()
+ hosts = self.hosts_client.list_hosts()
self.assertTrue(len(hosts) >= 2, "No. of hosts are < 2,"
"response of list hosts is: % s" % hosts)
diff --git a/tempest/api/volume/admin/test_volume_quotas.py b/tempest/api/volume/admin/test_volume_quotas.py
index 80ef914..52f2d90 100644
--- a/tempest/api/volume/admin/test_volume_quotas.py
+++ b/tempest/api/volume/admin/test_volume_quotas.py
@@ -33,13 +33,13 @@
@test.attr(type='gate')
def test_list_quotas(self):
- _, quotas = self.quotas_client.get_quota_set(self.demo_tenant_id)
+ quotas = self.quotas_client.get_quota_set(self.demo_tenant_id)
for key in QUOTA_KEYS:
self.assertIn(key, quotas)
@test.attr(type='gate')
def test_list_default_quotas(self):
- _, quotas = self.quotas_client.get_default_quota_set(
+ quotas = self.quotas_client.get_default_quota_set(
self.demo_tenant_id)
for key in QUOTA_KEYS:
self.assertIn(key, quotas)
@@ -47,14 +47,14 @@
@test.attr(type='gate')
def test_update_all_quota_resources_for_tenant(self):
# Admin can update all the resource quota limits for a tenant
- _, default_quota_set = self.quotas_client.get_default_quota_set(
+ default_quota_set = self.quotas_client.get_default_quota_set(
self.demo_tenant_id)
new_quota_set = {'gigabytes': 1009,
'volumes': 11,
'snapshots': 11}
# Update limits for all quota resources
- _, quota_set = self.quotas_client.update_quota_set(
+ quota_set = self.quotas_client.update_quota_set(
self.demo_tenant_id,
**new_quota_set)
@@ -70,7 +70,7 @@
@test.attr(type='gate')
def test_show_quota_usage(self):
- _, quota_usage = self.quotas_client.get_quota_usage(
+ quota_usage = self.quotas_client.get_quota_usage(
self.os_adm.credentials.tenant_id)
for key in QUOTA_KEYS:
self.assertIn(key, quota_usage)
@@ -79,14 +79,14 @@
@test.attr(type='gate')
def test_quota_usage(self):
- _, quota_usage = self.quotas_client.get_quota_usage(
+ quota_usage = self.quotas_client.get_quota_usage(
self.demo_tenant_id)
volume = self.create_volume(size=1)
self.addCleanup(self.admin_volume_client.delete_volume,
volume['id'])
- _, new_quota_usage = self.quotas_client.get_quota_usage(
+ new_quota_usage = self.quotas_client.get_quota_usage(
self.demo_tenant_id)
self.assertEqual(quota_usage['volumes']['in_use'] + 1,
@@ -103,7 +103,7 @@
tenant = identity_client.create_tenant(tenant_name)
tenant_id = tenant['id']
self.addCleanup(identity_client.delete_tenant, tenant_id)
- _, quota_set_default = self.quotas_client.get_default_quota_set(
+ quota_set_default = self.quotas_client.get_default_quota_set(
tenant_id)
volume_default = quota_set_default['volumes']
@@ -111,7 +111,7 @@
volumes=(int(volume_default) + 5))
self.quotas_client.delete_quota_set(tenant_id)
- _, quota_set_new = self.quotas_client.get_quota_set(tenant_id)
+ quota_set_new = self.quotas_client.get_quota_set(tenant_id)
self.assertEqual(volume_default, quota_set_new['volumes'])
diff --git a/tempest/api/volume/admin/test_volume_quotas_negative.py b/tempest/api/volume/admin/test_volume_quotas_negative.py
index c367ebb..5cf6af0 100644
--- a/tempest/api/volume/admin/test_volume_quotas_negative.py
+++ b/tempest/api/volume/admin/test_volume_quotas_negative.py
@@ -31,7 +31,7 @@
# NOTE(gfidente): no need to restore original quota set
# after the tests as they only work with tenant isolation.
- _, quota_set = cls.quotas_client.update_quota_set(
+ cls.quotas_client.update_quota_set(
cls.demo_tenant_id,
**cls.shared_quota_set)
@@ -62,7 +62,7 @@
**self.shared_quota_set)
new_quota_set = {'gigabytes': 2, 'volumes': 2, 'snapshots': 1}
- _, quota_set = self.quotas_client.update_quota_set(
+ self.quotas_client.update_quota_set(
self.demo_tenant_id,
**new_quota_set)
self.assertRaises(exceptions.OverLimit,
@@ -70,7 +70,7 @@
size=1)
new_quota_set = {'gigabytes': 2, 'volumes': 1, 'snapshots': 2}
- _, quota_set = self.quotas_client.update_quota_set(
+ self.quotas_client.update_quota_set(
self.demo_tenant_id,
**self.shared_quota_set)
self.assertRaises(exceptions.OverLimit,
diff --git a/tempest/api/volume/admin/test_volume_services.py b/tempest/api/volume/admin/test_volume_services.py
index fffc5cb..46db70f 100644
--- a/tempest/api/volume/admin/test_volume_services.py
+++ b/tempest/api/volume/admin/test_volume_services.py
@@ -27,19 +27,19 @@
@classmethod
def resource_setup(cls):
super(VolumesServicesV2TestJSON, cls).resource_setup()
- _, cls.services = cls.admin_volume_services_client.list_services()
+ cls.services = cls.admin_volume_services_client.list_services()
cls.host_name = cls.services[0]['host']
cls.binary_name = cls.services[0]['binary']
@test.attr(type='gate')
def test_list_services(self):
- _, services = self.admin_volume_services_client.list_services()
+ services = self.admin_volume_services_client.list_services()
self.assertNotEqual(0, len(services))
@test.attr(type='gate')
def test_get_service_by_service_binary_name(self):
params = {'binary': self.binary_name}
- _, services = self.admin_volume_services_client.list_services(params)
+ services = self.admin_volume_services_client.list_services(params)
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(self.binary_name, service['binary'])
@@ -50,7 +50,7 @@
service['host'] == self.host_name]
params = {'host': self.host_name}
- _, services = self.admin_volume_services_client.list_services(params)
+ services = self.admin_volume_services_client.list_services(params)
# we could have a periodic job checkin between the 2 service
# lookups, so only compare binary lists.
@@ -64,7 +64,7 @@
def test_get_service_by_service_and_host_name(self):
params = {'host': self.host_name, 'binary': self.binary_name}
- _, services = self.admin_volume_services_client.list_services(params)
+ services = self.admin_volume_services_client.list_services(params)
self.assertEqual(1, len(services))
self.assertEqual(self.host_name, services[0]['host'])
self.assertEqual(self.binary_name, services[0]['binary'])
diff --git a/tempest/api/volume/admin/test_volume_types.py b/tempest/api/volume/admin/test_volume_types.py
index a481224..58f1551 100644
--- a/tempest/api/volume/admin/test_volume_types.py
+++ b/tempest/api/volume/admin/test_volume_types.py
@@ -34,7 +34,7 @@
@test.attr(type='smoke')
def test_volume_type_list(self):
# List Volume types.
- _, body = self.volume_types_client.list_volume_types()
+ body = self.volume_types_client.list_volume_types()
self.assertIsInstance(body, list)
@test.attr(type='smoke')
@@ -49,14 +49,14 @@
extra_specs = {"storage_protocol": proto,
"vendor_name": vendor}
body = {}
- _, body = self.volume_types_client.create_volume_type(
+ 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(
+ volume = self.volumes_client.create_volume(
size=1, **params)
self.assertIn('id', volume)
self.addCleanup(self._delete_volume, volume['id'])
@@ -67,7 +67,7 @@
self.assertTrue(volume['id'] is not None,
"Field volume id is empty or not found.")
self.volumes_client.wait_for_volume_status(volume['id'], 'available')
- _, fetched_volume = self.volumes_client.get_volume(volume['id'])
+ fetched_volume = self.volumes_client.get_volume(volume['id'])
self.assertEqual(vol_name, fetched_volume[self.name_field],
'The fetched Volume is different '
'from the created Volume')
@@ -87,7 +87,7 @@
vendor = CONF.volume.vendor_name
extra_specs = {"storage_protocol": proto,
"vendor_name": vendor}
- _, body = self.volume_types_client.create_volume_type(
+ body = self.volume_types_client.create_volume_type(
name,
extra_specs=extra_specs)
self.assertIn('id', body)
@@ -98,7 +98,7 @@
"to the requested name")
self.assertTrue(body['id'] is not None,
"Field volume_type id is empty or not found.")
- _, fetched_volume_type = self.volume_types_client.get_volume_type(
+ fetched_volume_type = self.volume_types_client.get_volume_type(
body['id'])
self.assertEqual(name, fetched_volume_type['name'],
'The fetched Volume_type is different '
@@ -116,11 +116,11 @@
provider = "LuksEncryptor"
control_location = "front-end"
name = data_utils.rand_name("volume-type-")
- _, body = self.volume_types_client.create_volume_type(name)
+ body = self.volume_types_client.create_volume_type(name)
self.addCleanup(self._delete_volume_type, body['id'])
# Create encryption type
- _, encryption_type = self.volume_types_client.create_encryption_type(
+ encryption_type = self.volume_types_client.create_encryption_type(
body['id'], provider=provider,
control_location=control_location)
self.assertIn('volume_type_id', encryption_type)
@@ -132,7 +132,7 @@
"equal to the requested control_location")
# Get encryption type
- _, fetched_encryption_type = (
+ fetched_encryption_type = (
self.volume_types_client.get_encryption_type(
encryption_type['volume_type_id']))
self.assertEqual(provider,
@@ -150,7 +150,7 @@
resource = {"id": encryption_type['volume_type_id'],
"type": "encryption-type"}
self.volume_types_client.wait_for_resource_deletion(resource)
- _, deleted_encryption_type = (
+ deleted_encryption_type = (
self.volume_types_client.get_encryption_type(
encryption_type['volume_type_id']))
self.assertEmpty(deleted_encryption_type)
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs.py b/tempest/api/volume/admin/test_volume_types_extra_specs.py
index 3b9f6bb..460a6c3 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs.py
@@ -25,7 +25,7 @@
def resource_setup(cls):
super(VolumeTypesExtraSpecsV2Test, cls).resource_setup()
vol_type_name = data_utils.rand_name('Volume-type-')
- _, cls.volume_type = cls.volume_types_client.create_volume_type(
+ cls.volume_type = cls.volume_types_client.create_volume_type(
vol_type_name)
@classmethod
@@ -37,11 +37,11 @@
def test_volume_type_extra_specs_list(self):
# List Volume types extra specs.
extra_specs = {"spec1": "val1"}
- _, body = self.volume_types_client.create_volume_type_extra_specs(
+ body = self.volume_types_client.create_volume_type_extra_specs(
self.volume_type['id'], extra_specs)
self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly created")
- _, body = self.volume_types_client.list_volume_types_extra_specs(
+ body = self.volume_types_client.list_volume_types_extra_specs(
self.volume_type['id'])
self.assertIsInstance(body, dict)
self.assertIn('spec1', body)
@@ -50,13 +50,13 @@
def test_volume_type_extra_specs_update(self):
# Update volume type extra specs
extra_specs = {"spec2": "val1"}
- _, body = self.volume_types_client.create_volume_type_extra_specs(
+ body = self.volume_types_client.create_volume_type_extra_specs(
self.volume_type['id'], extra_specs)
self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly created")
extra_spec = {"spec2": "val2"}
- _, body = self.volume_types_client.update_volume_type_extra_specs(
+ body = self.volume_types_client.update_volume_type_extra_specs(
self.volume_type['id'],
extra_spec.keys()[0],
extra_spec)
@@ -68,7 +68,7 @@
def test_volume_type_extra_spec_create_get_delete(self):
# Create/Get/Delete volume type extra spec.
extra_specs = {"spec3": "val1"}
- _, body = self.volume_types_client.create_volume_type_extra_specs(
+ body = self.volume_types_client.create_volume_type_extra_specs(
self.volume_type['id'],
extra_specs)
self.assertEqual(extra_specs, body,
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 40af37e..fff0199 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
@@ -29,7 +29,7 @@
super(ExtraSpecsNegativeV2Test, cls).resource_setup()
vol_type_name = data_utils.rand_name('Volume-type-')
cls.extra_specs = {"spec1": "val1"}
- _, cls.volume_type = cls.volume_types_client.create_volume_type(
+ cls.volume_type = cls.volume_types_client.create_volume_type(
vol_type_name,
extra_specs=cls.extra_specs)
diff --git a/tempest/api/volume/admin/test_volumes_actions.py b/tempest/api/volume/admin/test_volumes_actions.py
index 8db6106..4feba73 100644
--- a/tempest/api/volume/admin/test_volumes_actions.py
+++ b/tempest/api/volume/admin/test_volumes_actions.py
@@ -31,8 +31,8 @@
cls.name_field = cls.special_fields['name_field']
params = {cls.name_field: vol_name}
- _, cls.volume = cls.client.create_volume(size=1,
- **params)
+ cls.volume = cls.client.create_volume(size=1,
+ **params)
cls.client.wait_for_volume_status(cls.volume['id'], 'available')
@classmethod
@@ -45,9 +45,9 @@
def _reset_volume_status(self, volume_id, status):
# Reset the volume status
- _, body = self.admin_volume_client.reset_volume_status(volume_id,
- status)
- return _, body
+ body = self.admin_volume_client.reset_volume_status(volume_id,
+ status)
+ return body
def tearDown(self):
# Set volume's status to available after test
@@ -58,8 +58,8 @@
# Create a temp volume for force delete tests
vol_name = utils.rand_name('Volume')
params = {self.name_field: vol_name}
- _, temp_volume = self.client.create_volume(size=1,
- **params)
+ temp_volume = self.client.create_volume(size=1,
+ **params)
self.client.wait_for_volume_status(temp_volume['id'], 'available')
return temp_volume
@@ -68,16 +68,15 @@
# Create volume, reset volume status, and force delete temp volume
temp_volume = self._create_temp_volume()
if status:
- _, body = self._reset_volume_status(temp_volume['id'], status)
- _, volume_delete = self.admin_volume_client.\
- force_delete_volume(temp_volume['id'])
+ self._reset_volume_status(temp_volume['id'], status)
+ self.admin_volume_client.force_delete_volume(temp_volume['id'])
self.client.wait_for_resource_deletion(temp_volume['id'])
@test.attr(type='gate')
def test_volume_reset_status(self):
# test volume reset status : available->error->available
- _, body = self._reset_volume_status(self.volume['id'], 'error')
- _, volume_get = self.admin_volume_client.get_volume(
+ self._reset_volume_status(self.volume['id'], 'error')
+ volume_get = self.admin_volume_client.get_volume(
self.volume['id'])
self.assertEqual('error', volume_get['status'])
diff --git a/tempest/api/volume/admin/test_volumes_backup.py b/tempest/api/volume/admin/test_volumes_backup.py
index 1357d31..0739480 100644
--- a/tempest/api/volume/admin/test_volumes_backup.py
+++ b/tempest/api/volume/admin/test_volumes_backup.py
@@ -40,8 +40,8 @@
# Create backup
backup_name = data_utils.rand_name('Backup')
create_backup = self.backups_adm_client.create_backup
- _, backup = create_backup(self.volume['id'],
- name=backup_name)
+ backup = create_backup(self.volume['id'],
+ name=backup_name)
self.addCleanup(self.backups_adm_client.delete_backup,
backup['id'])
self.assertEqual(backup_name, backup['name'])
@@ -51,16 +51,16 @@
'available')
# Get a given backup
- _, backup = self.backups_adm_client.get_backup(backup['id'])
+ backup = self.backups_adm_client.get_backup(backup['id'])
self.assertEqual(backup_name, backup['name'])
# Get all backups with detail
- _, backups = self.backups_adm_client.list_backups_with_detail()
+ backups = self.backups_adm_client.list_backups_with_detail()
self.assertIn((backup['name'], backup['id']),
[(m['name'], m['id']) for m in backups])
# Restore backup
- _, restore = self.backups_adm_client.restore_backup(backup['id'])
+ restore = self.backups_adm_client.restore_backup(backup['id'])
# Delete backup
self.addCleanup(self.admin_volume_client.delete_volume,
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 52e48f3..127a216 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -97,7 +97,7 @@
name_field = cls.special_fields['name_field']
kwargs[name_field] = name
- _, volume = cls.volumes_client.create_volume(size, **kwargs)
+ volume = cls.volumes_client.create_volume(size, **kwargs)
cls.volumes.append(volume)
cls.volumes_client.wait_for_volume_status(volume['id'], 'available')
@@ -106,8 +106,8 @@
@classmethod
def create_snapshot(cls, volume_id=1, **kwargs):
"""Wrapper utility that returns a test snapshot."""
- _, snapshot = cls.snapshots_client.create_snapshot(volume_id,
- **kwargs)
+ snapshot = cls.snapshots_client.create_snapshot(volume_id,
+ **kwargs)
cls.snapshots.append(snapshot)
cls.snapshots_client.wait_for_snapshot_status(snapshot['id'],
'available')
@@ -198,8 +198,8 @@
"""create a test Qos-Specs."""
name = name or data_utils.rand_name(cls.__name__ + '-QoS')
consumer = consumer or 'front-end'
- _, qos_specs = cls.volume_qos_client.create_qos(name, consumer,
- **kwargs)
+ qos_specs = cls.volume_qos_client.create_qos(name, consumer,
+ **kwargs)
cls.qos_specs.append(qos_specs['id'])
return qos_specs
diff --git a/tempest/api/volume/test_availability_zone.py b/tempest/api/volume/test_availability_zone.py
index c3d5d02..bd3d2a1 100644
--- a/tempest/api/volume/test_availability_zone.py
+++ b/tempest/api/volume/test_availability_zone.py
@@ -31,7 +31,7 @@
@test.attr(type='gate')
def test_get_availability_zone_list(self):
# List of availability zone
- _, availability_zone = self.client.get_availability_zone_list()
+ availability_zone = self.client.get_availability_zone_list()
self.assertTrue(len(availability_zone) > 0)
diff --git a/tempest/api/volume/test_extensions.py b/tempest/api/volume/test_extensions.py
index 0f6c2d6..dbbdea4 100644
--- a/tempest/api/volume/test_extensions.py
+++ b/tempest/api/volume/test_extensions.py
@@ -30,7 +30,7 @@
@test.attr(type='gate')
def test_list_extensions(self):
# List of all extensions
- _, extensions = self.volumes_extension_client.list_extensions()
+ extensions = self.volumes_extension_client.list_extensions()
if len(CONF.volume_feature_enabled.api_extensions) == 0:
raise self.skipException('There are not any extensions configured')
extension_list = [extension.get('alias') for extension in extensions]
diff --git a/tempest/api/volume/test_qos.py b/tempest/api/volume/test_qos.py
index a719b79..60c327b 100644
--- a/tempest/api/volume/test_qos.py
+++ b/tempest/api/volume/test_qos.py
@@ -47,12 +47,12 @@
self.volume_qos_client.wait_for_resource_deletion(body['id'])
# validate the deletion
- _, list_qos = self.volume_qos_client.list_qos()
+ list_qos = self.volume_qos_client.list_qos()
self.assertNotIn(body, list_qos)
def _create_test_volume_type(self):
vol_type_name = utils.rand_name("volume-type")
- _, vol_type = self.volume_types_client.create_volume_type(
+ vol_type = self.volume_types_client.create_volume_type(
vol_type_name)
self.addCleanup(self.volume_types_client.delete_volume_type,
vol_type['id'])
@@ -63,7 +63,7 @@
self.created_qos['id'], vol_type_id)
def _test_get_association_qos(self):
- _, body = self.volume_qos_client.get_association_qos(
+ body = self.volume_qos_client.get_association_qos(
self.created_qos['id'])
associations = []
@@ -97,24 +97,24 @@
@test.attr(type='smoke')
def test_get_qos(self):
"""Tests the detail of a given qos-specs"""
- _, body = self.volume_qos_client.get_qos(self.created_qos['id'])
+ body = self.volume_qos_client.get_qos(self.created_qos['id'])
self.assertEqual(self.qos_name, body['name'])
self.assertEqual(self.qos_consumer, body['consumer'])
@test.attr(type='smoke')
def test_list_qos(self):
"""Tests the list of all qos-specs"""
- _, body = self.volume_qos_client.list_qos()
+ body = self.volume_qos_client.list_qos()
self.assertIn(self.created_qos, body)
@test.attr(type='smoke')
def test_set_unset_qos_key(self):
"""Test the addition of a specs key to qos-specs"""
args = {'iops_bytes': '500'}
- _, body = self.volume_qos_client.set_qos_key(self.created_qos['id'],
- iops_bytes='500')
+ body = self.volume_qos_client.set_qos_key(self.created_qos['id'],
+ iops_bytes='500')
self.assertEqual(args, body)
- _, body = self.volume_qos_client.get_qos(self.created_qos['id'])
+ body = self.volume_qos_client.get_qos(self.created_qos['id'])
self.assertEqual(args['iops_bytes'], body['specs']['iops_bytes'])
# test the deletion of a specs key from qos-specs
@@ -123,7 +123,7 @@
operation = 'qos-key-unset'
self.volume_qos_client.wait_for_qos_operations(self.created_qos['id'],
operation, keys)
- _, body = self.volume_qos_client.get_qos(self.created_qos['id'])
+ body = self.volume_qos_client.get_qos(self.created_qos['id'])
self.assertNotIn(keys[0], body['specs'])
@test.attr(type='smoke')
diff --git a/tempest/api/volume/test_snapshot_metadata.py b/tempest/api/volume/test_snapshot_metadata.py
index 0dceb3d..03474ba 100644
--- a/tempest/api/volume/test_snapshot_metadata.py
+++ b/tempest/api/volume/test_snapshot_metadata.py
@@ -42,15 +42,15 @@
"key3": "value3"}
expected = {"key2": "value2",
"key3": "value3"}
- _, body = self.client.create_snapshot_metadata(self.snapshot_id,
- metadata)
+ body = self.client.create_snapshot_metadata(self.snapshot_id,
+ metadata)
# Get the metadata of the snapshot
- _, body = self.client.get_snapshot_metadata(self.snapshot_id)
+ body = self.client.get_snapshot_metadata(self.snapshot_id)
self.assertEqual(metadata, body)
# Delete one item metadata of the snapshot
self.client.delete_snapshot_metadata_item(
self.snapshot_id, "key1")
- _, body = self.client.get_snapshot_metadata(self.snapshot_id)
+ body = self.client.get_snapshot_metadata(self.snapshot_id)
self.assertEqual(expected, body)
@test.attr(type='gate')
@@ -62,16 +62,16 @@
update = {"key3": "value3_update",
"key4": "value4"}
# Create metadata for the snapshot
- _, body = self.client.create_snapshot_metadata(self.snapshot_id,
- metadata)
+ body = self.client.create_snapshot_metadata(self.snapshot_id,
+ metadata)
# Get the metadata of the snapshot
- _, body = self.client.get_snapshot_metadata(self.snapshot_id)
+ body = self.client.get_snapshot_metadata(self.snapshot_id)
self.assertEqual(metadata, body)
# Update metadata item
- _, body = self.client.update_snapshot_metadata(
+ body = self.client.update_snapshot_metadata(
self.snapshot_id, update)
# Get the metadata of the snapshot
- _, body = self.client.get_snapshot_metadata(self.snapshot_id)
+ body = self.client.get_snapshot_metadata(self.snapshot_id)
self.assertEqual(update, body)
@test.attr(type='gate')
@@ -85,16 +85,16 @@
"key2": "value2",
"key3": "value3_update"}
# Create metadata for the snapshot
- _, body = self.client.create_snapshot_metadata(self.snapshot_id,
- metadata)
+ body = self.client.create_snapshot_metadata(self.snapshot_id,
+ metadata)
# Get the metadata of the snapshot
- _, body = self.client.get_snapshot_metadata(self.snapshot_id)
+ body = self.client.get_snapshot_metadata(self.snapshot_id)
self.assertEqual(metadata, body)
# Update metadata item
- _, body = self.client.update_snapshot_metadata_item(
+ body = self.client.update_snapshot_metadata_item(
self.snapshot_id, "key3", update_item)
# Get the metadata of the snapshot
- _, body = self.client.get_snapshot_metadata(self.snapshot_id)
+ body = self.client.get_snapshot_metadata(self.snapshot_id)
self.assertEqual(expect, body)
diff --git a/tempest/api/volume/test_volume_metadata.py b/tempest/api/volume/test_volume_metadata.py
index ac5d016..4739fd2 100644
--- a/tempest/api/volume/test_volume_metadata.py
+++ b/tempest/api/volume/test_volume_metadata.py
@@ -41,15 +41,15 @@
"key3": "value3",
"key4": "<value&special_chars>"}
- _, body = self.volumes_client.create_volume_metadata(self.volume_id,
- metadata)
+ body = self.volumes_client.create_volume_metadata(self.volume_id,
+ metadata)
# Get the metadata of the volume
- _, body = self.volumes_client.get_volume_metadata(self.volume_id)
+ body = self.volumes_client.get_volume_metadata(self.volume_id)
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Delete one item metadata of the volume
self.volumes_client.delete_volume_metadata_item(
self.volume_id, "key1")
- _, body = self.volumes_client.get_volume_metadata(self.volume_id)
+ body = self.volumes_client.get_volume_metadata(self.volume_id)
self.assertNotIn("key1", body)
del metadata["key1"]
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
@@ -65,16 +65,16 @@
"key1": "value1_update"}
# Create metadata for the volume
- _, body = self.volumes_client.create_volume_metadata(
+ body = self.volumes_client.create_volume_metadata(
self.volume_id, metadata)
# Get the metadata of the volume
- _, body = self.volumes_client.get_volume_metadata(self.volume_id)
+ body = self.volumes_client.get_volume_metadata(self.volume_id)
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Update metadata
- _, body = self.volumes_client.update_volume_metadata(
+ body = self.volumes_client.update_volume_metadata(
self.volume_id, update)
# Get the metadata of the volume
- _, body = self.volumes_client.get_volume_metadata(self.volume_id)
+ body = self.volumes_client.get_volume_metadata(self.volume_id)
self.assertThat(body.items(), matchers.ContainsAll(update.items()))
@test.attr(type='gate')
@@ -88,14 +88,14 @@
"key2": "value2",
"key3": "value3_update"}
# Create metadata for the volume
- _, body = self.volumes_client.create_volume_metadata(
+ body = self.volumes_client.create_volume_metadata(
self.volume_id, metadata)
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Update metadata item
- _, body = self.volumes_client.update_volume_metadata_item(
+ body = self.volumes_client.update_volume_metadata_item(
self.volume_id, "key3", update_item)
# Get the metadata of the volume
- _, body = self.volumes_client.get_volume_metadata(self.volume_id)
+ body = self.volumes_client.get_volume_metadata(self.volume_id)
self.assertThat(body.items(), matchers.ContainsAll(expect.items()))
diff --git a/tempest/api/volume/test_volume_transfers.py b/tempest/api/volume/test_volume_transfers.py
index 2011c1b..b2961bd 100644
--- a/tempest/api/volume/test_volume_transfers.py
+++ b/tempest/api/volume/test_volume_transfers.py
@@ -58,24 +58,24 @@
self.addCleanup(self._delete_volume, volume['id'])
# Create a volume transfer
- _, transfer = self.client.create_volume_transfer(volume['id'])
+ transfer = self.client.create_volume_transfer(volume['id'])
transfer_id = transfer['id']
auth_key = transfer['auth_key']
self.client.wait_for_volume_status(volume['id'],
'awaiting-transfer')
# Get a volume transfer
- _, body = self.client.get_volume_transfer(transfer_id)
+ body = self.client.get_volume_transfer(transfer_id)
self.assertEqual(volume['id'], body['volume_id'])
# List volume transfers, the result should be greater than
# or equal to 1
- _, body = self.client.list_volume_transfers()
+ body = self.client.list_volume_transfers()
self.assertThat(len(body), matchers.GreaterThan(0))
# Accept a volume transfer by alt_tenant
- _, body = self.alt_client.accept_volume_transfer(transfer_id,
- auth_key)
+ body = self.alt_client.accept_volume_transfer(transfer_id,
+ auth_key)
self.alt_client.wait_for_volume_status(volume['id'], 'available')
def test_create_list_delete_volume_transfer(self):
@@ -84,13 +84,13 @@
self.addCleanup(self._delete_volume, volume['id'])
# Create a volume transfer
- _, body = self.client.create_volume_transfer(volume['id'])
+ body = self.client.create_volume_transfer(volume['id'])
transfer_id = body['id']
self.client.wait_for_volume_status(volume['id'],
'awaiting-transfer')
# List all volume transfers (looking for the one we created)
- _, body = self.client.list_volume_transfers()
+ body = self.client.list_volume_transfers()
for transfer in body:
if volume['id'] == transfer['volume_id']:
break
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 4fd27b1..ceabb1c 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -57,11 +57,11 @@
def test_attach_detach_volume_to_instance(self):
# Volume is attached and detached successfully from an instance
mountpoint = '/dev/vdc'
- _, body = self.client.attach_volume(self.volume['id'],
- self.server['id'],
- mountpoint)
+ self.client.attach_volume(self.volume['id'],
+ self.server['id'],
+ mountpoint)
self.client.wait_for_volume_status(self.volume['id'], 'in-use')
- _, body = self.client.detach_volume(self.volume['id'])
+ self.client.detach_volume(self.volume['id'])
self.client.wait_for_volume_status(self.volume['id'], 'available')
@test.stresstest(class_setup_per='process')
@@ -70,9 +70,9 @@
def test_get_volume_attachment(self):
# Verify that a volume's attachment information is retrieved
mountpoint = '/dev/vdc'
- _, body = self.client.attach_volume(self.volume['id'],
- self.server['id'],
- mountpoint)
+ self.client.attach_volume(self.volume['id'],
+ self.server['id'],
+ mountpoint)
self.client.wait_for_volume_status(self.volume['id'], 'in-use')
# NOTE(gfidente): added in reverse order because functions will be
# called in reverse order to the order they are added (LIFO)
@@ -80,7 +80,7 @@
self.volume['id'],
'available')
self.addCleanup(self.client.detach_volume, self.volume['id'])
- _, volume = self.client.get_volume(self.volume['id'])
+ volume = self.client.get_volume(self.volume['id'])
self.assertIn('attachments', volume)
attachment = self.client.get_attachment_from_volume(volume)
self.assertEqual(mountpoint, attachment['device'])
@@ -96,9 +96,9 @@
# there is no way to delete it from Cinder, so we delete it from Glance
# using the Glance image_client and from Cinder via tearDownClass.
image_name = data_utils.rand_name('Image-')
- _, body = self.client.upload_volume(self.volume['id'],
- image_name,
- CONF.volume.disk_format)
+ body = self.client.upload_volume(self.volume['id'],
+ image_name,
+ CONF.volume.disk_format)
image_id = body["image_id"]
self.addCleanup(self.image_client.delete_image, image_id)
self.image_client.wait_for_image_status(image_id, 'active')
@@ -107,14 +107,14 @@
@test.attr(type='gate')
def test_reserve_unreserve_volume(self):
# Mark volume as reserved.
- _, body = self.client.reserve_volume(self.volume['id'])
+ body = self.client.reserve_volume(self.volume['id'])
# To get the volume info
- _, body = self.client.get_volume(self.volume['id'])
+ body = self.client.get_volume(self.volume['id'])
self.assertIn('attaching', body['status'])
# Unmark volume as reserved.
- _, body = self.client.unreserve_volume(self.volume['id'])
+ body = self.client.unreserve_volume(self.volume['id'])
# To get the volume info
- _, body = self.client.get_volume(self.volume['id'])
+ body = self.client.get_volume(self.volume['id'])
self.assertIn('available', body['status'])
def _is_true(self, val):
@@ -124,20 +124,19 @@
def test_volume_readonly_update(self):
# Update volume readonly true
readonly = True
- _, body = self.client.update_volume_readonly(self.volume['id'],
- readonly)
+ self.client.update_volume_readonly(self.volume['id'],
+ readonly)
# Get Volume information
- _, fetched_volume = self.client.get_volume(self.volume['id'])
+ fetched_volume = self.client.get_volume(self.volume['id'])
bool_flag = self._is_true(fetched_volume['metadata']['readonly'])
self.assertEqual(True, bool_flag)
# Update volume readonly false
readonly = False
- _, body = self.client.update_volume_readonly(self.volume['id'],
- readonly)
+ self.client.update_volume_readonly(self.volume['id'], readonly)
# Get Volume information
- _, fetched_volume = self.client.get_volume(self.volume['id'])
+ fetched_volume = self.client.get_volume(self.volume['id'])
bool_flag = self._is_true(fetched_volume['metadata']['readonly'])
self.assertEqual(False, bool_flag)
diff --git a/tempest/api/volume/test_volumes_extend.py b/tempest/api/volume/test_volumes_extend.py
index 2b816ef..ebe6084 100644
--- a/tempest/api/volume/test_volumes_extend.py
+++ b/tempest/api/volume/test_volumes_extend.py
@@ -32,9 +32,9 @@
# Extend Volume Test.
self.volume = self.create_volume()
extend_size = int(self.volume['size']) + 1
- _, body = self.client.extend_volume(self.volume['id'], extend_size)
+ self.client.extend_volume(self.volume['id'], extend_size)
self.client.wait_for_volume_status(self.volume['id'], 'available')
- _, volume = self.client.get_volume(self.volume['id'])
+ volume = self.client.get_volume(self.volume['id'])
self.assertEqual(int(volume['size']), extend_size)
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index a9c10aa..6d9c438 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -54,7 +54,7 @@
# Create a volume
kwargs[self.name_field] = v_name
kwargs['metadata'] = metadata
- _, volume = self.client.create_volume(**kwargs)
+ volume = self.client.create_volume(**kwargs)
self.assertIn('id', volume)
self.addCleanup(self._delete_volume, volume['id'])
self.client.wait_for_volume_status(volume['id'], 'available')
@@ -65,7 +65,7 @@
self.assertTrue(volume['id'] is not None,
"Field volume id is empty or not found.")
# Get Volume information
- _, fetched_volume = self.client.get_volume(volume['id'])
+ fetched_volume = self.client.get_volume(volume['id'])
self.assertEqual(v_name,
fetched_volume[self.name_field],
'The fetched Volume name is different '
@@ -90,18 +90,18 @@
# Update Volume
# Test volume update when display_name is same with original value
params = {self.name_field: v_name}
- _, update_volume = self.client.update_volume(volume['id'], **params)
+ self.client.update_volume(volume['id'], **params)
# Test volume update when display_name is new
new_v_name = data_utils.rand_name('new-Volume')
new_desc = 'This is the new description of volume'
params = {self.name_field: new_v_name,
self.descrip_field: new_desc}
- _, update_volume = self.client.update_volume(volume['id'], **params)
+ update_volume = self.client.update_volume(volume['id'], **params)
# Assert response body for update_volume method
self.assertEqual(new_v_name, update_volume[self.name_field])
self.assertEqual(new_desc, update_volume[self.descrip_field])
# Assert response body for get_volume method
- _, updated_volume = self.client.get_volume(volume['id'])
+ updated_volume = self.client.get_volume(volume['id'])
self.assertEqual(volume['id'], updated_volume['id'])
self.assertEqual(new_v_name, updated_volume[self.name_field])
self.assertEqual(new_desc, updated_volume[self.descrip_field])
@@ -116,15 +116,14 @@
new_v_desc = data_utils.rand_name('@#$%^* description')
params = {self.descrip_field: new_v_desc,
'availability_zone': volume['availability_zone']}
- _, new_volume = self.client.create_volume(size=1, **params)
+ new_volume = self.client.create_volume(size=1, **params)
self.assertIn('id', new_volume)
self.addCleanup(self._delete_volume, new_volume['id'])
self.client.wait_for_volume_status(new_volume['id'], 'available')
params = {self.name_field: volume[self.name_field],
self.descrip_field: volume[self.descrip_field]}
- _, update_volume = self.client.update_volume(new_volume['id'],
- **params)
+ self.client.update_volume(new_volume['id'], **params)
# NOTE(jdg): Revert back to strict true/false checking
# after fix for bug #1227837 merges
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index 9c0d238..91beae9 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -66,7 +66,7 @@
cls.metadata = {'Type': 'work'}
for i in range(3):
volume = cls.create_volume(metadata=cls.metadata)
- _, volume = cls.client.get_volume(volume['id'])
+ volume = cls.client.get_volume(volume['id'])
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
@@ -84,10 +84,10 @@
and validates result.
"""
if with_detail:
- _, fetched_vol_list = \
+ fetched_vol_list = \
self.client.list_volumes_with_detail(params=params)
else:
- _, fetched_vol_list = self.client.list_volumes(params=params)
+ fetched_vol_list = self.client.list_volumes(params=params)
# Validating params of fetched volumes
# In v2, only list detail view includes items in params.
@@ -111,7 +111,7 @@
def test_volume_list(self):
# Get a list of Volumes
# Fetch all volumes
- _, fetched_list = self.client.list_volumes()
+ fetched_list = self.client.list_volumes()
self.assertVolumesIn(fetched_list, self.volume_list,
fields=self.VOLUME_FIELDS)
@@ -119,14 +119,14 @@
def test_volume_list_with_details(self):
# Get a list of Volumes with details
# Fetch all Volumes
- _, fetched_list = self.client.list_volumes_with_detail()
+ fetched_list = self.client.list_volumes_with_detail()
self.assertVolumesIn(fetched_list, self.volume_list)
@test.attr(type='gate')
def test_volume_list_by_name(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {self.name: volume[self.name]}
- _, fetched_vol = self.client.list_volumes(params)
+ fetched_vol = self.client.list_volumes(params)
self.assertEqual(1, len(fetched_vol), str(fetched_vol))
self.assertEqual(fetched_vol[0][self.name],
volume[self.name])
@@ -135,7 +135,7 @@
def test_volume_list_details_by_name(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {self.name: volume[self.name]}
- _, fetched_vol = self.client.list_volumes_with_detail(params)
+ fetched_vol = self.client.list_volumes_with_detail(params)
self.assertEqual(1, len(fetched_vol), str(fetched_vol))
self.assertEqual(fetched_vol[0][self.name],
volume[self.name])
@@ -143,7 +143,7 @@
@test.attr(type='gate')
def test_volumes_list_by_status(self):
params = {'status': 'available'}
- _, fetched_list = self.client.list_volumes(params)
+ fetched_list = self.client.list_volumes(params)
self._list_by_param_value_and_assert(params)
self.assertVolumesIn(fetched_list, self.volume_list,
fields=self.VOLUME_FIELDS)
@@ -151,7 +151,7 @@
@test.attr(type='gate')
def test_volumes_list_details_by_status(self):
params = {'status': 'available'}
- _, fetched_list = self.client.list_volumes_with_detail(params)
+ fetched_list = self.client.list_volumes_with_detail(params)
for volume in fetched_list:
self.assertEqual('available', volume['status'])
self.assertVolumesIn(fetched_list, self.volume_list)
@@ -161,7 +161,7 @@
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
zone = volume['availability_zone']
params = {'availability_zone': zone}
- _, fetched_list = self.client.list_volumes(params)
+ fetched_list = self.client.list_volumes(params)
self._list_by_param_value_and_assert(params)
self.assertVolumesIn(fetched_list, self.volume_list,
fields=self.VOLUME_FIELDS)
@@ -171,7 +171,7 @@
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
zone = volume['availability_zone']
params = {'availability_zone': zone}
- _, fetched_list = self.client.list_volumes_with_detail(params)
+ fetched_list = self.client.list_volumes_with_detail(params)
for volume in fetched_list:
self.assertEqual(zone, volume['availability_zone'])
self.assertVolumesIn(fetched_list, self.volume_list)
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 5d3fdef..dc8d8e2 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -224,38 +224,40 @@
@test.attr(type=['negative', 'gate'])
def test_reserve_volume_with_negative_volume_status(self):
# Mark volume as reserved.
- _, body = self.client.reserve_volume(self.volume['id'])
+ self.client.reserve_volume(self.volume['id'])
# Mark volume which is marked as reserved before
self.assertRaises(exceptions.BadRequest,
self.client.reserve_volume,
self.volume['id'])
# Unmark volume as reserved.
- _, body = self.client.unreserve_volume(self.volume['id'])
+ self.client.unreserve_volume(self.volume['id'])
@test.attr(type=['negative', 'gate'])
def test_list_volumes_with_nonexistent_name(self):
v_name = data_utils.rand_name('Volume-')
params = {self.name_field: v_name}
- _, fetched_volume = self.client.list_volumes(params)
+ fetched_volume = self.client.list_volumes(params)
self.assertEqual(0, len(fetched_volume))
@test.attr(type=['negative', 'gate'])
def test_list_volumes_detail_with_nonexistent_name(self):
v_name = data_utils.rand_name('Volume-')
params = {self.name_field: v_name}
- _, fetched_volume = self.client.list_volumes_with_detail(params)
+ fetched_volume = \
+ self.client.list_volumes_with_detail(params)
self.assertEqual(0, len(fetched_volume))
@test.attr(type=['negative', 'gate'])
def test_list_volumes_with_invalid_status(self):
params = {'status': 'null'}
- _, fetched_volume = self.client.list_volumes(params)
+ fetched_volume = self.client.list_volumes(params)
self.assertEqual(0, len(fetched_volume))
@test.attr(type=['negative', 'gate'])
def test_list_volumes_detail_with_invalid_status(self):
params = {'status': 'null'}
- _, fetched_volume = self.client.list_volumes_with_detail(params)
+ fetched_volume = \
+ self.client.list_volumes_with_detail(params)
self.assertEqual(0, len(fetched_volume))
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index b7e9422..179eb09 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -44,11 +44,11 @@
and validates result.
"""
if with_detail:
- _, fetched_snap_list = \
+ fetched_snap_list = \
self.snapshots_client.\
list_snapshots_with_detail(params=params)
else:
- _, fetched_snap_list = \
+ fetched_snap_list = \
self.snapshots_client.list_snapshots(params=params)
# Validating params of fetched snapshots
@@ -94,14 +94,14 @@
snapshot = self.create_snapshot(self.volume_origin['id'], **params)
# Get the snap and check for some of its details
- _, snap_get = self.snapshots_client.get_snapshot(snapshot['id'])
+ snap_get = self.snapshots_client.get_snapshot(snapshot['id'])
self.assertEqual(self.volume_origin['id'],
snap_get['volume_id'],
"Referred volume origin mismatch")
# Compare also with the output from the list action
tracking_data = (snapshot['id'], snapshot[self.name_field])
- _, snaps_list = self.snapshots_client.list_snapshots()
+ snaps_list = self.snapshots_client.list_snapshots()
snaps_data = [(f['id'], f[self.name_field]) for f in snaps_list]
self.assertIn(tracking_data, snaps_data)
@@ -110,13 +110,13 @@
new_desc = 'This is the new description of snapshot.'
params = {self.name_field: new_s_name,
self.descrip_field: new_desc}
- _, update_snapshot = \
+ update_snapshot = \
self.snapshots_client.update_snapshot(snapshot['id'], **params)
# Assert response body for update_snapshot method
self.assertEqual(new_s_name, update_snapshot[self.name_field])
self.assertEqual(new_desc, update_snapshot[self.descrip_field])
# Assert response body for get_snapshot method
- _, updated_snapshot = \
+ updated_snapshot = \
self.snapshots_client.get_snapshot(snapshot['id'])
self.assertEqual(new_s_name, updated_snapshot[self.name_field])
self.assertEqual(new_desc, updated_snapshot[self.descrip_field])
@@ -172,7 +172,7 @@
# create a snap based volume and deletes it
snapshot = self.create_snapshot(self.volume_origin['id'])
# NOTE(gfidente): size is required also when passing snapshot_id
- _, volume = self.volumes_client.create_volume(
+ volume = self.volumes_client.create_volume(
size=1,
snapshot_id=snapshot['id'])
self.volumes_client.wait_for_volume_status(volume['id'], 'available')
diff --git a/tempest/api/volume/v2/test_volumes_list.py b/tempest/api/volume/v2/test_volumes_list.py
index c20f3d8..bc14b2c 100644
--- a/tempest/api/volume/v2/test_volumes_list.py
+++ b/tempest/api/volume/v2/test_volumes_list.py
@@ -41,7 +41,7 @@
cls.metadata = {'Type': 'work'}
for i in range(3):
volume = cls.create_volume(metadata=cls.metadata)
- _, volume = cls.client.get_volume(volume['id'])
+ volume = cls.client.get_volume(volume['id'])
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
@@ -65,7 +65,7 @@
'sort_dir': sort_dir,
'sort_key': sort_key
}
- _, fetched_volume = self.client.list_volumes_with_detail(params)
+ fetched_volume = self.client.list_volumes_with_detail(params)
self.assertEqual(limit, len(fetched_volume),
"The count of volumes is %s, expected:%s " %
(len(fetched_volume), limit))
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index 227fbe6..2928777 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -142,7 +142,7 @@
def list(self):
client = self.client
- __, snaps = client.list_snapshots()
+ snaps = client.list_snapshots()
LOG.debug("List count, %s Snapshots" % len(snaps))
return snaps
@@ -323,7 +323,7 @@
def list(self):
client = self.client
- _, vols = client.list_volumes()
+ vols = client.list_volumes()
LOG.debug("List count, %s Volumes" % len(vols))
return vols
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 001e3dc..6e1ca7a 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -836,7 +836,7 @@
#######################
def _get_volume_by_name(client, name):
- r, body = client.volumes.list_volumes()
+ body = client.volumes.list_volumes()
for volume in body:
if name == volume['display_name']:
return volume
@@ -857,8 +857,8 @@
size = volume['gb']
v_name = volume['name']
- resp, body = client.volumes.create_volume(size=size,
- display_name=v_name)
+ body = client.volumes.create_volume(size=size,
+ display_name=v_name)
client.volumes.wait_for_volume_status(body['id'], 'available')
diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py
index 890c77a..a7e0ee3 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':
+ if service == 'neutron' or service == 'cinder':
resp = extensions_client.list_extensions()
else:
__, resp = extensions_client.list_extensions()
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index 8786a17..c5696b7 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -295,7 +295,7 @@
if len(body.keys()) > 1:
return body
# Just return the "wrapped" element
- first_key, first_item = body.items()[0]
+ first_key, first_item = six.next(six.iteritems(body))
if isinstance(first_item, (dict, list)):
return first_item
except (ValueError, IndexError):
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index b417472..220a7e7 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -210,7 +210,7 @@
imageRef=None, volume_type=None, wait_on_delete=True):
if name is None:
name = data_utils.rand_name(self.__class__.__name__)
- _, volume = self.volumes_client.create_volume(
+ volume = self.volumes_client.create_volume(
size=size, display_name=name, snapshot_id=snapshot_id,
imageRef=imageRef, volume_type=volume_type)
@@ -230,7 +230,7 @@
self.volumes_client.wait_for_volume_status(volume['id'], 'available')
# The volume retrieved on creation has a non-up-to-date status.
# Retrieval after it becomes active ensures correct details.
- _, volume = self.volumes_client.get_volume(volume['id'])
+ volume = self.volumes_client.get_volume(volume['id'])
return volume
def _create_loginable_secgroup_rule(self, secgroup_id=None):
@@ -416,19 +416,19 @@
def nova_volume_attach(self):
# TODO(andreaf) Device should be here CONF.compute.volume_device_name
- _, volume = self.servers_client.attach_volume(
- self.server['id'], self.volume['id'], '/dev/vdb')
+ volume = self.servers_client.attach_volume(
+ self.server['id'], self.volume['id'], '/dev/vdb')[1]
self.assertEqual(self.volume['id'], volume['id'])
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
# Refresh the volume after the attachment
- _, self.volume = self.volumes_client.get_volume(volume['id'])
+ self.volume = self.volumes_client.get_volume(volume['id'])
def nova_volume_detach(self):
self.servers_client.detach_volume(self.server['id'], self.volume['id'])
self.volumes_client.wait_for_volume_status(self.volume['id'],
'available')
- _, volume = self.volumes_client.get_volume(self.volume['id'])
+ volume = self.volumes_client.get_volume(self.volume['id'])
self.assertEqual('available', volume['status'])
def rebuild_server(self, server_id, image=None,
@@ -1216,7 +1216,7 @@
name = 'generic'
randomized_name = data_utils.rand_name('scenario-type-' + name + '-')
LOG.debug("Creating a volume type: %s", randomized_name)
- _, body = client.create_volume_type(
+ body = client.create_volume_type(
randomized_name)
self.assertIn('id', body)
self.addCleanup(client.delete_volume_type, body['id'])
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 16a65c9..5ea48e0 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -68,21 +68,21 @@
self.volume = self.create_volume()
def cinder_list(self):
- _, volumes = self.volumes_client.list_volumes()
+ volumes = self.volumes_client.list_volumes()
self.assertIn(self.volume['id'], [x['id'] for x in volumes])
def cinder_show(self):
- _, volume = self.volumes_client.get_volume(self.volume['id'])
+ volume = self.volumes_client.get_volume(self.volume['id'])
self.assertEqual(self.volume, volume)
def nova_volume_attach(self):
volume_device_path = '/dev/' + CONF.compute.volume_device_name
- _, volume = self.servers_client.attach_volume(
- self.server['id'], self.volume['id'], volume_device_path)
+ volume = self.servers_client.attach_volume(
+ self.server['id'], self.volume['id'], volume_device_path)[1]
self.assertEqual(self.volume['id'], volume['id'])
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
# Refresh the volume after the attachment
- _, self.volume = self.volumes_client.get_volume(volume['id'])
+ self.volume = self.volumes_client.get_volume(volume['id'])
def nova_reboot(self):
self.servers_client.reboot(self.server['id'], 'SOFT')
@@ -98,7 +98,7 @@
self.volumes_client.wait_for_volume_status(self.volume['id'],
'available')
- _, volume = self.volumes_client.get_volume(self.volume['id'])
+ volume = self.volumes_client.get_volume(self.volume['id'])
self.assertEqual('available', volume['status'])
def create_and_add_security_group(self):
diff --git a/tempest/services/volume/json/admin/volume_hosts_client.py b/tempest/services/volume/json/admin/volume_hosts_client.py
index e7add30..cf566f2 100644
--- a/tempest/services/volume/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/json/admin/volume_hosts_client.py
@@ -16,6 +16,7 @@
import json
import urllib
+from tempest.common import service_client
from tempest.services.volume.json import base
@@ -34,7 +35,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['hosts']
+ return service_client.ResponseBodyList(resp, body['hosts'])
class VolumeHostsClientJSON(BaseVolumeHostsClientJSON):
diff --git a/tempest/services/volume/json/admin/volume_quotas_client.py b/tempest/services/volume/json/admin/volume_quotas_client.py
index f08cb64..1a21a2c 100644
--- a/tempest/services/volume/json/admin/volume_quotas_client.py
+++ b/tempest/services/volume/json/admin/volume_quotas_client.py
@@ -16,6 +16,7 @@
import urllib
+from tempest.common import service_client
from tempest.openstack.common import jsonutils
from tempest.services.volume.json import base
@@ -33,7 +34,7 @@
url = 'os-quota-sets/%s/defaults' % tenant_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def get_quota_set(self, tenant_id, params=None):
"""List the quota set for a tenant."""
@@ -44,14 +45,13 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def get_quota_usage(self, tenant_id):
"""List the quota set for a tenant."""
- resp, body = self.get_quota_set(tenant_id, params={'usage': True})
- self.expected_success(200, resp.status)
- return resp, body
+ body = self.get_quota_set(tenant_id, params={'usage': True})
+ return body
def update_quota_set(self, tenant_id, gigabytes=None, volumes=None,
snapshots=None):
@@ -69,7 +69,7 @@
post_body = jsonutils.dumps({'quota_set': post_body})
resp, body = self.put('os-quota-sets/%s' % tenant_id, post_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def delete_quota_set(self, tenant_id):
"""Delete the tenant's quota set."""
diff --git a/tempest/services/volume/json/admin/volume_services_client.py b/tempest/services/volume/json/admin/volume_services_client.py
index 5d4f9db..d258f3d 100644
--- a/tempest/services/volume/json/admin/volume_services_client.py
+++ b/tempest/services/volume/json/admin/volume_services_client.py
@@ -16,6 +16,7 @@
import json
import urllib
+from tempest.common import service_client
from tempest.services.volume.json import base
@@ -29,7 +30,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['services']
+ return service_client.ResponseBodyList(resp, body['services'])
class VolumesServicesClientJSON(BaseVolumesServicesClientJSON):
diff --git a/tempest/services/volume/json/admin/volume_types_client.py b/tempest/services/volume/json/admin/volume_types_client.py
index 171ad35..67f12d6 100644
--- a/tempest/services/volume/json/admin/volume_types_client.py
+++ b/tempest/services/volume/json/admin/volume_types_client.py
@@ -16,6 +16,7 @@
import json
import urllib
+from tempest.common import service_client
from tempest import exceptions
from tempest.services.volume.json import base
@@ -34,8 +35,7 @@
if resource['type'] == "volume-type":
self.get_volume_type(resource['id'])
elif resource['type'] == "encryption-type":
- resp, body = self.get_encryption_type(resource['id'])
- assert 200 == resp.status
+ body = self.get_encryption_type(resource['id'])
if not body:
return True
else:
@@ -59,7 +59,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['volume_types']
+ return service_client.ResponseBodyList(resp, body['volume_types'])
def get_volume_type(self, volume_id):
"""Returns the details of a single volume_type."""
@@ -67,7 +67,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['volume_type']
+ return service_client.ResponseBody(resp, body['volume_type'])
def create_volume_type(self, name, **kwargs):
"""
@@ -85,7 +85,7 @@
resp, body = self.post('types', post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['volume_type']
+ return service_client.ResponseBody(resp, body['volume_type'])
def delete_volume_type(self, volume_id):
"""Deletes the Specified Volume_type."""
@@ -101,7 +101,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['extra_specs']
+ return service_client.ResponseBody(resp, body['extra_specs'])
def get_volume_type_extra_specs(self, vol_type_id, extra_spec_name):
"""Returns the details of a single volume_type extra spec."""
@@ -110,7 +110,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_volume_type_extra_specs(self, vol_type_id, extra_spec):
"""
@@ -123,7 +123,7 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['extra_specs']
+ return service_client.ResponseBody(resp, body['extra_specs'])
def delete_volume_type_extra_specs(self, vol_id, extra_spec_name):
"""Deletes the Specified Volume_type extra spec."""
@@ -146,7 +146,7 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_encryption_type(self, vol_type_id):
"""
@@ -157,7 +157,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_encryption_type(self, vol_type_id, **kwargs):
"""
@@ -176,7 +176,7 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['encryption']
+ return service_client.ResponseBody(resp, body['encryption'])
def delete_encryption_type(self, vol_type_id):
"""Delete the encryption type for the specified volume-type."""
diff --git a/tempest/services/volume/json/availability_zone_client.py b/tempest/services/volume/json/availability_zone_client.py
index 9f2c570..8a0257e 100644
--- a/tempest/services/volume/json/availability_zone_client.py
+++ b/tempest/services/volume/json/availability_zone_client.py
@@ -15,6 +15,7 @@
import json
+from tempest.common import service_client
from tempest.services.volume.json import base
@@ -24,7 +25,7 @@
resp, body = self.get('os-availability-zone')
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['availabilityZoneInfo']
+ return service_client.ResponseBody(resp, body['availabilityZoneInfo'])
class VolumeAvailabilityZoneClientJSON(BaseVolumeAvailabilityZoneClientJSON):
diff --git a/tempest/services/volume/json/backups_client.py b/tempest/services/volume/json/backups_client.py
index e2ba822..102e823 100644
--- a/tempest/services/volume/json/backups_client.py
+++ b/tempest/services/volume/json/backups_client.py
@@ -16,6 +16,7 @@
import json
import time
+from tempest.common import service_client
from tempest import exceptions
from tempest.services.volume.json import base
@@ -39,7 +40,7 @@
resp, body = self.post('backups', post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return resp, body['backup']
+ return service_client.ResponseBody(resp, body['backup'])
def restore_backup(self, backup_id, volume_id=None):
"""Restore volume from backup."""
@@ -48,13 +49,13 @@
resp, body = self.post('backups/%s/restore' % (backup_id), post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return resp, body['restore']
+ return service_client.ResponseBody(resp, body['restore'])
def delete_backup(self, backup_id):
"""Delete a backup of volume."""
resp, body = self.delete('backups/%s' % (str(backup_id)))
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_backup(self, backup_id):
"""Returns the details of a single backup."""
@@ -62,7 +63,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['backup']
+ return service_client.ResponseBody(resp, body['backup'])
def list_backups_with_detail(self):
"""Information for all the tenant's backups."""
@@ -70,17 +71,17 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['backups']
+ return service_client.ResponseBodyList(resp, body['backups'])
def wait_for_backup_status(self, backup_id, status):
"""Waits for a Backup to reach a given status."""
- resp, body = self.get_backup(backup_id)
+ body = self.get_backup(backup_id)
backup_status = body['status']
start = int(time.time())
while backup_status != status:
time.sleep(self.build_interval)
- resp, body = self.get_backup(backup_id)
+ body = self.get_backup(backup_id)
backup_status = body['status']
if backup_status == 'error':
raise exceptions.VolumeBackupException(backup_id=backup_id)
diff --git a/tempest/services/volume/json/extensions_client.py b/tempest/services/volume/json/extensions_client.py
index 13b91c3..ae79dad 100644
--- a/tempest/services/volume/json/extensions_client.py
+++ b/tempest/services/volume/json/extensions_client.py
@@ -15,6 +15,7 @@
import json
+from tempest.common import service_client
from tempest.services.volume.json import base
@@ -25,7 +26,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['extensions']
+ return service_client.ResponseBodyList(resp, body['extensions'])
class ExtensionsClientJSON(BaseExtensionsClientJSON):
diff --git a/tempest/services/volume/json/qos_client.py b/tempest/services/volume/json/qos_client.py
index 9c13cac..f14c8b4 100644
--- a/tempest/services/volume/json/qos_client.py
+++ b/tempest/services/volume/json/qos_client.py
@@ -15,6 +15,7 @@
import json
import time
+from tempest.common import service_client
from tempest import exceptions
from tempest.services.volume.json import base
@@ -46,18 +47,15 @@
start_time = int(time.time())
while True:
if operation == 'qos-key-unset':
- resp, body = self.get_qos(qos_id)
- self.expected_success(200, resp.status)
+ body = self.get_qos(qos_id)
if not any(key in body['specs'] for key in args):
return
elif operation == 'disassociate':
- resp, body = self.get_association_qos(qos_id)
- self.expected_success(200, resp.status)
+ body = self.get_association_qos(qos_id)
if not any(args in body[i]['id'] for i in range(0, len(body))):
return
elif operation == 'disassociate-all':
- resp, body = self.get_association_qos(qos_id)
- self.expected_success(200, resp.status)
+ body = self.get_association_qos(qos_id)
if not body:
return
else:
@@ -80,7 +78,7 @@
resp, body = self.post('qos-specs', post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['qos_specs']
+ return service_client.ResponseBody(resp, body['qos_specs'])
def delete_qos(self, qos_id, force=False):
"""Delete the specified QoS specification."""
@@ -94,7 +92,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['qos_specs']
+ return service_client.ResponseBodyList(resp, body['qos_specs'])
def get_qos(self, qos_id):
"""Get the specified QoS specification."""
@@ -102,7 +100,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['qos_specs']
+ return service_client.ResponseBody(resp, body['qos_specs'])
def set_qos_key(self, qos_id, **kwargs):
"""Set the specified keys/values of QoS specification.
@@ -113,7 +111,7 @@
resp, body = self.put('qos-specs/%s' % qos_id, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['qos_specs']
+ return service_client.ResponseBody(resp, body['qos_specs'])
def unset_qos_key(self, qos_id, keys):
"""Unset the specified keys of QoS specification.
@@ -137,7 +135,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['qos_associations']
+ return service_client.ResponseBodyList(resp, body['qos_associations'])
def disassociate_qos(self, qos_id, vol_type_id):
"""Disassociate the specified QoS with specified volume-type."""
diff --git a/tempest/services/volume/json/snapshots_client.py b/tempest/services/volume/json/snapshots_client.py
index 349d1b0..a27370d 100644
--- a/tempest/services/volume/json/snapshots_client.py
+++ b/tempest/services/volume/json/snapshots_client.py
@@ -14,6 +14,7 @@
import time
import urllib
+from tempest.common import service_client
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.services.volume.json import base
@@ -36,7 +37,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['snapshots']
+ return service_client.ResponseBodyList(resp, body['snapshots'])
def list_snapshots_with_detail(self, params=None):
"""List the details of all snapshots."""
@@ -47,7 +48,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['snapshots']
+ return service_client.ResponseBodyList(resp, body['snapshots'])
def get_snapshot(self, snapshot_id):
"""Returns the details of a single snapshot."""
@@ -55,7 +56,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['snapshot']
+ return service_client.ResponseBody(resp, body['snapshot'])
def create_snapshot(self, volume_id, **kwargs):
"""
@@ -71,7 +72,7 @@
resp, body = self.post('snapshots', post_body)
body = json.loads(body)
self.expected_success(self.create_resp, resp.status)
- return resp, body['snapshot']
+ return service_client.ResponseBody(resp, body['snapshot'])
def update_snapshot(self, snapshot_id, **kwargs):
"""Updates a snapshot."""
@@ -79,11 +80,11 @@
resp, body = self.put('snapshots/%s' % snapshot_id, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['snapshot']
+ return service_client.ResponseBody(resp, body['snapshot'])
# NOTE(afazekas): just for the wait function
def _get_snapshot_status(self, snapshot_id):
- resp, body = self.get_snapshot(snapshot_id)
+ body = self.get_snapshot(snapshot_id)
status = body['status']
# NOTE(afazekas): snapshot can reach an "error"
# state in a "normal" lifecycle
@@ -140,7 +141,7 @@
post_body = json.dumps({'os-reset_status': {"status": status}})
resp, body = self.post('snapshots/%s/action' % snapshot_id, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def update_snapshot_status(self, snapshot_id, status, progress):
"""Update the specified snapshot's status."""
@@ -152,7 +153,7 @@
url = 'snapshots/%s/action' % str(snapshot_id)
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_snapshot_metadata(self, snapshot_id, metadata):
"""Create metadata for the snapshot."""
@@ -161,7 +162,7 @@
resp, body = self.post(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def get_snapshot_metadata(self, snapshot_id):
"""Get metadata of the snapshot."""
@@ -169,7 +170,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def update_snapshot_metadata(self, snapshot_id, metadata):
"""Update metadata for the snapshot."""
@@ -178,7 +179,7 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def update_snapshot_metadata_item(self, snapshot_id, id, meta_item):
"""Update metadata item for the snapshot."""
@@ -187,7 +188,7 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['meta']
+ return service_client.ResponseBody(resp, body['meta'])
def delete_snapshot_metadata_item(self, snapshot_id, id):
"""Delete metadata item for the snapshot."""
@@ -200,7 +201,7 @@
post_body = json.dumps({'os-force_delete': {}})
resp, body = self.post('snapshots/%s/action' % snapshot_id, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
class SnapshotsClientJSON(BaseSnapshotsClientJSON):
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index f19718e..b12852f 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -17,6 +17,7 @@
import time
import urllib
+from tempest.common import service_client
from tempest import config
from tempest import exceptions
from tempest.services.volume.json import base
@@ -44,7 +45,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['volumes']
+ return service_client.ResponseBodyList(resp, body['volumes'])
def list_volumes_with_detail(self, params=None):
"""List the details of all volumes."""
@@ -55,7 +56,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['volumes']
+ return service_client.ResponseBodyList(resp, body['volumes'])
def get_volume(self, volume_id):
"""Returns the details of a single volume."""
@@ -63,7 +64,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['volume']
+ return service_client.ResponseBody(resp, body['volume'])
def create_volume(self, size=None, **kwargs):
"""
@@ -87,7 +88,7 @@
resp, body = self.post('volumes', post_body)
body = json.loads(body)
self.expected_success(self.create_resp, resp.status)
- return resp, body['volume']
+ return service_client.ResponseBody(resp, body['volume'])
def update_volume(self, volume_id, **kwargs):
"""Updates the Specified Volume."""
@@ -95,7 +96,7 @@
resp, body = self.put('volumes/%s' % volume_id, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['volume']
+ return service_client.ResponseBody(resp, body['volume'])
def delete_volume(self, volume_id):
"""Deletes the Specified Volume."""
@@ -113,7 +114,8 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return resp, body['os-volume_upload_image']
+ return service_client.ResponseBody(resp,
+ body['os-volume_upload_image'])
def attach_volume(self, volume_id, instance_uuid, mountpoint):
"""Attaches a volume to a given instance on a given mountpoint."""
@@ -125,7 +127,7 @@
url = 'volumes/%s/action' % (volume_id)
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def detach_volume(self, volume_id):
"""Detaches a volume from an instance."""
@@ -134,7 +136,7 @@
url = 'volumes/%s/action' % (volume_id)
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def reserve_volume(self, volume_id):
"""Reserves a volume."""
@@ -143,7 +145,7 @@
url = 'volumes/%s/action' % (volume_id)
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def unreserve_volume(self, volume_id):
"""Restore a reserved volume ."""
@@ -152,17 +154,17 @@
url = 'volumes/%s/action' % (volume_id)
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def wait_for_volume_status(self, volume_id, status):
"""Waits for a Volume to reach a given status."""
- resp, body = self.get_volume(volume_id)
+ body = self.get_volume(volume_id)
volume_status = body['status']
start = int(time.time())
while volume_status != status:
time.sleep(self.build_interval)
- resp, body = self.get_volume(volume_id)
+ body = self.get_volume(volume_id)
volume_status = body['status']
if volume_status == 'error':
raise exceptions.VolumeBuildErrorException(volume_id=volume_id)
@@ -197,14 +199,14 @@
url = 'volumes/%s/action' % (volume_id)
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def reset_volume_status(self, volume_id, status):
"""Reset the Specified Volume's Status."""
post_body = json.dumps({'os-reset_status': {"status": status}})
resp, body = self.post('volumes/%s/action' % volume_id, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def volume_begin_detaching(self, volume_id):
"""Volume Begin Detaching."""
@@ -212,7 +214,7 @@
post_body = json.dumps({'os-begin_detaching': {}})
resp, body = self.post('volumes/%s/action' % volume_id, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def volume_roll_detaching(self, volume_id):
"""Volume Roll Detaching."""
@@ -220,7 +222,7 @@
post_body = json.dumps({'os-roll_detaching': {}})
resp, body = self.post('volumes/%s/action' % volume_id, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_volume_transfer(self, vol_id, display_name=None):
"""Create a volume transfer."""
@@ -233,7 +235,7 @@
resp, body = self.post('os-volume-transfer', post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return resp, body['transfer']
+ return service_client.ResponseBody(resp, body['transfer'])
def get_volume_transfer(self, transfer_id):
"""Returns the details of a volume transfer."""
@@ -241,7 +243,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['transfer']
+ return service_client.ResponseBody(resp, body['transfer'])
def list_volume_transfers(self, params=None):
"""List all the volume transfers created."""
@@ -251,7 +253,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['transfers']
+ return service_client.ResponseBodyList(resp, body['transfers'])
def delete_volume_transfer(self, transfer_id):
"""Delete a volume transfer."""
@@ -268,7 +270,7 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return resp, body['transfer']
+ return service_client.ResponseBody(resp, body['transfer'])
def update_volume_readonly(self, volume_id, readonly):
"""Update the Specified Volume readonly."""
@@ -279,14 +281,14 @@
url = 'volumes/%s/action' % (volume_id)
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def force_delete_volume(self, volume_id):
"""Force Delete Volume."""
post_body = json.dumps({'os-force_delete': {}})
resp, body = self.post('volumes/%s/action' % volume_id, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_volume_metadata(self, volume_id, metadata):
"""Create metadata for the volume."""
@@ -295,7 +297,7 @@
resp, body = self.post(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def get_volume_metadata(self, volume_id):
"""Get metadata of the volume."""
@@ -303,7 +305,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def update_volume_metadata(self, volume_id, metadata):
"""Update metadata for the volume."""
@@ -312,7 +314,7 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def update_volume_metadata_item(self, volume_id, id, meta_item):
"""Update metadata item for the volume."""
@@ -321,7 +323,7 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['meta']
+ return service_client.ResponseBody(resp, body['meta'])
def delete_volume_metadata_item(self, volume_id, id):
"""Delete metadata item for the volume."""
diff --git a/tempest/tests/cmd/test_verify_tempest_config.py b/tempest/tests/cmd/test_verify_tempest_config.py
index a8adc7e..1abe29a 100644
--- a/tempest/tests/cmd/test_verify_tempest_config.py
+++ b/tempest/tests/cmd/test_verify_tempest_config.py
@@ -243,9 +243,9 @@
def test_verify_extensions_cinder(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.volumes_extension_client.list_extensions = fake_list_extensions
self.useFixture(mockpatch.PatchObject(
@@ -265,9 +265,9 @@
def test_verify_extensions_cinder_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.volumes_extension_client.list_extensions = fake_list_extensions
self.useFixture(mockpatch.PatchObject(
diff --git a/tempest/tests/fake_auth_provider.py b/tempest/tests/fake_auth_provider.py
index 44c331e..bc68d26 100644
--- a/tempest/tests/fake_auth_provider.py
+++ b/tempest/tests/fake_auth_provider.py
@@ -13,16 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.tests import fake_credentials
-
-
-def get_default_credentials(credential_type, fill_in=True):
- return fake_credentials.FakeCredentials()
-
-
-def get_credentials(credential_type=None, fill_in=True, **kwargs):
- return fake_credentials.FakeCredentials()
-
class FakeAuthProvider(object):
diff --git a/tempest/tests/test_auth.py b/tempest/tests/test_auth.py
index fc05198..a191781 100644
--- a/tempest/tests/test_auth.py
+++ b/tempest/tests/test_auth.py
@@ -24,13 +24,20 @@
from tempest.services.identity.json import identity_client as v2_client
from tempest.services.identity.v3.json import identity_client as v3_client
from tempest.tests import base
-from tempest.tests import fake_auth_provider
from tempest.tests import fake_config
from tempest.tests import fake_credentials
from tempest.tests import fake_http
from tempest.tests import fake_identity
+def fake_get_default_credentials(credential_type, fill_in=True):
+ return fake_credentials.FakeCredentials()
+
+
+def fake_get_credentials(credential_type=None, fill_in=True, **kwargs):
+ return fake_credentials.FakeCredentials()
+
+
class BaseAuthTestsSetUp(base.TestCase):
_auth_provider_class = None
credentials = fake_credentials.FakeCredentials()
@@ -46,10 +53,9 @@
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
- self.stubs.Set(auth, 'get_credentials',
- fake_auth_provider.get_credentials)
+ self.stubs.Set(auth, 'get_credentials', fake_get_credentials)
self.stubs.Set(auth, 'get_default_credentials',
- fake_auth_provider.get_default_credentials)
+ fake_get_default_credentials)
self.auth_provider = self._auth(self.credentials)
diff --git a/tempest/tests/test_rest_client.py b/tempest/tests/test_rest_client.py
index e42fab7..6a95a80 100644
--- a/tempest/tests/test_rest_client.py
+++ b/tempest/tests/test_rest_client.py
@@ -16,13 +16,12 @@
import httplib2
from oslotest import mockpatch
+import six
from tempest.common import rest_client
-from tempest import config
from tempest import exceptions
from tempest.tests import base
from tempest.tests import fake_auth_provider
-from tempest.tests import fake_config
from tempest.tests import fake_http
@@ -32,8 +31,6 @@
def setUp(self):
super(BaseRestClientTestClass, self).setUp()
- self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.rest_client = rest_client.RestClient(
fake_auth_provider.FakeAuthProvider(), None, None)
self.stubs.Set(httplib2.Http, 'request', self.fake_http.request)
@@ -94,7 +91,7 @@
def _verify_headers(self, resp):
self.assertEqual(self.rest_client._get_type(), self.TYPE)
- resp = dict((k.lower(), v) for k, v in resp.iteritems())
+ resp = dict((k.lower(), v) for k, v in six.iteritems(resp))
self.assertEqual(self.header_value, resp['accept'])
self.assertEqual(self.header_value, resp['content-type'])
@@ -296,8 +293,6 @@
def setUp(self):
super(TestRestClientErrorCheckerJSON, self).setUp()
- self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.rest_client = rest_client.RestClient(
fake_auth_provider.FakeAuthProvider(), None, None)