Merge "Adds scenario for DNS-nameserver configuration"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index b1b1f07..02609ae 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -135,6 +135,9 @@
# concurrent test processes. (boolean value)
#locking_credentials_provider = false
+# Roles to assign to all users created by tempest (list value)
+#tempest_roles =
+
[baremetal]
@@ -278,8 +281,8 @@
#build_interval = 1
# Timeout in seconds to wait for an instance to build. Other services
-# that do not define build_timeout will inherit this value, for
-# example the image service. (integer value)
+# that do not define build_timeout will inherit this value. (integer
+# value)
#build_timeout = 300
# Should the tests ssh to instances? (boolean value)
@@ -620,6 +623,14 @@
# http accessible image (string value)
#http_image = http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz
+# Timeout in seconds to wait for an image to become available.
+# (integer value)
+#build_timeout = 300
+
+# Time in seconds between image operation status checks. (integer
+# value)
+#build_interval = 1
+
[image-feature-enabled]
diff --git a/requirements.txt b/requirements.txt
index a6e7dd1..2af8586 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,7 +6,7 @@
httplib2>=0.7.5
jsonschema>=2.0.0,<3.0.0
testtools>=0.9.36,!=1.2.0
-boto>=2.32.1
+boto>=2.32.1,<2.35.0
paramiko>=1.13.0
netaddr>=0.7.12
python-ceilometerclient>=1.0.6
@@ -20,7 +20,7 @@
python-saharaclient>=0.7.6
python-swiftclient>=2.2.0
testrepository>=0.0.18
-oslo.config>=1.4.0 # Apache-2.0
+oslo.config>=1.6.0 # Apache-2.0
six>=1.7.0
iso8601>=0.1.9
fixtures>=0.3.14
diff --git a/tempest/api/compute/admin/test_quotas.py b/tempest/api/compute/admin/test_quotas.py
index 7c666a2..fc70fdb 100644
--- a/tempest/api/compute/admin/test_quotas.py
+++ b/tempest/api/compute/admin/test_quotas.py
@@ -99,8 +99,8 @@
tenant_name = data_utils.rand_name('cpu_quota_tenant_')
tenant_desc = tenant_name + '-desc'
identity_client = self.os_adm.identity_client
- _, tenant = identity_client.create_tenant(name=tenant_name,
- description=tenant_desc)
+ tenant = identity_client.create_tenant(name=tenant_name,
+ description=tenant_desc)
tenant_id = tenant['id']
self.addCleanup(identity_client.delete_tenant, tenant_id)
@@ -113,10 +113,10 @@
user_name = data_utils.rand_name('cpu_quota_user_')
password = data_utils.rand_name('password-')
email = user_name + '@testmail.tm'
- _, user = identity_client.create_user(name=user_name,
- password=password,
- tenant_id=tenant_id,
- email=email)
+ user = identity_client.create_user(name=user_name,
+ password=password,
+ tenant_id=tenant_id,
+ email=email)
user_id = user['id']
self.addCleanup(identity_client.delete_user, user_id)
@@ -134,8 +134,8 @@
tenant_name = data_utils.rand_name('ram_quota_tenant_')
tenant_desc = tenant_name + '-desc'
identity_client = self.os_adm.identity_client
- _, tenant = identity_client.create_tenant(name=tenant_name,
- description=tenant_desc)
+ tenant = identity_client.create_tenant(name=tenant_name,
+ description=tenant_desc)
tenant_id = tenant['id']
self.addCleanup(identity_client.delete_tenant, tenant_id)
resp, quota_set_default = self.adm_client.get_quota_set(tenant_id)
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/floating_ips/test_floating_ips_actions.py b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
index db382eb..19f5fba 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
@@ -96,6 +96,11 @@
self.floating_ip,
self.server_id)
self.assertEqual(202, resp.status)
+
+ # Check instance_id in the floating_ip body
+ resp, body = self.client.get_floating_ip_details(self.floating_ip_id)
+ self.assertEqual(self.server_id, body['instance_id'])
+
# Disassociation of floating IP that was associated in this method
resp, body = self.client.disassociate_floating_ip_from_server(
self.floating_ip,
diff --git a/tempest/api/compute/images/test_image_metadata.py b/tempest/api/compute/images/test_image_metadata.py
index 5105e2f..38e55b1 100644
--- a/tempest/api/compute/images/test_image_metadata.py
+++ b/tempest/api/compute/images/test_image_metadata.py
@@ -37,10 +37,10 @@
cls.image_id = None
name = data_utils.rand_name('image')
- resp, body = cls.glance_client.create_image(name=name,
- container_format='bare',
- disk_format='raw',
- is_public=False)
+ body = cls.glance_client.create_image(name=name,
+ container_format='bare',
+ disk_format='raw',
+ is_public=False)
cls.image_id = body['id']
cls.images.append(cls.image_id)
image_file = StringIO.StringIO(('*' * 1024))
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index ceab4f9..d9a7201 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -42,10 +42,10 @@
def _create_image():
name = data_utils.rand_name('image')
- _, body = cls.glance_client.create_image(name=name,
- container_format='bare',
- disk_format='raw',
- is_public=False)
+ body = cls.glance_client.create_image(name=name,
+ container_format='bare',
+ disk_format='raw',
+ is_public=False)
image_id = body['id']
cls.images.append(image_id)
# Wait 1 second between creation and upload to ensure a delta
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 28deaa7..76c858b 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -290,12 +290,11 @@
'backup_type': "daily",
'instance_uuid': self.server_id,
}
- resp, image_list = self.os.image_client.image_list_detail(
+ image_list = self.os.image_client.image_list_detail(
properties,
status='active',
sort_key='created_at',
sort_dir='asc')
- self.assertEqual(200, resp.status)
self.assertEqual(2, len(image_list))
self.assertEqual((backup1, backup2),
(image_list[0]['name'], image_list[1]['name']))
@@ -315,12 +314,11 @@
self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
self.os.image_client.wait_for_resource_deletion(image1_id)
oldest_backup_exist = False
- resp, image_list = self.os.image_client.image_list_detail(
+ image_list = self.os.image_client.image_list_detail(
properties,
status='active',
sort_key='created_at',
sort_dir='asc')
- self.assertEqual(200, resp.status)
self.assertEqual(2, len(image_list),
'Unexpected number of images for '
'v2:test_create_backup; was the oldest backup not '
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index 1f4f124..3dd6e34 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -57,13 +57,13 @@
resp, cls.server = cls.client.get_server(server['id'])
name = data_utils.rand_name('image')
- resp, body = cls.glance_client.create_image(name=name,
- container_format='bare',
- disk_format='raw',
- is_public=False)
+ body = cls.glance_client.create_image(name=name,
+ container_format='bare',
+ disk_format='raw',
+ is_public=False)
image_id = body['id']
image_file = StringIO.StringIO(('*' * 1024))
- resp, body = cls.glance_client.update_image(image_id, data=image_file)
+ body = cls.glance_client.update_image(image_id, data=image_file)
cls.glance_client.wait_for_image_status(image_id, 'active')
resp, cls.image = cls.images_client.get_image(image_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/identity/admin/test_roles.py b/tempest/api/identity/admin/test_roles.py
index fabc0ed..c6c7dc3 100644
--- a/tempest/api/identity/admin/test_roles.py
+++ b/tempest/api/identity/admin/test_roles.py
@@ -28,7 +28,7 @@
super(RolesTestJSON, cls).resource_setup()
for _ in moves.xrange(5):
role_name = data_utils.rand_name(name='role-')
- _, role = cls.client.create_role(role_name)
+ role = cls.client.create_role(role_name)
cls.data.roles.append(role)
def _get_role_params(self):
@@ -49,7 +49,7 @@
@test.attr(type='gate')
def test_list_roles(self):
"""Return a list of all roles."""
- _, body = self.client.list_roles()
+ body = self.client.list_roles()
found = [role for role in body if role in self.data.roles]
self.assertTrue(any(found))
self.assertEqual(len(found), len(self.data.roles))
@@ -58,16 +58,16 @@
def test_role_create_delete(self):
"""Role should be created, verified, and deleted."""
role_name = data_utils.rand_name(name='role-test-')
- _, body = self.client.create_role(role_name)
+ body = self.client.create_role(role_name)
self.assertEqual(role_name, body['name'])
- _, body = self.client.list_roles()
+ body = self.client.list_roles()
found = [role for role in body if role['name'] == role_name]
self.assertTrue(any(found))
- _, body = self.client.delete_role(found[0]['id'])
+ body = self.client.delete_role(found[0]['id'])
- _, body = self.client.list_roles()
+ body = self.client.list_roles()
found = [role for role in body if role['name'] == role_name]
self.assertFalse(any(found))
@@ -77,7 +77,7 @@
self.data.setup_test_role()
role_id = self.data.role['id']
role_name = self.data.role['name']
- _, body = self.client.get_role(role_id)
+ body = self.client.get_role(role_id)
self.assertEqual(role_id, body['id'])
self.assertEqual(role_name, body['name'])
@@ -86,15 +86,15 @@
"""Assign a role to a user on a tenant."""
(user, tenant, role) = self._get_role_params()
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
- _, roles = self.client.list_user_roles(tenant['id'], user['id'])
+ roles = self.client.list_user_roles(tenant['id'], user['id'])
self.assert_role_in_role_list(role, roles)
@test.attr(type='gate')
def test_remove_user_role(self):
"""Remove a role assigned to a user on a tenant."""
(user, tenant, role) = self._get_role_params()
- _, user_role = self.client.assign_user_role(tenant['id'],
- user['id'], role['id'])
+ user_role = self.client.assign_user_role(tenant['id'],
+ user['id'], role['id'])
self.client.remove_user_role(tenant['id'], user['id'],
user_role['id'])
@@ -103,5 +103,5 @@
"""List roles assigned to a user on tenant."""
(user, tenant, role) = self._get_role_params()
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
- _, roles = self.client.list_user_roles(tenant['id'], user['id'])
+ roles = self.client.list_user_roles(tenant['id'], user['id'])
self.assert_role_in_role_list(role, roles)
diff --git a/tempest/api/identity/admin/test_roles_negative.py b/tempest/api/identity/admin/test_roles_negative.py
index d0eb334..58f726a 100644
--- a/tempest/api/identity/admin/test_roles_negative.py
+++ b/tempest/api/identity/admin/test_roles_negative.py
@@ -72,7 +72,7 @@
def test_role_create_duplicate(self):
# Role names should be unique
role_name = data_utils.rand_name(name='role-dup-')
- _, body = self.client.create_role(role_name)
+ body = self.client.create_role(role_name)
role1_id = body.get('id')
self.addCleanup(self.client.delete_role, role1_id)
self.assertRaises(exceptions.Conflict, self.client.create_role,
@@ -82,7 +82,7 @@
def test_delete_role_by_unauthorized_user(self):
# Non-administrator user should not be able to delete role
role_name = data_utils.rand_name(name='role-')
- _, body = self.client.create_role(role_name)
+ body = self.client.create_role(role_name)
self.data.roles.append(body)
role_id = body.get('id')
self.assertRaises(exceptions.Unauthorized,
@@ -92,7 +92,7 @@
def test_delete_role_request_without_token(self):
# Request to delete role without a valid token should fail
role_name = data_utils.rand_name(name='role-')
- _, body = self.client.create_role(role_name)
+ body = self.client.create_role(role_name)
self.data.roles.append(body)
role_id = body.get('id')
token = self.client.auth_provider.get_token()
@@ -158,9 +158,9 @@
# Non-administrator user should not be authorized to
# remove a user's role
(user, tenant, role) = self._get_role_params()
- resp, user_role = self.client.assign_user_role(tenant['id'],
- user['id'],
- role['id'])
+ self.client.assign_user_role(tenant['id'],
+ user['id'],
+ role['id'])
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.remove_user_role,
tenant['id'], user['id'], role['id'])
@@ -169,9 +169,9 @@
def test_remove_user_role_request_without_token(self):
# Request to remove a user's role without a valid token
(user, tenant, role) = self._get_role_params()
- resp, user_role = self.client.assign_user_role(tenant['id'],
- user['id'],
- role['id'])
+ self.client.assign_user_role(tenant['id'],
+ user['id'],
+ role['id'])
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
self.assertRaises(exceptions.Unauthorized,
@@ -183,9 +183,9 @@
def test_remove_user_role_non_existent_role(self):
# Attempt to delete a non existent role from a user should fail
(user, tenant, role) = self._get_role_params()
- resp, user_role = self.client.assign_user_role(tenant['id'],
- user['id'],
- role['id'])
+ self.client.assign_user_role(tenant['id'],
+ user['id'],
+ role['id'])
non_existent_role = str(uuid.uuid4().hex)
self.assertRaises(exceptions.NotFound, self.client.remove_user_role,
tenant['id'], user['id'], non_existent_role)
@@ -194,9 +194,9 @@
def test_remove_user_role_non_existent_tenant(self):
# Attempt to remove a role from a non existent tenant should fail
(user, tenant, role) = self._get_role_params()
- resp, user_role = self.client.assign_user_role(tenant['id'],
- user['id'],
- role['id'])
+ self.client.assign_user_role(tenant['id'],
+ user['id'],
+ role['id'])
non_existent_tenant = str(uuid.uuid4().hex)
self.assertRaises(exceptions.NotFound, self.client.remove_user_role,
non_existent_tenant, user['id'], role['id'])
diff --git a/tempest/api/identity/admin/test_services.py b/tempest/api/identity/admin/test_services.py
index b8f09ad..03d6e35 100644
--- a/tempest/api/identity/admin/test_services.py
+++ b/tempest/api/identity/admin/test_services.py
@@ -38,7 +38,7 @@
name = data_utils.rand_name('service-')
type = data_utils.rand_name('type--')
description = data_utils.rand_name('description-')
- _, service_data = self.client.create_service(
+ service_data = self.client.create_service(
name, type, description=description)
self.assertFalse(service_data['id'] is None)
self.addCleanup(self._del_service, service_data['id'])
@@ -51,7 +51,7 @@
self.assertIn('description', service_data)
self.assertEqual(description, service_data['description'])
# Get service
- _, fetched_service = self.client.get_service(service_data['id'])
+ fetched_service = self.client.get_service(service_data['id'])
# verifying the existence of service created
self.assertIn('id', fetched_service)
self.assertEqual(fetched_service['id'], service_data['id'])
@@ -68,7 +68,7 @@
# Create a service only with name and type
name = data_utils.rand_name('service-')
type = data_utils.rand_name('type--')
- _, service = self.client.create_service(name, type)
+ service = self.client.create_service(name, type)
self.assertIn('id', service)
self.addCleanup(self._del_service, service['id'])
self.assertIn('name', service)
@@ -84,7 +84,7 @@
name = data_utils.rand_name('service-')
type = data_utils.rand_name('type--')
description = data_utils.rand_name('description-')
- _, service = self.client.create_service(
+ service = self.client.create_service(
name, type, description=description)
services.append(service)
service_ids = map(lambda x: x['id'], services)
@@ -95,6 +95,6 @@
self.addCleanup(delete_services)
# List and Verify Services
- _, body = self.client.list_services()
+ body = self.client.list_services()
found = [serv for serv in body if serv['id'] in service_ids]
self.assertEqual(len(found), len(services), 'Services not found')
diff --git a/tempest/api/identity/admin/test_tenant_negative.py b/tempest/api/identity/admin/test_tenant_negative.py
index 57a2fec..75f0152 100644
--- a/tempest/api/identity/admin/test_tenant_negative.py
+++ b/tempest/api/identity/admin/test_tenant_negative.py
@@ -42,7 +42,7 @@
def test_tenant_delete_by_unauthorized_user(self):
# Non-administrator user should not be able to delete a tenant
tenant_name = data_utils.rand_name(name='tenant-')
- _, tenant = self.client.create_tenant(tenant_name)
+ tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.delete_tenant, tenant['id'])
@@ -51,7 +51,7 @@
def test_tenant_delete_request_without_token(self):
# Request to delete a tenant without a valid token should fail
tenant_name = data_utils.rand_name(name='tenant-')
- _, tenant = self.client.create_tenant(tenant_name)
+ tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
@@ -69,7 +69,7 @@
def test_tenant_create_duplicate(self):
# Tenant names should be unique
tenant_name = data_utils.rand_name(name='tenant-')
- _, body = self.client.create_tenant(tenant_name)
+ body = self.client.create_tenant(tenant_name)
tenant = body
self.data.tenants.append(tenant)
tenant1_id = body.get('id')
@@ -119,7 +119,7 @@
def test_tenant_update_by_unauthorized_user(self):
# Non-administrator user should not be able to update a tenant
tenant_name = data_utils.rand_name(name='tenant-')
- _, tenant = self.client.create_tenant(tenant_name)
+ tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.update_tenant, tenant['id'])
@@ -128,7 +128,7 @@
def test_tenant_update_request_without_token(self):
# Request to update a tenant without a valid token should fail
tenant_name = data_utils.rand_name(name='tenant-')
- _, tenant = self.client.create_tenant(tenant_name)
+ tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
diff --git a/tempest/api/identity/admin/test_tenants.py b/tempest/api/identity/admin/test_tenants.py
index 778bd5c..549e952 100644
--- a/tempest/api/identity/admin/test_tenants.py
+++ b/tempest/api/identity/admin/test_tenants.py
@@ -29,11 +29,11 @@
tenants = []
for _ in moves.xrange(3):
tenant_name = data_utils.rand_name(name='tenant-new')
- _, tenant = self.client.create_tenant(tenant_name)
+ tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
tenants.append(tenant)
tenant_ids = map(lambda x: x['id'], tenants)
- _, body = self.client.list_tenants()
+ body = self.client.list_tenants()
found = [t for t in body if t['id'] in tenant_ids]
self.assertEqual(len(found), len(tenants), 'Tenants not created')
@@ -41,7 +41,7 @@
self.client.delete_tenant(tenant['id'])
self.data.tenants.remove(tenant)
- _, body = self.client.list_tenants()
+ body = self.client.list_tenants()
found = [tenant for tenant in body if tenant['id'] in tenant_ids]
self.assertFalse(any(found), 'Tenants failed to delete')
@@ -50,15 +50,15 @@
# Create tenant with a description
tenant_name = data_utils.rand_name(name='tenant-')
tenant_desc = data_utils.rand_name(name='desc-')
- _, body = self.client.create_tenant(tenant_name,
- description=tenant_desc)
+ body = self.client.create_tenant(tenant_name,
+ description=tenant_desc)
tenant = body
self.data.tenants.append(tenant)
tenant_id = body['id']
desc1 = body['description']
self.assertEqual(desc1, tenant_desc, 'Description should have '
'been sent in response for create')
- _, body = self.client.get_tenant(tenant_id)
+ body = self.client.get_tenant(tenant_id)
desc2 = body['description']
self.assertEqual(desc2, tenant_desc, 'Description does not appear'
'to be set')
@@ -69,13 +69,13 @@
def test_tenant_create_enabled(self):
# Create a tenant that is enabled
tenant_name = data_utils.rand_name(name='tenant-')
- _, body = self.client.create_tenant(tenant_name, enabled=True)
+ body = self.client.create_tenant(tenant_name, enabled=True)
tenant = body
self.data.tenants.append(tenant)
tenant_id = body['id']
en1 = body['enabled']
self.assertTrue(en1, 'Enable should be True in response')
- _, body = self.client.get_tenant(tenant_id)
+ body = self.client.get_tenant(tenant_id)
en2 = body['enabled']
self.assertTrue(en2, 'Enable should be True in lookup')
self.client.delete_tenant(tenant_id)
@@ -85,14 +85,14 @@
def test_tenant_create_not_enabled(self):
# Create a tenant that is not enabled
tenant_name = data_utils.rand_name(name='tenant-')
- _, body = self.client.create_tenant(tenant_name, enabled=False)
+ body = self.client.create_tenant(tenant_name, enabled=False)
tenant = body
self.data.tenants.append(tenant)
tenant_id = body['id']
en1 = body['enabled']
self.assertEqual('false', str(en1).lower(),
'Enable should be False in response')
- _, body = self.client.get_tenant(tenant_id)
+ body = self.client.get_tenant(tenant_id)
en2 = body['enabled']
self.assertEqual('false', str(en2).lower(),
'Enable should be False in lookup')
@@ -103,7 +103,7 @@
def test_tenant_update_name(self):
# Update name attribute of a tenant
t_name1 = data_utils.rand_name(name='tenant-')
- _, body = self.client.create_tenant(t_name1)
+ body = self.client.create_tenant(t_name1)
tenant = body
self.data.tenants.append(tenant)
@@ -111,11 +111,11 @@
resp1_name = body['name']
t_name2 = data_utils.rand_name(name='tenant2-')
- _, body = self.client.update_tenant(t_id, name=t_name2)
+ body = self.client.update_tenant(t_id, name=t_name2)
resp2_name = body['name']
self.assertNotEqual(resp1_name, resp2_name)
- _, body = self.client.get_tenant(t_id)
+ body = self.client.get_tenant(t_id)
resp3_name = body['name']
self.assertNotEqual(resp1_name, resp3_name)
@@ -130,7 +130,7 @@
# Update description attribute of a tenant
t_name = data_utils.rand_name(name='tenant-')
t_desc = data_utils.rand_name(name='desc-')
- _, body = self.client.create_tenant(t_name, description=t_desc)
+ body = self.client.create_tenant(t_name, description=t_desc)
tenant = body
self.data.tenants.append(tenant)
@@ -138,11 +138,11 @@
resp1_desc = body['description']
t_desc2 = data_utils.rand_name(name='desc2-')
- _, body = self.client.update_tenant(t_id, description=t_desc2)
+ body = self.client.update_tenant(t_id, description=t_desc2)
resp2_desc = body['description']
self.assertNotEqual(resp1_desc, resp2_desc)
- _, body = self.client.get_tenant(t_id)
+ body = self.client.get_tenant(t_id)
resp3_desc = body['description']
self.assertNotEqual(resp1_desc, resp3_desc)
@@ -157,7 +157,7 @@
# Update the enabled attribute of a tenant
t_name = data_utils.rand_name(name='tenant-')
t_en = False
- _, body = self.client.create_tenant(t_name, enabled=t_en)
+ body = self.client.create_tenant(t_name, enabled=t_en)
tenant = body
self.data.tenants.append(tenant)
@@ -165,11 +165,11 @@
resp1_en = body['enabled']
t_en2 = True
- _, body = self.client.update_tenant(t_id, enabled=t_en2)
+ body = self.client.update_tenant(t_id, enabled=t_en2)
resp2_en = body['enabled']
self.assertNotEqual(resp1_en, resp2_en)
- _, body = self.client.get_tenant(t_id)
+ body = self.client.get_tenant(t_id)
resp3_en = body['enabled']
self.assertNotEqual(resp1_en, resp3_en)
diff --git a/tempest/api/identity/admin/test_tokens.py b/tempest/api/identity/admin/test_tokens.py
index bfdc7d6..bec621c 100644
--- a/tempest/api/identity/admin/test_tokens.py
+++ b/tempest/api/identity/admin/test_tokens.py
@@ -28,21 +28,21 @@
user_password = data_utils.rand_name(name='pass-')
# first:create a tenant
tenant_name = data_utils.rand_name(name='tenant-')
- _, tenant = self.client.create_tenant(tenant_name)
+ tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
# second:create a user
- _, user = self.client.create_user(user_name, user_password,
- tenant['id'], '')
+ user = self.client.create_user(user_name, user_password,
+ tenant['id'], '')
self.data.users.append(user)
# then get a token for the user
- _, body = self.token_client.auth(user_name,
- user_password,
- tenant['name'])
+ body = self.token_client.auth(user_name,
+ user_password,
+ tenant['name'])
self.assertEqual(body['token']['tenant']['name'],
tenant['name'])
# Perform GET Token
token_id = body['token']['id']
- _, token_details = self.client.get_token(token_id)
+ token_details = self.client.get_token(token_id)
self.assertEqual(token_id, token_details['token']['id'])
self.assertEqual(user['id'], token_details['user']['id'])
self.assertEqual(user_name, token_details['user']['name'])
@@ -62,22 +62,22 @@
user_password = data_utils.rand_name(name='pass-')
tenant_id = None # No default tenant so will get unscoped token.
email = ''
- _, user = self.client.create_user(user_name, user_password,
- tenant_id, email)
+ user = self.client.create_user(user_name, user_password,
+ tenant_id, email)
self.data.users.append(user)
# Create a couple tenants.
tenant1_name = data_utils.rand_name(name='tenant-')
- _, tenant1 = self.client.create_tenant(tenant1_name)
+ tenant1 = self.client.create_tenant(tenant1_name)
self.data.tenants.append(tenant1)
tenant2_name = data_utils.rand_name(name='tenant-')
- _, tenant2 = self.client.create_tenant(tenant2_name)
+ tenant2 = self.client.create_tenant(tenant2_name)
self.data.tenants.append(tenant2)
# Create a role
role_name = data_utils.rand_name(name='role-')
- _, role = self.client.create_role(role_name)
+ role = self.client.create_role(role_name)
self.data.roles.append(role)
# Grant the user the role on the tenants.
@@ -88,13 +88,13 @@
role['id'])
# Get an unscoped token.
- _, body = self.token_client.auth(user_name, user_password)
+ body = self.token_client.auth(user_name, user_password)
token_id = body['token']['id']
# Use the unscoped token to get a token scoped to tenant1
- _, body = self.token_client.auth_token(token_id,
- tenant=tenant1_name)
+ body = self.token_client.auth_token(token_id,
+ tenant=tenant1_name)
scoped_token_id = body['token']['id']
@@ -102,5 +102,5 @@
self.client.delete_token(scoped_token_id)
# Use the unscoped token to get a token scoped to tenant2
- _, body = self.token_client.auth_token(token_id,
- tenant=tenant2_name)
+ body = self.token_client.auth_token(token_id,
+ tenant=tenant2_name)
diff --git a/tempest/api/identity/admin/test_users.py b/tempest/api/identity/admin/test_users.py
index 84a8103..25312e8 100644
--- a/tempest/api/identity/admin/test_users.py
+++ b/tempest/api/identity/admin/test_users.py
@@ -34,9 +34,9 @@
def test_create_user(self):
# Create a user
self.data.setup_test_tenant()
- _, user = self.client.create_user(self.alt_user, self.alt_password,
- self.data.tenant['id'],
- self.alt_email)
+ user = self.client.create_user(self.alt_user, self.alt_password,
+ self.data.tenant['id'],
+ self.alt_email)
self.data.users.append(user)
self.assertEqual(self.alt_user, user['name'])
@@ -45,9 +45,9 @@
# Create a user with enabled : False
self.data.setup_test_tenant()
name = data_utils.rand_name('test_user_')
- _, user = self.client.create_user(name, self.alt_password,
- self.data.tenant['id'],
- self.alt_email, enabled=False)
+ user = self.client.create_user(name, self.alt_password,
+ self.data.tenant['id'],
+ self.alt_email, enabled=False)
self.data.users.append(user)
self.assertEqual(name, user['name'])
self.assertEqual('false', str(user['enabled']).lower())
@@ -58,22 +58,22 @@
# Test case to check if updating of user attributes is successful.
test_user = data_utils.rand_name('test_user_')
self.data.setup_test_tenant()
- _, user = self.client.create_user(test_user, self.alt_password,
- self.data.tenant['id'],
- self.alt_email)
+ user = self.client.create_user(test_user, self.alt_password,
+ self.data.tenant['id'],
+ self.alt_email)
# Delete the User at the end of this method
self.addCleanup(self.client.delete_user, user['id'])
# Updating user details with new values
u_name2 = data_utils.rand_name('user2-')
u_email2 = u_name2 + '@testmail.tm'
- _, update_user = self.client.update_user(user['id'], name=u_name2,
- email=u_email2,
- enabled=False)
+ update_user = self.client.update_user(user['id'], name=u_name2,
+ email=u_email2,
+ enabled=False)
self.assertEqual(u_name2, update_user['name'])
self.assertEqual(u_email2, update_user['email'])
self.assertEqual('false', str(update_user['enabled']).lower())
# GET by id after updating
- _, updated_user = self.client.get_user(user['id'])
+ updated_user = self.client.get_user(user['id'])
# Assert response body of GET after updating
self.assertEqual(u_name2, updated_user['name'])
self.assertEqual(u_email2, updated_user['email'])
@@ -84,9 +84,9 @@
# Delete a user
test_user = data_utils.rand_name('test_user_')
self.data.setup_test_tenant()
- _, user = self.client.create_user(test_user, self.alt_password,
- self.data.tenant['id'],
- self.alt_email)
+ user = self.client.create_user(test_user, self.alt_password,
+ self.data.tenant['id'],
+ self.alt_email)
self.client.delete_user(user['id'])
@test.attr(type='smoke')
@@ -121,7 +121,7 @@
def test_get_users(self):
# Get a list of users and find the test user
self.data.setup_test_user()
- _, users = self.client.get_users()
+ users = self.client.get_users()
self.assertThat([u['name'] for u in users],
matchers.Contains(self.data.test_user),
"Could not find %s" % self.data.test_user)
@@ -133,20 +133,20 @@
user_ids = list()
fetched_user_ids = list()
alt_tenant_user1 = data_utils.rand_name('tenant_user1_')
- _, user1 = self.client.create_user(alt_tenant_user1, 'password1',
- self.data.tenant['id'],
- 'user1@123')
+ user1 = self.client.create_user(alt_tenant_user1, 'password1',
+ self.data.tenant['id'],
+ 'user1@123')
user_ids.append(user1['id'])
self.data.users.append(user1)
alt_tenant_user2 = data_utils.rand_name('tenant_user2_')
- _, user2 = self.client.create_user(alt_tenant_user2, 'password2',
- self.data.tenant['id'],
- 'user2@123')
+ user2 = self.client.create_user(alt_tenant_user2, 'password2',
+ self.data.tenant['id'],
+ 'user2@123')
user_ids.append(user2['id'])
self.data.users.append(user2)
# List of users for the respective tenant ID
- _, body = self.client.list_users_for_tenant(self.data.tenant['id'])
+ body = self.client.list_users_for_tenant(self.data.tenant['id'])
for i in body:
fetched_user_ids.append(i['id'])
# verifying the user Id in the list
@@ -168,20 +168,20 @@
user_ids = list()
fetched_user_ids = list()
user_ids.append(user['id'])
- _, role = self.client.assign_user_role(tenant['id'], user['id'],
- role['id'])
+ role = self.client.assign_user_role(tenant['id'], user['id'],
+ role['id'])
alt_user2 = data_utils.rand_name('second_user_')
- _, second_user = self.client.create_user(alt_user2, 'password1',
- self.data.tenant['id'],
- 'user2@123')
+ second_user = self.client.create_user(alt_user2, 'password1',
+ self.data.tenant['id'],
+ 'user2@123')
user_ids.append(second_user['id'])
self.data.users.append(second_user)
- _, role = self.client.assign_user_role(tenant['id'],
- second_user['id'],
- role['id'])
+ role = self.client.assign_user_role(tenant['id'],
+ second_user['id'],
+ role['id'])
# List of users with roles for the respective tenant ID
- _, body = self.client.list_users_for_tenant(self.data.tenant['id'])
+ body = self.client.list_users_for_tenant(self.data.tenant['id'])
for i in body:
fetched_user_ids.append(i['id'])
# verifying the user Id in the list
@@ -197,12 +197,12 @@
self.data.setup_test_user()
# Updating the user with new password
new_pass = data_utils.rand_name('pass-')
- _, update_user = self.client.update_user_password(
+ update_user = self.client.update_user_password(
self.data.user['id'], new_pass)
self.assertEqual(update_user['id'], self.data.user['id'])
# Validate the updated password
# Get a token
- _, body = self.token_client.auth(self.data.test_user, new_pass,
- self.data.test_tenant)
+ body = self.token_client.auth(self.data.test_user, new_pass,
+ self.data.test_tenant)
self.assertTrue('id' in body['token'])
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index c9010ee..08bfd4f 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -46,7 +46,7 @@
@classmethod
def get_user_by_name(cls, name):
- _, users = cls.client.get_users()
+ users = cls.client.get_users()
user = [u for u in users if u['name'] == name]
if len(user) > 0:
return user[0]
@@ -54,16 +54,16 @@
@classmethod
def get_tenant_by_name(cls, name):
try:
- _, tenants = cls.client.list_tenants()
+ tenants = cls.client.list_tenants()
except AttributeError:
- _, tenants = cls.client.list_projects()
+ tenants = cls.client.list_projects()
tenant = [t for t in tenants if t['name'] == name]
if len(tenant) > 0:
return tenant[0]
@classmethod
def get_role_by_name(cls, name):
- _, roles = cls.client.list_roles()
+ roles = cls.client.list_roles()
role = [r for r in roles if r['name'] == name]
if len(role) > 0:
return role[0]
@@ -161,17 +161,17 @@
self.test_user = data_utils.rand_name('test_user_')
self.test_password = data_utils.rand_name('pass_')
self.test_email = self.test_user + '@testmail.tm'
- _, self.user = self.client.create_user(self.test_user,
- self.test_password,
- self.tenant['id'],
- self.test_email)
+ self.user = self.client.create_user(self.test_user,
+ self.test_password,
+ self.tenant['id'],
+ self.test_email)
self.users.append(self.user)
def setup_test_tenant(self):
"""Set up a test tenant."""
self.test_tenant = data_utils.rand_name('test_tenant_')
self.test_description = data_utils.rand_name('desc_')
- _, self.tenant = self.client.create_tenant(
+ self.tenant = self.client.create_tenant(
name=self.test_tenant,
description=self.test_description)
self.tenants.append(self.tenant)
@@ -179,7 +179,7 @@
def setup_test_role(self):
"""Set up a test role."""
self.test_role = data_utils.rand_name('role')
- _, self.role = self.client.create_role(self.test_role)
+ self.role = self.client.create_role(self.test_role)
self.roles.append(self.role)
def setup_test_v3_user(self):
diff --git a/tempest/api/identity/test_extension.py b/tempest/api/identity/test_extension.py
index 829628a..e3badfc 100644
--- a/tempest/api/identity/test_extension.py
+++ b/tempest/api/identity/test_extension.py
@@ -23,7 +23,7 @@
@test.attr(type='gate')
def test_list_extensions(self):
# List all the extensions
- _, body = self.non_admin_client.list_extensions()
+ body = self.non_admin_client.list_extensions()
self.assertNotEmpty(body)
keys = ['name', 'updated', 'alias', 'links',
'namespace', 'description']
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 76b6f17..12f3fdd 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -67,10 +67,10 @@
container_format = kwargs.pop('container_format')
disk_format = kwargs.pop('disk_format')
- resp, image = cls.client.create_image(name, container_format,
- disk_format, **kwargs)
+ image = cls.client.create_image(name, container_format,
+ disk_format, **kwargs)
cls.created_images.append(image['id'])
- return resp, image
+ return image
class BaseV1ImageTest(BaseImageTest):
@@ -95,11 +95,10 @@
def _create_image(self):
image_file = StringIO.StringIO(data_utils.random_bytes())
- resp, image = self.create_image(container_format='bare',
- disk_format='raw',
- is_public=False,
- data=image_file)
- self.assertEqual(201, resp.status)
+ image = self.create_image(container_format='bare',
+ disk_format='raw',
+ is_public=False,
+ data=image_file)
image_id = image['id']
return image_id
@@ -127,15 +126,15 @@
cls.alt_tenant_id = cls.alt_img_client.tenant_id
def _list_image_ids_as_alt(self):
- _, image_list = self.alt_img_client.image_list()
+ image_list = self.alt_img_client.image_list()
image_ids = map(lambda x: x['id'], image_list)
return image_ids
def _create_image(self):
name = data_utils.rand_name('image')
- _, image = self.os_img_client.create_image(name,
- container_format='bare',
- disk_format='raw')
+ image = self.os_img_client.create_image(name,
+ container_format='bare',
+ disk_format='raw')
image_id = image['id']
self.addCleanup(self.os_img_client.delete_image, image_id)
return image_id
diff --git a/tempest/api/image/v1/test_image_members.py b/tempest/api/image/v1/test_image_members.py
index f91cb69..d18a274 100644
--- a/tempest/api/image/v1/test_image_members.py
+++ b/tempest/api/image/v1/test_image_members.py
@@ -23,7 +23,7 @@
def test_add_image_member(self):
image = self._create_image()
self.client.add_member(self.alt_tenant_id, image)
- _, body = self.client.get_image_membership(image)
+ body = self.client.get_image_membership(image)
members = body['members']
members = map(lambda x: x['member_id'], members)
self.assertIn(self.alt_tenant_id, members)
@@ -36,7 +36,7 @@
self.client.add_member(self.alt_tenant_id, image)
share_image = self._create_image()
self.client.add_member(self.alt_tenant_id, share_image)
- _, body = self.client.get_shared_images(self.alt_tenant_id)
+ body = self.client.get_shared_images(self.alt_tenant_id)
images = body['shared_images']
images = map(lambda x: x['image_id'], images)
self.assertIn(share_image, images)
@@ -47,6 +47,6 @@
image_id = self._create_image()
self.client.add_member(self.alt_tenant_id, image_id)
self.client.delete_member(self.alt_tenant_id, image_id)
- _, body = self.client.get_image_membership(image_id)
+ body = self.client.get_image_membership(image_id)
members = body['members']
self.assertEqual(0, len(members), str(members))
diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py
index bc45da5..b9f12e6 100644
--- a/tempest/api/image/v1/test_images.py
+++ b/tempest/api/image/v1/test_images.py
@@ -30,11 +30,11 @@
def test_register_then_upload(self):
# Register, then upload an image
properties = {'prop1': 'val1'}
- _, body = self.create_image(name='New Name',
- container_format='bare',
- disk_format='raw',
- is_public=False,
- properties=properties)
+ body = self.create_image(name='New Name',
+ container_format='bare',
+ disk_format='raw',
+ is_public=False,
+ properties=properties)
self.assertIn('id', body)
image_id = body.get('id')
self.assertEqual('New Name', body.get('name'))
@@ -45,19 +45,19 @@
# Now try uploading an image file
image_file = StringIO.StringIO(data_utils.random_bytes())
- _, body = self.client.update_image(image_id, data=image_file)
+ body = self.client.update_image(image_id, data=image_file)
self.assertIn('size', body)
self.assertEqual(1024, body.get('size'))
@test.attr(type='gate')
def test_register_remote_image(self):
# Register a new remote image
- _, body = self.create_image(name='New Remote Image',
- container_format='bare',
- disk_format='raw', is_public=False,
- location=CONF.image.http_image,
- properties={'key1': 'value1',
- 'key2': 'value2'})
+ body = self.create_image(name='New Remote Image',
+ container_format='bare',
+ disk_format='raw', is_public=False,
+ location=CONF.image.http_image,
+ properties={'key1': 'value1',
+ 'key2': 'value2'})
self.assertIn('id', body)
self.assertEqual('New Remote Image', body.get('name'))
self.assertFalse(body.get('is_public'))
@@ -68,10 +68,10 @@
@test.attr(type='gate')
def test_register_http_image(self):
- _, body = self.create_image(name='New Http Image',
- container_format='bare',
- disk_format='raw', is_public=False,
- copy_from=CONF.image.http_image)
+ body = self.create_image(name='New Http Image',
+ container_format='bare',
+ disk_format='raw', is_public=False,
+ copy_from=CONF.image.http_image)
self.assertIn('id', body)
image_id = body.get('id')
self.assertEqual('New Http Image', body.get('name'))
@@ -83,12 +83,12 @@
def test_register_image_with_min_ram(self):
# Register an image with min ram
properties = {'prop1': 'val1'}
- _, body = self.create_image(name='New_image_with_min_ram',
- container_format='bare',
- disk_format='raw',
- is_public=False,
- min_ram=40,
- properties=properties)
+ body = self.create_image(name='New_image_with_min_ram',
+ container_format='bare',
+ disk_format='raw',
+ is_public=False,
+ min_ram=40,
+ properties=properties)
self.assertIn('id', body)
self.assertEqual('New_image_with_min_ram', body.get('name'))
self.assertFalse(body.get('is_public'))
@@ -140,11 +140,11 @@
"""
name = 'New Remote Image %s' % name
location = CONF.image.http_image
- _, image = cls.create_image(name=name,
- container_format=container_format,
- disk_format=disk_format,
- is_public=False,
- location=location)
+ image = cls.create_image(name=name,
+ container_format=container_format,
+ disk_format=disk_format,
+ is_public=False,
+ location=location)
image_id = image['id']
return image_id
@@ -158,24 +158,24 @@
"""
image_file = StringIO.StringIO(data_utils.random_bytes(size))
name = 'New Standard Image %s' % name
- _, image = cls.create_image(name=name,
- container_format=container_format,
- disk_format=disk_format,
- is_public=False, data=image_file)
+ image = cls.create_image(name=name,
+ container_format=container_format,
+ disk_format=disk_format,
+ is_public=False, data=image_file)
image_id = image['id']
return image_id
@test.attr(type='gate')
def test_index_no_params(self):
# Simple test to see all fixture images returned
- _, images_list = self.client.image_list()
+ images_list = self.client.image_list()
image_list = map(lambda x: x['id'], images_list)
for image_id in self.created_images:
self.assertIn(image_id, image_list)
@test.attr(type='gate')
def test_index_disk_format(self):
- _, images_list = self.client.image_list(disk_format='ami')
+ images_list = self.client.image_list(disk_format='ami')
for image in images_list:
self.assertEqual(image['disk_format'], 'ami')
result_set = set(map(lambda x: x['id'], images_list))
@@ -184,7 +184,7 @@
@test.attr(type='gate')
def test_index_container_format(self):
- _, images_list = self.client.image_list(container_format='bare')
+ images_list = self.client.image_list(container_format='bare')
for image in images_list:
self.assertEqual(image['container_format'], 'bare')
result_set = set(map(lambda x: x['id'], images_list))
@@ -193,7 +193,7 @@
@test.attr(type='gate')
def test_index_max_size(self):
- _, images_list = self.client.image_list(size_max=42)
+ images_list = self.client.image_list(size_max=42)
for image in images_list:
self.assertTrue(image['size'] <= 42)
result_set = set(map(lambda x: x['id'], images_list))
@@ -202,7 +202,7 @@
@test.attr(type='gate')
def test_index_min_size(self):
- _, images_list = self.client.image_list(size_min=142)
+ images_list = self.client.image_list(size_min=142)
for image in images_list:
self.assertTrue(image['size'] >= 142)
result_set = set(map(lambda x: x['id'], images_list))
@@ -211,9 +211,9 @@
@test.attr(type='gate')
def test_index_status_active_detail(self):
- _, images_list = self.client.image_list_detail(status='active',
- sort_key='size',
- sort_dir='desc')
+ images_list = self.client.image_list_detail(status='active',
+ sort_key='size',
+ sort_dir='desc')
top_size = images_list[0]['size'] # We have non-zero sized images
for image in images_list:
size = image['size']
@@ -223,7 +223,7 @@
@test.attr(type='gate')
def test_index_name(self):
- _, images_list = self.client.image_list_detail(
+ images_list = self.client.image_list_detail(
name='New Remote Image dup')
result_set = set(map(lambda x: x['id'], images_list))
for image in images_list:
@@ -247,18 +247,18 @@
"""
image_file = StringIO.StringIO(data_utils.random_bytes(size))
name = 'New Standard Image %s' % name
- _, image = cls.create_image(name=name,
- container_format=container_format,
- disk_format=disk_format,
- is_public=False, data=image_file,
- properties={'key1': 'value1'})
+ image = cls.create_image(name=name,
+ container_format=container_format,
+ disk_format=disk_format,
+ is_public=False, data=image_file,
+ properties={'key1': 'value1'})
image_id = image['id']
return image_id
@test.attr(type='gate')
def test_list_image_metadata(self):
# All metadata key/value pairs for an image should be returned
- _, resp_metadata = self.client.get_image_meta(self.image_id)
+ resp_metadata = self.client.get_image_meta(self.image_id)
expected = {'key1': 'value1'}
self.assertEqual(expected, resp_metadata['properties'])
@@ -266,12 +266,12 @@
def test_update_image_metadata(self):
# The metadata for the image should match the updated values
req_metadata = {'key1': 'alt1', 'key2': 'value2'}
- _, metadata = self.client.get_image_meta(self.image_id)
+ metadata = self.client.get_image_meta(self.image_id)
self.assertEqual(metadata['properties'], {'key1': 'value1'})
metadata['properties'].update(req_metadata)
- _, metadata = self.client.update_image(
+ metadata = self.client.update_image(
self.image_id, properties=metadata['properties'])
- _, resp_metadata = self.client.get_image_meta(self.image_id)
+ resp_metadata = self.client.get_image_meta(self.image_id)
expected = {'key1': 'alt1', 'key2': 'value2'}
self.assertEqual(expected, resp_metadata['properties'])
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 7e018e5..e307c5c 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -37,11 +37,11 @@
uuid = '00000000-1111-2222-3333-444455556666'
image_name = data_utils.rand_name('image')
- _, body = self.create_image(name=image_name,
- container_format='bare',
- disk_format='raw',
- visibility='private',
- ramdisk_id=uuid)
+ body = self.create_image(name=image_name,
+ container_format='bare',
+ disk_format='raw',
+ visibility='private',
+ ramdisk_id=uuid)
self.assertIn('id', body)
image_id = body.get('id')
self.assertIn('name', body)
@@ -57,7 +57,7 @@
self.client.store_image(image_id, image_file)
# Now try to get image details
- _, body = self.client.get_image(image_id)
+ body = self.client.get_image(image_id)
self.assertEqual(image_id, body['id'])
self.assertEqual(image_name, body['name'])
self.assertEqual(uuid, body['ramdisk_id'])
@@ -74,10 +74,10 @@
# Create image
image_name = data_utils.rand_name('image')
- _, body = self.client.create_image(name=image_name,
- container_format='bare',
- disk_format='raw',
- visibility='private')
+ body = self.client.create_image(name=image_name,
+ container_format='bare',
+ disk_format='raw',
+ visibility='private')
image_id = body['id']
# Delete Image
@@ -85,7 +85,7 @@
self.client.wait_for_resource_deletion(image_id)
# Verifying deletion
- _, images = self.client.image_list()
+ images = self.client.image_list()
images_id = [item['id'] for item in images]
self.assertNotIn(image_id, images_id)
@@ -95,10 +95,10 @@
# Create image
image_name = data_utils.rand_name('image')
- _, body = self.client.create_image(name=image_name,
- container_format='bare',
- disk_format='iso',
- visibility='private')
+ body = self.client.create_image(name=image_name,
+ container_format='bare',
+ disk_format='iso',
+ visibility='private')
self.addCleanup(self.client.delete_image, body['id'])
self.assertEqual('queued', body['status'])
image_id = body['id']
@@ -109,12 +109,12 @@
# Update Image
new_image_name = data_utils.rand_name('new-image')
- _, body = self.client.update_image(image_id, [
+ body = self.client.update_image(image_id, [
dict(replace='/name', value=new_image_name)])
# Verifying updating
- _, body = self.client.get_image(image_id)
+ body = self.client.get_image(image_id)
self.assertEqual(image_id, body['id'])
self.assertEqual(new_image_name, body['name'])
@@ -147,10 +147,10 @@
size = random.randint(1024, 4096)
image_file = StringIO.StringIO(data_utils.random_bytes(size))
name = data_utils.rand_name('image-')
- _, body = cls.create_image(name=name,
- container_format=container_format,
- disk_format=disk_format,
- visibility='private')
+ body = cls.create_image(name=name,
+ container_format=container_format,
+ disk_format=disk_format,
+ visibility='private')
image_id = body['id']
cls.client.store_image(image_id, data=image_file)
@@ -160,7 +160,7 @@
"""
Perform list action with given params and validates result.
"""
- _, images_list = self.client.image_list(params=params)
+ images_list = self.client.image_list(params=params)
# Validating params of fetched images
for image in images_list:
for key in params:
@@ -170,7 +170,7 @@
@test.attr(type='gate')
def test_index_no_params(self):
# Simple test to see all fixture images returned
- _, images_list = self.client.image_list()
+ images_list = self.client.image_list()
image_list = map(lambda x: x['id'], images_list)
for image in self.created_images:
@@ -199,7 +199,7 @@
# Test to get all images by size
image_id = self.created_images[1]
# Get image metadata
- _, image = self.client.get_image(image_id)
+ image = self.client.get_image(image_id)
params = {"size": image['size']}
self._list_by_param_value_and_assert(params)
@@ -209,11 +209,11 @@
# Test to get all images with size between 2000 to 3000
image_id = self.created_images[1]
# Get image metadata
- _, image = self.client.get_image(image_id)
+ image = self.client.get_image(image_id)
size = image['size']
params = {"size_min": size - 500, "size_max": size + 500}
- _, images_list = self.client.image_list(params=params)
+ images_list = self.client.image_list(params=params)
image_size_list = map(lambda x: x['size'], images_list)
for image_size in image_size_list:
@@ -231,7 +231,7 @@
def test_list_images_param_limit(self):
# Test to get images by limit
params = {"limit": 2}
- _, images_list = self.client.image_list(params=params)
+ images_list = self.client.image_list(params=params)
self.assertEqual(len(images_list), params['limit'],
"Failed to get images by limit")
@@ -240,12 +240,12 @@
def test_get_image_schema(self):
# Test to get image schema
schema = "image"
- _, body = self.client.get_schema(schema)
+ body = self.client.get_schema(schema)
self.assertEqual("image", body['name'])
@test.attr(type='gate')
def test_get_images_schema(self):
# Test to get images schema
schema = "images"
- _, body = self.client.get_schema(schema)
+ body = self.client.get_schema(schema)
self.assertEqual("images", body['name'])
diff --git a/tempest/api/image/v2/test_images_member.py b/tempest/api/image/v2/test_images_member.py
index 5aaf578..ec1cf14 100644
--- a/tempest/api/image/v2/test_images_member.py
+++ b/tempest/api/image/v2/test_images_member.py
@@ -20,8 +20,8 @@
@test.attr(type='gate')
def test_image_share_accept(self):
image_id = self._create_image()
- _, member = self.os_img_client.add_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.add_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
@@ -30,7 +30,7 @@
self.alt_tenant_id,
'accepted')
self.assertIn(image_id, self._list_image_ids_as_alt())
- _, body = self.os_img_client.get_image_membership(image_id)
+ body = self.os_img_client.get_image_membership(image_id)
members = body['members']
member = members[0]
self.assertEqual(len(members), 1, str(members))
@@ -41,8 +41,8 @@
@test.attr(type='gate')
def test_image_share_reject(self):
image_id = self._create_image()
- _, member = self.os_img_client.add_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.add_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
@@ -62,8 +62,8 @@
'accepted')
self.assertIn(image_id, self._list_image_ids_as_alt())
- _, member = self.os_img_client.get_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.get_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(self.alt_tenant_id, member['member_id'])
self.assertEqual(image_id, member['image_id'])
self.assertEqual('accepted', member['status'])
@@ -83,10 +83,10 @@
@test.attr(type='gate')
def test_get_image_member_schema(self):
- _, body = self.os_img_client.get_schema("member")
+ body = self.os_img_client.get_schema("member")
self.assertEqual("member", body['name'])
@test.attr(type='gate')
def test_get_image_members_schema(self):
- _, body = self.os_img_client.get_schema("members")
+ body = self.os_img_client.get_schema("members")
self.assertEqual("members", body['name'])
diff --git a/tempest/api/image/v2/test_images_member_negative.py b/tempest/api/image/v2/test_images_member_negative.py
index 7da6e65..1f8e3d0 100644
--- a/tempest/api/image/v2/test_images_member_negative.py
+++ b/tempest/api/image/v2/test_images_member_negative.py
@@ -21,8 +21,8 @@
@test.attr(type=['negative', 'gate'])
def test_image_share_invalid_status(self):
image_id = self._create_image()
- _, member = self.os_img_client.add_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.add_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertRaises(exceptions.BadRequest,
self.alt_img_client.update_member_status,
@@ -31,8 +31,8 @@
@test.attr(type=['negative', 'gate'])
def test_image_share_owner_cannot_accept(self):
image_id = self._create_image()
- _, member = self.os_img_client.add_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.add_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
self.assertRaises(exceptions.Unauthorized,
diff --git a/tempest/api/image/v2/test_images_negative.py b/tempest/api/image/v2/test_images_negative.py
index 722929e..fc781b1 100644
--- a/tempest/api/image/v2/test_images_negative.py
+++ b/tempest/api/image/v2/test_images_negative.py
@@ -52,9 +52,9 @@
def test_get_delete_deleted_image(self):
# get and delete the deleted image
# create and delete image
- _, body = self.client.create_image(name='test',
- container_format='bare',
- disk_format='raw')
+ body = self.client.create_image(name='test',
+ container_format='bare',
+ disk_format='raw')
image_id = body['id']
self.client.delete_image(image_id)
self.client.wait_for_resource_deletion(image_id)
diff --git a/tempest/api/image/v2/test_images_tags.py b/tempest/api/image/v2/test_images_tags.py
index a9db24b..4686de2 100644
--- a/tempest/api/image/v2/test_images_tags.py
+++ b/tempest/api/image/v2/test_images_tags.py
@@ -21,19 +21,19 @@
@test.attr(type='gate')
def test_update_delete_tags_for_image(self):
- _, body = self.create_image(container_format='bare',
- disk_format='raw',
- visibility='private')
+ body = self.create_image(container_format='bare',
+ disk_format='raw',
+ visibility='private')
image_id = body['id']
tag = data_utils.rand_name('tag-')
self.addCleanup(self.client.delete_image, image_id)
# Creating image tag and verify it.
self.client.add_image_tag(image_id, tag)
- _, body = self.client.get_image(image_id)
+ body = self.client.get_image(image_id)
self.assertIn(tag, body['tags'])
# Deleting image tag and verify it.
self.client.delete_image_tag(image_id, tag)
- _, body = self.client.get_image(image_id)
+ body = self.client.get_image(image_id)
self.assertNotIn(tag, body['tags'])
diff --git a/tempest/api/image/v2/test_images_tags_negative.py b/tempest/api/image/v2/test_images_tags_negative.py
index 8e42b7c..aa0a214 100644
--- a/tempest/api/image/v2/test_images_tags_negative.py
+++ b/tempest/api/image/v2/test_images_tags_negative.py
@@ -33,10 +33,10 @@
@test.attr(type=['negative', 'gate'])
def test_delete_non_existing_tag(self):
# Delete non existing tag.
- _, body = self.create_image(container_format='bare',
- disk_format='raw',
- visibility='private'
- )
+ body = self.create_image(container_format='bare',
+ disk_format='raw',
+ visibility='private'
+ )
image_id = body['id']
tag = data_utils.rand_name('non-exist-tag-')
self.addCleanup(self.client.delete_image, image_id)
diff --git a/tempest/api/network/admin/test_external_networks_negative.py b/tempest/api/network/admin/test_external_networks_negative.py
new file mode 100644
index 0000000..7dbb347
--- /dev/null
+++ b/tempest/api/network/admin/test_external_networks_negative.py
@@ -0,0 +1,53 @@
+# Copyright 2014 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.network import base
+from tempest import config
+from tempest import exceptions
+from tempest import test
+
+CONF = config.CONF
+
+
+class ExternalNetworksAdminNegativeTestJSON(base.BaseAdminNetworkTest):
+ _interface = 'json'
+
+ @test.attr(type=['negative'])
+ def test_create_port_with_precreated_floatingip_as_fixed_ip(self):
+ """
+ External networks can be used to create both floating-ip as well
+ as instance-ip. So, creating an instance-ip with a value of a
+ pre-created floating-ip should be denied.
+ """
+
+ # create a floating ip
+ client = self.admin_client
+ body = client.create_floatingip(
+ floating_network_id=CONF.network.public_network_id)
+ created_floating_ip = body['floatingip']
+ self.addCleanup(self._try_delete_resource,
+ client.delete_floatingip,
+ created_floating_ip['id'])
+ floating_ip_address = created_floating_ip['floating_ip_address']
+ self.assertIsNotNone(floating_ip_address)
+
+ # use the same value of floatingip as fixed-ip to create_port()
+ fixed_ips = [{'ip_address': floating_ip_address}]
+
+ # create a port which will internally create an instance-ip
+ self.assertRaises(exceptions.Conflict,
+ client.create_port,
+ network_id=CONF.network.public_network_id,
+ fixed_ips=fixed_ips)
diff --git a/tempest/api/network/admin/test_quotas.py b/tempest/api/network/admin/test_quotas.py
index 54aa54c..f8dfca9 100644
--- a/tempest/api/network/admin/test_quotas.py
+++ b/tempest/api/network/admin/test_quotas.py
@@ -50,7 +50,7 @@
# Add a tenant to conduct the test
test_tenant = data_utils.rand_name('test_tenant_')
test_description = data_utils.rand_name('desc_')
- _, tenant = self.identity_admin_client.create_tenant(
+ tenant = self.identity_admin_client.create_tenant(
name=test_tenant,
description=test_description)
tenant_id = tenant['id']
diff --git a/tempest/api/network/test_floating_ips_negative.py b/tempest/api/network/test_floating_ips_negative.py
new file mode 100644
index 0000000..82f0519
--- /dev/null
+++ b/tempest/api/network/test_floating_ips_negative.py
@@ -0,0 +1,78 @@
+# Copyright 2014 Hewlett-Packard Development Company, L.P.
+# Copyright 2014 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.network import base
+from tempest.common.utils import data_utils
+from tempest import config
+from tempest import exceptions
+from tempest import test
+
+CONF = config.CONF
+
+
+class FloatingIPNegativeTestJSON(base.BaseNetworkTest):
+ _interface = 'json'
+ """
+ Test the following negative operations for floating ips:
+
+ Create floatingip with a port that is unreachable to external network
+ Create floatingip in private network
+ Associate floatingip with port that is unreachable to external network
+ """
+
+ @classmethod
+ def resource_setup(cls):
+ super(FloatingIPNegativeTestJSON, cls).resource_setup()
+ if not test.is_extension_enabled('router', 'network'):
+ msg = "router extension not enabled."
+ raise cls.skipException(msg)
+ cls.ext_net_id = CONF.network.public_network_id
+ # Create a network with a subnet connected to a router.
+ cls.network = cls.create_network()
+ cls.subnet = cls.create_subnet(cls.network)
+ cls.router = cls.create_router(data_utils.rand_name('router'))
+ cls.create_router_interface(cls.router['id'], cls.subnet['id'])
+ cls.port = cls.create_port(cls.network)
+
+ @test.attr(type=['negative', 'smoke'])
+ def test_create_floatingip_with_port_ext_net_unreachable(self):
+ self.assertRaises(exceptions.NotFound, self.client.create_floatingip,
+ floating_network_id=self.ext_net_id,
+ port_id=self.port['id'],
+ fixed_ip_address=self.port['fixed_ips'][0]
+ ['ip_address'])
+
+ @test.attr(type=['negative', 'smoke'])
+ def test_create_floatingip_in_private_network(self):
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_floatingip,
+ floating_network_id=self.network['id'],
+ port_id=self.port['id'],
+ fixed_ip_address=self.port['fixed_ips'][0]
+ ['ip_address'])
+
+ @test.attr(type=['negative', 'smoke'])
+ def test_associate_floatingip_port_ext_net_unreachable(self):
+ # Create floating ip
+ body = self.client.create_floatingip(
+ floating_network_id=self.ext_net_id)
+ floating_ip = body['floatingip']
+ self.addCleanup(self.client.delete_floatingip, floating_ip['id'])
+ # Associate floating IP to the other port
+ self.assertRaises(exceptions.NotFound, self.client.update_floatingip,
+ floating_ip['id'], port_id=self.port['id'],
+ fixed_ip_address=self.port['fixed_ips'][0]
+ ['ip_address'])
diff --git a/tempest/api/network/test_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/network/test_routers.py b/tempest/api/network/test_routers.py
index 5e8a851..210a8af 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -94,7 +94,7 @@
# Test creating router from admin user setting tenant_id.
test_tenant = data_utils.rand_name('test_tenant_')
test_description = data_utils.rand_name('desc_')
- _, tenant = self.identity_admin_client.create_tenant(
+ tenant = self.identity_admin_client.create_tenant(
name=test_tenant, description=test_description)
tenant_id = tenant['id']
self.addCleanup(self.identity_admin_client.delete_tenant, tenant_id)
diff --git a/tempest/api/network/test_routers_negative.py b/tempest/api/network/test_routers_negative.py
index 88aa3c9..d571e92 100644
--- a/tempest/api/network/test_routers_negative.py
+++ b/tempest/api/network/test_routers_negative.py
@@ -83,6 +83,24 @@
self.client.delete_router,
self.router['id'])
+ @test.attr(type=['negative', 'smoke'])
+ def test_show_non_existent_router_returns_404(self):
+ router = data_utils.rand_name('non_exist_router')
+ self.assertRaises(exceptions.NotFound, self.client.show_router,
+ router)
+
+ @test.attr(type=['negative', 'smoke'])
+ def test_update_non_existent_router_returns_404(self):
+ router = data_utils.rand_name('non_exist_router')
+ self.assertRaises(exceptions.NotFound, self.client.update_router,
+ router, name="new_name")
+
+ @test.attr(type=['negative', 'smoke'])
+ def test_delete_non_existent_router_returns_404(self):
+ router = data_utils.rand_name('non_exist_router')
+ self.assertRaises(exceptions.NotFound, self.client.delete_router,
+ router)
+
class RoutersNegativeIpV6Test(RoutersNegativeTest):
_ip_version = 6
diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py
index 7fabb7d..36c9f5a 100644
--- a/tempest/api/object_storage/base.py
+++ b/tempest/api/object_storage/base.py
@@ -46,10 +46,8 @@
cls.object_client = cls.os.object_client
cls.container_client = cls.os.container_client
cls.account_client = cls.os.account_client
- cls.custom_object_client = cls.os.custom_object_client
cls.token_client = cls.os_admin.token_client
cls.identity_admin_client = cls.os_admin.identity_client
- cls.custom_account_client = cls.os.custom_account_client
cls.object_client_alt = cls.os_alt.object_client
cls.container_client_alt = cls.os_alt.container_client
cls.identity_client_alt = cls.os_alt.identity_client
@@ -58,8 +56,6 @@
cls.object_client.auth_provider.clear_auth()
cls.container_client.auth_provider.clear_auth()
cls.account_client.auth_provider.clear_auth()
- cls.custom_object_client.auth_provider.clear_auth()
- cls.custom_account_client.auth_provider.clear_auth()
cls.object_client_alt.auth_provider.clear_auth()
cls.container_client_alt.auth_provider.clear_auth()
@@ -126,7 +122,7 @@
def _get_role_id(self, role_name):
try:
- _, roles = self.client.list_roles()
+ roles = self.client.list_roles()
return next(r['id'] for r in roles if r['name'] == role_name)
except StopIteration:
msg = "Role name '%s' is not found" % role_name
diff --git a/tempest/api/object_storage/test_account_quotas.py b/tempest/api/object_storage/test_account_quotas.py
index e75e971..1832b37 100644
--- a/tempest/api/object_storage/test_account_quotas.py
+++ b/tempest/api/object_storage/test_account_quotas.py
@@ -43,30 +43,30 @@
def setUp(self):
super(AccountQuotasTest, self).setUp()
- # Set the reselleradmin auth in headers for next custom_account_client
+ # Set the reselleradmin auth in headers for next account_client
# request
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.reselleradmin_auth_data
)
# Set a quota of 20 bytes on the user's account before each test
headers = {"X-Account-Meta-Quota-Bytes": "20"}
- self.os.custom_account_client.request("POST", url="", headers=headers,
- body="")
+ self.os.account_client.request("POST", url="", headers=headers,
+ body="")
def tearDown(self):
- # Set the reselleradmin auth in headers for next custom_account_client
+ # Set the reselleradmin auth in headers for next account_client
# request
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.reselleradmin_auth_data
)
# remove the quota from the container
headers = {"X-Remove-Account-Meta-Quota-Bytes": "x"}
- self.os.custom_account_client.request("POST", url="", headers=headers,
- body="")
+ self.os.account_client.request("POST", url="", headers=headers,
+ body="")
super(AccountQuotasTest, self).tearDown()
@classmethod
@@ -91,7 +91,7 @@
"""Test that the ResellerAdmin is able to modify and remove the quota
on a user's account.
- Using the custom_account client, the test modifies the quota
+ Using the account client, the test modifies the quota
successively to:
* "25": a random value different from the initial quota value.
@@ -100,15 +100,15 @@
"""
for quota in ("25", "", "20"):
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.reselleradmin_auth_data
)
headers = {"X-Account-Meta-Quota-Bytes": quota}
- resp, _ = self.os.custom_account_client.request("POST", url="",
- headers=headers,
- body="")
+ resp, _ = self.os.account_client.request("POST", url="",
+ headers=headers,
+ body="")
self.assertEqual(resp["status"], "204")
self.assertHeaders(resp, 'Account', 'POST')
diff --git a/tempest/api/object_storage/test_account_quotas_negative.py b/tempest/api/object_storage/test_account_quotas_negative.py
index 6c1fb5a..a6ea6ee 100644
--- a/tempest/api/object_storage/test_account_quotas_negative.py
+++ b/tempest/api/object_storage/test_account_quotas_negative.py
@@ -43,30 +43,30 @@
def setUp(self):
super(AccountQuotasNegativeTest, self).setUp()
- # Set the reselleradmin auth in headers for next custom_account_client
+ # Set the reselleradmin auth in headers for next account_client
# request
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.reselleradmin_auth_data
)
# Set a quota of 20 bytes on the user's account before each test
headers = {"X-Account-Meta-Quota-Bytes": "20"}
- self.os.custom_account_client.request("POST", url="", headers=headers,
- body="")
+ self.os.account_client.request("POST", url="", headers=headers,
+ body="")
def tearDown(self):
- # Set the reselleradmin auth in headers for next custom_account_client
+ # Set the reselleradmin auth in headers for next account_client
# request
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.reselleradmin_auth_data
)
# remove the quota from the container
headers = {"X-Remove-Account-Meta-Quota-Bytes": "x"}
- self.os.custom_account_client.request("POST", url="", headers=headers,
- body="")
+ self.os.account_client.request("POST", url="", headers=headers,
+ body="")
super(AccountQuotasNegativeTest, self).tearDown()
@classmethod
diff --git a/tempest/api/object_storage/test_account_services_negative.py b/tempest/api/object_storage/test_account_services_negative.py
index e4c46e2..ef04387 100644
--- a/tempest/api/object_storage/test_account_services_negative.py
+++ b/tempest/api/object_storage/test_account_services_negative.py
@@ -34,10 +34,10 @@
test_auth_provider.auth_data
# Get fresh auth for test user and set it to next auth request for
- # custom_account_client
+ # account_client
delattr(test_auth_provider, 'auth_data')
test_auth_new_data = test_auth_provider.auth_data
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=test_auth_new_data
)
@@ -45,5 +45,5 @@
params = {'format': 'json'}
# list containers with non-authorized user token
self.assertRaises(exceptions.Unauthorized,
- self.custom_account_client.list_account_containers,
+ self.account_client.list_account_containers,
params=params)
diff --git a/tempest/api/object_storage/test_container_acl.py b/tempest/api/object_storage/test_container_acl.py
index 2244900..205bc91 100644
--- a/tempest/api/object_storage/test_container_acl.py
+++ b/tempest/api/object_storage/test_container_acl.py
@@ -52,11 +52,11 @@
object_name, 'data')
self.assertHeaders(resp, 'Object', 'PUT')
# Trying to read the object with rights
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
- resp, _ = self.custom_object_client.get_object(
+ resp, _ = self.object_client.get_object(
self.container_name, object_name)
self.assertHeaders(resp, 'Object', 'GET')
@@ -71,12 +71,12 @@
metadata_prefix='')
self.assertHeaders(resp_meta, 'Container', 'POST')
# Trying to write the object with rights
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
object_name = data_utils.rand_name(name='Object')
- resp, _ = self.custom_object_client.create_object(
+ resp, _ = self.object_client.create_object(
self.container_name,
- object_name, 'data')
+ object_name, 'data', headers={})
self.assertHeaders(resp, 'Object', 'PUT')
diff --git a/tempest/api/object_storage/test_container_acl_negative.py b/tempest/api/object_storage/test_container_acl_negative.py
index fed4549..138d25a 100644
--- a/tempest/api/object_storage/test_container_acl_negative.py
+++ b/tempest/api/object_storage/test_container_acl_negative.py
@@ -43,13 +43,13 @@
# trying to create object with empty headers
# X-Auth-Token is not provided
object_name = data_utils.rand_name(name='Object')
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=None
)
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.create_object,
- self.container_name, object_name, 'data')
+ self.object_client.create_object,
+ self.container_name, object_name, 'data', headers={})
@test.attr(type=['negative', 'gate'])
def test_delete_object_without_using_creds(self):
@@ -59,12 +59,12 @@
object_name, 'data')
# trying to delete object with empty headers
# X-Auth-Token is not provided
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=None
)
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.delete_object,
+ self.object_client.delete_object,
self.container_name, object_name)
@test.attr(type=['negative', 'gate'])
@@ -73,13 +73,13 @@
# User provided token is forbidden. ACL are not set
object_name = data_utils.rand_name(name='Object')
# trying to create object with non-authorized user
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.create_object,
- self.container_name, object_name, 'data')
+ self.object_client.create_object,
+ self.container_name, object_name, 'data', headers={})
@test.attr(type=['negative', 'gate'])
def test_read_object_with_non_authorized_user(self):
@@ -90,12 +90,12 @@
self.container_name, object_name, 'data')
self.assertHeaders(resp, 'Object', 'PUT')
# trying to get object with non authorized user token
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.get_object,
+ self.object_client.get_object,
self.container_name, object_name)
@test.attr(type=['negative', 'gate'])
@@ -107,12 +107,12 @@
self.container_name, object_name, 'data')
self.assertHeaders(resp, 'Object', 'PUT')
# trying to delete object with non-authorized user token
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.delete_object,
+ self.object_client.delete_object,
self.container_name, object_name)
@test.attr(type=['negative', 'smoke'])
@@ -130,12 +130,12 @@
object_name, 'data')
self.assertHeaders(resp, 'Object', 'PUT')
# Trying to read the object without rights
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.get_object,
+ self.object_client.get_object,
self.container_name, object_name)
@test.attr(type=['negative', 'smoke'])
@@ -148,15 +148,15 @@
metadata_prefix='')
self.assertHeaders(resp_meta, 'Container', 'POST')
# Trying to write the object without rights
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
object_name = data_utils.rand_name(name='Object')
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.create_object,
+ self.object_client.create_object,
self.container_name,
- object_name, 'data')
+ object_name, 'data', headers={})
@test.attr(type=['negative', 'smoke'])
def test_write_object_without_write_rights(self):
@@ -170,15 +170,15 @@
metadata_prefix='')
self.assertHeaders(resp_meta, 'Container', 'POST')
# Trying to write the object without write rights
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
object_name = data_utils.rand_name(name='Object')
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.create_object,
+ self.object_client.create_object,
self.container_name,
- object_name, 'data')
+ object_name, 'data', headers={})
@test.attr(type=['negative', 'smoke'])
def test_delete_object_without_write_rights(self):
@@ -197,11 +197,11 @@
object_name, 'data')
self.assertHeaders(resp, 'Object', 'PUT')
# Trying to delete the object without write rights
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.delete_object,
+ self.object_client.delete_object,
self.container_name,
object_name)
diff --git a/tempest/api/object_storage/test_container_staticweb.py b/tempest/api/object_storage/test_container_staticweb.py
index 5c4e0bf..a8e5f9a 100644
--- a/tempest/api/object_storage/test_container_staticweb.py
+++ b/tempest/api/object_storage/test_container_staticweb.py
@@ -17,6 +17,7 @@
from tempest.api.object_storage import base
from tempest.common import custom_matchers
from tempest.common.utils import data_utils
+from tempest import exceptions
from tempest import test
@@ -58,15 +59,16 @@
self.container_name, metadata=headers)
# Maintain original headers, no auth added
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=None
)
# test GET on http://account_url/container_name
# we should retrieve the self.object_name file
- resp, body = self.custom_account_client.request("GET",
- self.container_name)
+ resp, body = self.account_client.request("GET",
+ self.container_name,
+ headers={})
# This request is equivalent to GET object
self.assertHeaders(resp, 'Object', 'GET')
self.assertEqual(body, self.object_data)
@@ -89,8 +91,9 @@
# test GET on http://account_url/container_name
# we should retrieve a listing of objects
- resp, body = self.custom_account_client.request("GET",
- self.container_name)
+ resp, body = self.account_client.request("GET",
+ self.container_name,
+ headers={})
# The target of the request is not any Swift resource. Therefore, the
# existence of response header is checked without a custom matcher.
self.assertIn('content-length', resp)
@@ -120,15 +123,16 @@
self.container_name, metadata=headers)
# Maintain original headers, no auth added
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=None
)
# test GET on http://account_url/container_name
# we should retrieve a listing of objects
- resp, body = self.custom_account_client.request("GET",
- self.container_name)
+ resp, body = self.account_client.request("GET",
+ self.container_name,
+ headers={})
self.assertIn(self.object_name, body)
css = '<link rel="stylesheet" type="text/css" href="listings.css" />'
self.assertIn(css, body)
@@ -150,13 +154,12 @@
object_data_404)
# Do not set auth in HTTP headers for next request
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=None
)
# Request non-existing object
- resp, body = self.custom_object_client.get_object(self.container_name,
- "notexisting")
- self.assertEqual(resp['status'], '404')
- self.assertEqual(body, object_data_404)
+ self.assertRaises(
+ exceptions.NotFound, self.object_client.get_object,
+ self.container_name, "notexisting")
diff --git a/tempest/api/object_storage/test_object_services.py b/tempest/api/object_storage/test_object_services.py
index f78220c..cbca5e8 100644
--- a/tempest/api/object_storage/test_object_services.py
+++ b/tempest/api/object_storage/test_object_services.py
@@ -177,7 +177,7 @@
object_name = data_utils.rand_name(name='TestObject')
data = data_utils.arbitrary_string()
metadata = {'Expect': '100-continue'}
- resp = self.custom_object_client.create_object_continue(
+ resp = self.object_client.create_object_continue(
self.container_name,
object_name,
data,
@@ -186,7 +186,7 @@
self.assertIn('status', resp)
self.assertEqual(resp['status'], '100')
- self.custom_object_client.create_object_continue(
+ self.object_client.create_object_continue(
self.container_name,
object_name,
data,
@@ -1014,11 +1014,11 @@
self.assertEqual(resp_meta['x-container-read'], '.r:*,.rlistings')
# trying to get object with empty headers as it is public readable
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=None
)
- resp, body = self.custom_object_client.get_object(
+ resp, body = self.object_client.get_object(
self.container_name, object_name)
self.assertHeaders(resp, 'Object', 'GET')
@@ -1052,12 +1052,12 @@
# get auth token of alternative user
alt_auth_data = self.identity_client_alt.auth_provider.auth_data
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=alt_auth_data
)
# access object using alternate user creds
- resp, body = self.custom_object_client.get_object(
+ resp, body = self.object_client.get_object(
self.container_name, object_name)
self.assertHeaders(resp, 'Object', 'GET')
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index 6896362..21f2578 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -113,9 +113,9 @@
def _create_image(cls, name_start='image-heat-', container_format='bare',
disk_format='iso'):
image_name = data_utils.rand_name(name_start)
- _, body = cls.images_v2_client.create_image(image_name,
- container_format,
- disk_format)
+ body = cls.images_v2_client.create_image(image_name,
+ container_format,
+ disk_format)
image_id = body['id']
cls.images.append(image_id)
return body
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 50bab56..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,
@@ -100,10 +100,10 @@
# Admin can delete the resource quota set for a tenant
tenant_name = data_utils.rand_name('quota_tenant_')
identity_client = self.os_adm.identity_client
- tenant = identity_client.create_tenant(tenant_name)[1]
+ 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/clients.py b/tempest/clients.py
index 99339c1..de03f1d 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -14,7 +14,7 @@
# under the License.
from tempest import auth
-from tempest.common import rest_client
+from tempest.common import negative_rest_client
from tempest import config
from tempest import manager
from tempest.openstack.common import log as logging
@@ -83,12 +83,8 @@
MessagingClientJSON
from tempest.services.network.json.network_client import NetworkClientJSON
from tempest.services.object_storage.account_client import AccountClient
-from tempest.services.object_storage.account_client import \
- AccountClientCustomizedHeader
from tempest.services.object_storage.container_client import ContainerClient
from tempest.services.object_storage.object_client import ObjectClient
-from tempest.services.object_storage.object_client import \
- ObjectClientCustomizedHeader
from tempest.services.orchestration.json.orchestration_client import \
OrchestrationClient
from tempest.services.telemetry.json.telemetry_client import \
@@ -143,9 +139,9 @@
# super cares for credentials validation
super(Manager, self).__init__(credentials=credentials)
- self._set_compute_clients(self.interface)
- self._set_identity_clients(self.interface)
- self._set_volume_clients(self.interface)
+ self._set_compute_clients()
+ self._set_identity_clients()
+ self._set_volume_clients()
self.baremetal_client = BaremetalClientJSON(self.auth_provider)
self.network_client = NetworkClientJSON(self.auth_provider)
@@ -157,7 +153,7 @@
if CONF.service_available.ceilometer:
self.telemetry_client = TelemetryClientJSON(
self.auth_provider)
- self.negative_client = rest_client.NegativeRestClient(
+ self.negative_client = negative_rest_client.NegativeRestClient(
self.auth_provider, service)
# TODO(andreaf) EC2 client still do their auth, v2 only
@@ -177,24 +173,15 @@
self.auth_provider)
self.ec2api_client = botoclients.APIClientEC2(*ec2_client_args)
self.s3_client = botoclients.ObjectClientS3(*ec2_client_args)
- self.custom_object_client = ObjectClientCustomizedHeader(
- self.auth_provider)
- self.custom_account_client = \
- AccountClientCustomizedHeader(self.auth_provider)
self.data_processing_client = DataProcessingClient(
self.auth_provider)
- def _set_compute_clients(self, type):
- self._set_compute_json_clients()
-
- # Common compute clients
+ def _set_compute_clients(self):
self.agents_client = AgentsClientJSON(self.auth_provider)
self.networks_client = NetworksClientJSON(self.auth_provider)
self.migrations_client = MigrationsClientJSON(self.auth_provider)
self.security_group_default_rules_client = (
SecurityGroupDefaultRulesClientJSON(self.auth_provider))
-
- def _set_compute_json_clients(self):
self.certificates_client = CertificatesClientJSON(self.auth_provider)
self.servers_client = ServersClientJSON(self.auth_provider)
self.limits_client = LimitsClientJSON(self.auth_provider)
@@ -221,10 +208,7 @@
self.instance_usages_audit_log_client = \
InstanceUsagesAuditLogClientJSON(self.auth_provider)
- def _set_identity_clients(self, type):
- self._set_identity_json_clients()
-
- def _set_identity_json_clients(self):
+ def _set_identity_clients(self):
self.identity_client = IdentityClientJSON(self.auth_provider)
self.identity_v3_client = IdentityV3ClientJSON(self.auth_provider)
self.endpoints_client = EndPointClientJSON(self.auth_provider)
@@ -236,20 +220,12 @@
self.token_v3_client = V3TokenClientJSON()
self.credentials_client = CredentialsClientJSON(self.auth_provider)
- def _set_volume_clients(self, type):
- self._set_volume_json_clients()
- # Common volume clients
- # NOTE : As XML clients are not implemented for Qos-specs.
- # So, setting the qos_client here. Once client are implemented,
- # qos_client would be moved to its respective if/else.
- # Bug : 1312553
+ def _set_volume_clients(self):
self.volume_qos_client = QosSpecsClientJSON(self.auth_provider)
self.volume_qos_v2_client = QosSpecsV2ClientJSON(
self.auth_provider)
self.volume_services_v2_client = VolumesServicesV2ClientJSON(
self.auth_provider)
-
- def _set_volume_json_clients(self):
self.backups_client = BackupsClientJSON(self.auth_provider)
self.backups_v2_client = BackupsClientV2JSON(self.auth_provider)
self.snapshots_client = SnapshotsClientJSON(self.auth_provider)
diff --git a/tempest/cmd/cleanup.py b/tempest/cmd/cleanup.py
index 28f0aa8..28992b9 100755
--- a/tempest/cmd/cleanup.py
+++ b/tempest/cmd/cleanup.py
@@ -180,7 +180,7 @@
CONF.identity.admin_username)
self.admin_id = user['id']
- _, roles = id_cl.list_roles()
+ roles = id_cl.list_roles()
for role in roles:
if role['name'] == CONF.identity.admin_role:
self.admin_role_id = role['id']
@@ -215,7 +215,7 @@
def _add_admin(self, tenant_id):
id_cl = self.admin_mgr.identity_client
needs_role = True
- _, roles = id_cl.list_user_roles(tenant_id, self.admin_id)
+ roles = id_cl.list_user_roles(tenant_id, self.admin_id)
for role in roles:
if role['id'] == self.admin_role_id:
needs_role = False
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index db862c7..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
@@ -845,7 +845,7 @@
def list(self):
client = self.client
- _, images = client.list_images({"all_tenants": True})
+ images = client.list_images({"all_tenants": True})
if not self.is_save_state:
images = [image for image in images if image['id']
not in self.saved_state_json['images'].keys()]
@@ -886,7 +886,7 @@
def list(self):
client = self.client
- _, users = client.get_users()
+ users = client.get_users()
if not self.is_save_state:
users = [user for user in users if user['id']
@@ -929,7 +929,7 @@
def list(self):
client = self.client
try:
- _, roles = client.list_roles()
+ roles = client.list_roles()
# reconcile roles with saved state and never list admin role
if not self.is_save_state:
roles = [role for role in roles if
@@ -967,7 +967,7 @@
def list(self):
client = self.client
- _, tenants = client.list_tenants()
+ tenants = client.list_tenants()
if not self.is_save_state:
tenants = [tenant for tenant in tenants if (tenant['id']
not in self.saved_state_json['tenants'].keys()
@@ -1009,7 +1009,7 @@
def list(self):
client = self.client
- _, domains = client.list_domains()
+ domains = client.list_domains()
if not self.is_save_state:
domains = [domain for domain in domains if domain['id']
not in self.saved_state_json['domains'].keys()]
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index c7ec359..6e1ca7a 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -196,7 +196,7 @@
Don't create the tenants if they already exist.
"""
admin = keystone_admin()
- _, body = admin.identity.list_tenants()
+ body = admin.identity.list_tenants()
existing = [x['name'] for x in body]
for tenant in tenants:
if tenant not in existing:
@@ -209,7 +209,7 @@
admin = keystone_admin()
for tenant in tenants:
tenant_id = admin.identity.get_tenant_by_name(tenant)['id']
- r, body = admin.identity.delete_tenant(tenant_id)
+ admin.identity.delete_tenant(tenant_id)
##############
#
@@ -237,7 +237,7 @@
def _assign_swift_role(user):
admin = keystone_admin()
- resp, roles = admin.identity.list_roles()
+ roles = admin.identity.list_roles()
role = next(r for r in roles if r['name'] == 'Member')
LOG.debug(USERS[user])
try:
@@ -281,7 +281,7 @@
tenant_id = admin.identity.get_tenant_by_name(user['tenant'])['id']
user_id = admin.identity.get_user_by_username(tenant_id,
user['name'])['id']
- r, body = admin.identity.delete_user(user_id)
+ admin.identity.delete_user(user_id)
def collect_users(users):
@@ -345,7 +345,7 @@
LOG.info("checking users")
for name, user in self.users.iteritems():
client = keystone_admin()
- _, found = client.identity.get_user(user['id'])
+ found = client.identity.get_user(user['id'])
self.assertEqual(found['name'], user['name'])
self.assertEqual(found['tenantId'], user['tenant_id'])
@@ -528,7 +528,7 @@
def _get_image_by_name(client, name):
- r, body = client.images.image_list()
+ body = client.images.image_list()
for image in body:
if name == image['name']:
return image
@@ -551,19 +551,19 @@
extras = {}
if image['format'] == 'ami':
name, fname = _resolve_image(image, 'aki')
- r, aki = client.images.create_image(
+ aki = client.images.create_image(
'javelin_' + name, 'aki', 'aki')
client.images.store_image(aki.get('id'), open(fname, 'r'))
extras['kernel_id'] = aki.get('id')
name, fname = _resolve_image(image, 'ari')
- r, ari = client.images.create_image(
+ ari = client.images.create_image(
'javelin_' + name, 'ari', 'ari')
client.images.store_image(ari.get('id'), open(fname, 'r'))
extras['ramdisk_id'] = ari.get('id')
_, fname = _resolve_image(image, 'file')
- r, body = client.images.create_image(
+ body = client.images.create_image(
image['name'], image['format'], image['format'], **extras)
image_id = body.get('id')
client.images.store_image(image_id, open(fname, 'r'))
@@ -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 abf8fc3..a7e0ee3 100755
--- a/tempest/cmd/verify_tempest_config.py
+++ b/tempest/cmd/verify_tempest_config.py
@@ -59,7 +59,7 @@
def verify_glance_api_versions(os, update):
# Check glance api versions
- __, versions = os.image_client.get_versions()
+ versions = os.image_client.get_versions()
if CONF.image_feature_enabled.api_v1 != ('v1.1' in versions or 'v1.0' in
versions):
print_and_or_update('api_v1', 'image_feature_enabled',
@@ -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/isolated_creds.py b/tempest/common/isolated_creds.py
index 9a9ef82..a663931 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -52,26 +52,26 @@
return os.identity_client, os.network_client
def _create_tenant(self, name, description):
- _, tenant = self.identity_admin_client.create_tenant(
+ tenant = self.identity_admin_client.create_tenant(
name=name, description=description)
return tenant
def _get_tenant_by_name(self, name):
- _, tenant = self.identity_admin_client.get_tenant_by_name(name)
+ tenant = self.identity_admin_client.get_tenant_by_name(name)
return tenant
def _create_user(self, username, password, tenant, email):
- _, user = self.identity_admin_client.create_user(
+ user = self.identity_admin_client.create_user(
username, password, tenant['id'], email)
return user
def _get_user(self, tenant, username):
- _, user = self.identity_admin_client.get_user_by_username(
+ user = self.identity_admin_client.get_user_by_username(
tenant['id'], username)
return user
def _list_roles(self):
- _, roles = self.identity_admin_client.list_roles()
+ roles = self.identity_admin_client.list_roles()
return roles
def _assign_user_role(self, tenant, user, role_name):
@@ -124,6 +124,8 @@
self._assign_user_role(tenant, user, swift_operator_role)
if admin:
self._assign_user_role(tenant, user, CONF.identity.admin_role)
+ for role in CONF.auth.tempest_roles:
+ self._assign_user_role(tenant, user, role)
return self._get_credentials(user, tenant)
def _get_credentials(self, user, tenant):
diff --git a/tempest/common/negative_rest_client.py b/tempest/common/negative_rest_client.py
new file mode 100644
index 0000000..a9ae1c3
--- /dev/null
+++ b/tempest/common/negative_rest_client.py
@@ -0,0 +1,72 @@
+# (c) 2014 Deutsche Telekom AG
+# Copyright 2014 Red Hat, Inc.
+# Copyright 2014 NEC Corporation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.common import rest_client
+from tempest import config
+
+CONF = config.CONF
+
+
+class NegativeRestClient(rest_client.RestClient):
+ """
+ Version of RestClient that does not raise exceptions.
+ """
+
+ def __init__(self, auth_provider, service):
+ region = self._get_region(service)
+ super(NegativeRestClient, self).__init__(auth_provider,
+ service, region)
+
+ def _get_region(self, service):
+ """
+ Returns the region for a specific service
+ """
+ service_region = None
+ for cfgname in dir(CONF._config):
+ # Find all config.FOO.catalog_type and assume FOO is a service.
+ cfg = getattr(CONF, cfgname)
+ catalog_type = getattr(cfg, 'catalog_type', None)
+ if catalog_type == service:
+ service_region = getattr(cfg, 'region', None)
+ if not service_region:
+ service_region = CONF.identity.region
+ return service_region
+
+ def _error_checker(self, method, url,
+ headers, body, resp, resp_body):
+ pass
+
+ def send_request(self, method, url_template, resources, body=None):
+ url = url_template % tuple(resources)
+ if method == "GET":
+ resp, body = self.get(url)
+ elif method == "POST":
+ resp, body = self.post(url, body)
+ elif method == "PUT":
+ resp, body = self.put(url, body)
+ elif method == "PATCH":
+ resp, body = self.patch(url, body)
+ elif method == "HEAD":
+ resp, body = self.head(url)
+ elif method == "DELETE":
+ resp, body = self.delete(url)
+ elif method == "COPY":
+ resp, body = self.copy(url)
+ else:
+ assert False
+
+ return resp, body
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index ca87a75..c5696b7 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -25,12 +25,9 @@
from tempest.common import http
from tempest.common.utils import misc as misc_utils
-from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
-CONF = config.CONF
-
# redrive rate limited calls at most twice
MAX_RECURSION_DEPTH = 2
@@ -38,53 +35,24 @@
HTTP_SUCCESS = (200, 201, 202, 203, 204, 205, 206, 207)
-class ResponseBody(dict):
- """Class that wraps an http response and dict body into a single value.
-
- Callers that receive this object will normally use it as a dict but
- can extract the response if needed.
- """
-
- def __init__(self, response, body=None):
- body_data = body or {}
- self.update(body_data)
- self.response = response
-
- def __str__(self):
- body = super.__str__(self)
- return "response: %s\nBody: %s" % (self.response, body)
-
-
-class ResponseBodyList(list):
- """Class that wraps an http response and list body into a single value.
-
- Callers that receive this object will normally use it as a list but
- can extract the response if needed.
- """
-
- def __init__(self, response, body=None):
- body_data = body or []
- self.extend(body_data)
- self.response = response
-
- def __str__(self):
- body = super.__str__(self)
- return "response: %s\nBody: %s" % (self.response, body)
-
-
class RestClient(object):
TYPE = "json"
LOG = logging.getLogger(__name__)
- def __init__(self, auth_provider, service, endpoint_type='publicURL',
- build_interval=1, build_timeout=60):
+ def __init__(self, auth_provider, service, region,
+ endpoint_type='publicURL',
+ build_interval=1, build_timeout=60,
+ disable_ssl_certificate_validation=False, ca_certs=None,
+ trace_requests=''):
self.auth_provider = auth_provider
self.service = service
+ self.region = region
self.endpoint_type = endpoint_type
self.build_interval = build_interval
self.build_timeout = build_timeout
+ self.trace_requests = trace_requests
# The version of the API this client implements
self.api_version = None
@@ -97,8 +65,7 @@
'location', 'proxy-authenticate',
'retry-after', 'server',
'vary', 'www-authenticate'))
- dscv = CONF.identity.disable_ssl_certificate_validation
- ca_certs = CONF.identity.ca_certificates_file
+ dscv = disable_ssl_certificate_validation
self.http_obj = http.ClosingHttp(
disable_ssl_certificate_validation=dscv, ca_certs=ca_certs)
@@ -115,30 +82,15 @@
def __str__(self):
STRING_LIMIT = 80
- str_format = ("config:%s, service:%s, base_url:%s, "
+ str_format = ("service:%s, base_url:%s, "
"filters: %s, build_interval:%s, build_timeout:%s"
"\ntoken:%s..., \nheaders:%s...")
- return str_format % (CONF, self.service, self.base_url,
+ return str_format % (self.service, self.base_url,
self.filters, self.build_interval,
self.build_timeout,
str(self.token)[0:STRING_LIMIT],
str(self.get_headers())[0:STRING_LIMIT])
- def _get_region(self, service):
- """
- Returns the region for a specific service
- """
- service_region = None
- for cfgname in dir(CONF._config):
- # Find all config.FOO.catalog_type and assume FOO is a service.
- cfg = getattr(CONF, cfgname)
- catalog_type = getattr(cfg, 'catalog_type', None)
- if catalog_type == service:
- service_region = getattr(cfg, 'region', None)
- if not service_region:
- service_region = CONF.identity.region
- return service_region
-
@property
def user(self):
return self.auth_provider.credentials.username
@@ -172,7 +124,7 @@
_filters = dict(
service=self.service,
endpoint_type=self.endpoint_type,
- region=self._get_region(self.service)
+ region=self.region
)
if self.api_version is not None:
_filters['api_version'] = self.api_version
@@ -266,8 +218,7 @@
if req_headers is None:
req_headers = {}
caller_name = misc_utils.find_test_caller()
- trace_regex = CONF.debug.trace_requests
- if trace_regex and re.search(trace_regex, caller_name):
+ if self.trace_requests and re.search(self.trace_requests, caller_name):
self.LOG.debug('Starting Request (%s): %s %s' %
(caller_name, method, req_url))
@@ -344,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):
@@ -388,7 +339,7 @@
# Do the actual request, and time it
start = time.time()
self._log_request_start(method, req_url)
- resp, resp_body = self.http_obj.request(
+ resp, resp_body = self.raw_request(
req_url, method, headers=req_headers, body=req_body)
end = time.time()
self._log_request(method, req_url, resp, secs=(end - start),
@@ -400,6 +351,12 @@
return resp, resp_body
+ def raw_request(self, url, method, headers=None, body=None):
+ if headers is None:
+ headers = self.get_headers()
+ return self.http_obj.request(url, method,
+ headers=headers, body=body)
+
def request(self, method, url, extra_headers=False, headers=None,
body=None):
# if extra_headers is True
@@ -494,6 +451,11 @@
else:
raise exceptions.RateLimitExceeded(resp_body)
+ if resp.status == 415:
+ if parse_resp:
+ resp_body = self._parse_resp(resp_body)
+ raise exceptions.InvalidContentType(resp_body)
+
if resp.status == 422:
if parse_resp:
resp_body = self._parse_resp(resp_body)
@@ -603,33 +565,3 @@
except jsonschema.ValidationError as ex:
msg = ("HTTP response header is invalid (%s)") % ex
raise exceptions.InvalidHTTPResponseHeader(msg)
-
-
-class NegativeRestClient(RestClient):
- """
- Version of RestClient that does not raise exceptions.
- """
- def _error_checker(self, method, url,
- headers, body, resp, resp_body):
- pass
-
- def send_request(self, method, url_template, resources, body=None):
- url = url_template % tuple(resources)
- if method == "GET":
- resp, body = self.get(url)
- elif method == "POST":
- resp, body = self.post(url, body)
- elif method == "PUT":
- resp, body = self.put(url, body)
- elif method == "PATCH":
- resp, body = self.patch(url, body)
- elif method == "HEAD":
- resp, body = self.head(url)
- elif method == "DELETE":
- resp, body = self.delete(url)
- elif method == "COPY":
- resp, body = self.copy(url)
- else:
- assert False
-
- return resp, body
diff --git a/tempest/common/service_client.py b/tempest/common/service_client.py
new file mode 100644
index 0000000..c32a7d0
--- /dev/null
+++ b/tempest/common/service_client.py
@@ -0,0 +1,72 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.common import rest_client
+from tempest import config
+
+CONF = config.CONF
+
+
+class ServiceClient(rest_client.RestClient):
+
+ def __init__(self, auth_provider, service, region,
+ endpoint_type=None, build_interval=None, build_timeout=None):
+ params = {
+ 'disable_ssl_certificate_validation':
+ CONF.identity.disable_ssl_certificate_validation,
+ 'ca_certs': CONF.identity.ca_certificates_file,
+ 'trace_requests': CONF.debug.trace_requests
+ }
+ if endpoint_type is not None:
+ params.update({'endpoint_type': endpoint_type})
+ if build_interval is not None:
+ params.update({'build_interval': build_interval})
+ if build_timeout is not None:
+ params.update({'build_timeout': build_timeout})
+ super(ServiceClient, self).__init__(auth_provider, service, region,
+ **params)
+
+
+class ResponseBody(dict):
+ """Class that wraps an http response and dict body into a single value.
+
+ Callers that receive this object will normally use it as a dict but
+ can extract the response if needed.
+ """
+
+ def __init__(self, response, body=None):
+ body_data = body or {}
+ self.update(body_data)
+ self.response = response
+
+ def __str__(self):
+ body = super.__str__(self)
+ return "response: %s\nBody: %s" % (self.response, body)
+
+
+class ResponseBodyList(list):
+ """Class that wraps an http response and list body into a single value.
+
+ Callers that receive this object will normally use it as a list but
+ can extract the response if needed.
+ """
+
+ def __init__(self, response, body=None):
+ body_data = body or []
+ self.extend(body_data)
+ self.response = response
+
+ def __str__(self):
+ body = super.__str__(self)
+ return "response: %s\nBody: %s" % (self.response, body)
diff --git a/tempest/config.py b/tempest/config.py
index 4f545a3..dd693e5 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -59,6 +59,9 @@
"It requires at least `2 * CONC` distinct accounts "
"configured in `test_accounts_file`, with CONC == the "
"number of concurrent test processes."),
+ cfg.ListOpt('tempest_roles',
+ help="Roles to assign to all users created by tempest",
+ default=[])
]
identity_group = cfg.OptGroup(name='identity',
@@ -187,7 +190,7 @@
default=300,
help="Timeout in seconds to wait for an instance to build. "
"Other services that do not define build_timeout will "
- "inherit this value, for example the image service."),
+ "inherit this value."),
cfg.BoolOpt('run_ssh',
default=False,
help="Should the tests ssh to instances?"),
@@ -371,7 +374,15 @@
cfg.StrOpt('http_image',
default='http://download.cirros-cloud.net/0.3.1/'
'cirros-0.3.1-x86_64-uec.tar.gz',
- help='http accessible image')
+ help='http accessible image'),
+ cfg.IntOpt('build_timeout',
+ default=300,
+ help="Timeout in seconds to wait for an image to "
+ "become available."),
+ cfg.IntOpt('build_interval',
+ default=1,
+ help="Time in seconds between image operation status "
+ "checks.")
]
image_feature_group = cfg.OptGroup(name='image-feature-enabled',
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index a0e6490..1fdd26a 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):
@@ -338,7 +338,7 @@
'is_public': 'False',
}
params.update(properties)
- _, image = self.image_client.create_image(**params)
+ image = self.image_client.create_image(**params)
self.addCleanup(self.image_client.delete_image, image['id'])
self.assertEqual("queued", image['status'])
self.image_client.update_image(image['id'], data=image_file)
@@ -407,7 +407,7 @@
thing_id=image_id, thing_id_param='id',
cleanup_callable=self.delete_wrapper,
cleanup_args=[_image_client.delete_image, image_id])
- _, snapshot_image = _image_client.get_image_meta(image_id)
+ snapshot_image = _image_client.get_image_meta(image_id)
image_name = snapshot_image['name']
self.assertEqual(name, image_name)
LOG.debug("Created snapshot image %s for server %s",
@@ -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,
@@ -1225,7 +1225,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/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index 5e2a9d0..de6b0f9 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -72,6 +72,10 @@
* test that reverse traffic is still blocked
* test than revesre traffic is enabled once an appropriate rule has
been created on source tenant
+ 7._test_port_update_new_security_group:
+ * test that traffic is blocked with default security group
+ * test that traffic is enabled after updating port with new security
+ group having appropriate rule
assumptions:
1. alt_tenant/user existed and is different from primary_tenant/user
@@ -452,7 +456,57 @@
# in-tenant check
self._test_in_tenant_block(self.primary_tenant)
self._test_in_tenant_allow(self.primary_tenant)
+ except Exception:
+ for tenant in self.tenants.values():
+ self._log_console_output(servers=tenant.servers)
+ raise
+ @test.attr(type='smoke')
+ @test.services('compute', 'network')
+ def test_port_update_new_security_group(self):
+ """
+ This test verifies the traffic after updating the vm port with new
+ security group having appropiate rule.
+ """
+ new_tenant = self.primary_tenant
+
+ # Create empty security group and add icmp rule in it
+ new_sg = self._create_empty_security_group(
+ namestart='secgroup_new-',
+ tenant_id=new_tenant.creds.tenant_id,
+ client=new_tenant.manager.network_client)
+ icmp_rule = dict(
+ protocol='icmp',
+ direction='ingress',
+ )
+ self._create_security_group_rule(
+ secgroup=new_sg,
+ client=new_tenant.manager.network_client,
+ **icmp_rule)
+ new_tenant.security_groups.update(new_sg=new_sg)
+
+ # Create server with default security group
+ name = 'server-{tenant}-gen-1-'.format(
+ tenant=new_tenant.creds.tenant_name
+ )
+ name = data_utils.rand_name(name)
+ server = self._create_server(name, new_tenant)
+
+ # Check connectivity failure with default security group
+ try:
+ access_point_ssh = self._connect_to_access_point(new_tenant)
+ self._check_connectivity(access_point=access_point_ssh,
+ ip=self._get_server_ip(server),
+ should_succeed=False)
+ server_id = server['id']
+ port_id = self._list_ports(device_id=server_id)[0]['id']
+
+ # update port with new security group and check connectivity
+ self.network_client.update_port(port_id, security_groups=[
+ new_tenant.security_groups['new_sg'].id])
+ self._check_connectivity(
+ access_point=access_point_ssh,
+ ip=self._get_server_ip(server))
except Exception:
for tenant in self.tenants.values():
self._log_console_output(servers=tenant.servers)
diff --git a/tempest/scenario/test_swift_basic_ops.py b/tempest/scenario/test_swift_basic_ops.py
index 312fbc6..660b586 100644
--- a/tempest/scenario/test_swift_basic_ops.py
+++ b/tempest/scenario/test_swift_basic_ops.py
@@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.common import http
from tempest import config
from tempest.openstack.common import log as logging
from tempest.scenario import manager
@@ -65,12 +64,9 @@
obj_name, _ = self.upload_object_to_container(container_name)
obj_url = '%s/%s/%s' % (self.object_client.base_url,
container_name, obj_name)
- dscv = CONF.identity.disable_ssl_certificate_validation
- ca_certs = CONF.identity.ca_certificates_file
- http_client = http.ClosingHttp(
- disable_ssl_certificate_validation=dscv, ca_certs=ca_certs)
- resp, _ = http_client.request(obj_url, 'GET')
+ resp, _ = self.object_client.raw_request(obj_url, 'GET')
self.assertEqual(resp.status, 401)
+
self.change_container_acl(container_name, '.r:*')
- resp, _ = http_client.request(obj_url, 'GET')
+ resp, _ = self.object_client.raw_request(obj_url, 'GET')
self.assertEqual(resp.status, 200)
diff --git a/tempest/services/baremetal/base.py b/tempest/services/baremetal/base.py
index 4bcf2aa..a0ffd28 100644
--- a/tempest/services/baremetal/base.py
+++ b/tempest/services/baremetal/base.py
@@ -16,7 +16,7 @@
import six
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
CONF = config.CONF
@@ -42,7 +42,7 @@
return wrapper
-class BaremetalClient(rest_client.RestClient):
+class BaremetalClient(service_client.ServiceClient):
"""
Base Tempest REST client for Ironic API.
@@ -50,7 +50,9 @@
def __init__(self, auth_provider):
super(BaremetalClient, self).__init__(
- auth_provider, CONF.baremetal.catalog_type,
+ auth_provider,
+ CONF.baremetal.catalog_type,
+ CONF.identity.region,
endpoint_type=CONF.baremetal.endpoint_type)
self.uri_prefix = ''
diff --git a/tempest/services/compute/json/base.py b/tempest/services/compute/json/base.py
index 9187cc4..ae44ffb 100644
--- a/tempest/services/compute/json/base.py
+++ b/tempest/services/compute/json/base.py
@@ -12,13 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
CONF = config.CONF
-class ComputeClient(rest_client.RestClient):
+class ComputeClient(service_client.ServiceClient):
"""
Base compute client class
"""
@@ -33,6 +33,7 @@
super(ComputeClient, self).__init__(
auth_provider,
CONF.compute.catalog_type,
+ CONF.compute.region or CONF.identity.region,
endpoint_type=CONF.compute.endpoint_type,
build_interval=build_interval,
build_timeout=build_timeout)
diff --git a/tempest/services/data_processing/v1_1/client.py b/tempest/services/data_processing/v1_1/client.py
index 6004b22..55b6be6 100644
--- a/tempest/services/data_processing/v1_1/client.py
+++ b/tempest/services/data_processing/v1_1/client.py
@@ -14,17 +14,19 @@
import json
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
CONF = config.CONF
-class DataProcessingClient(rest_client.RestClient):
+class DataProcessingClient(service_client.ServiceClient):
def __init__(self, auth_provider):
super(DataProcessingClient, self).__init__(
- auth_provider, CONF.data_processing.catalog_type,
+ auth_provider,
+ CONF.data_processing.catalog_type,
+ CONF.identity.region,
endpoint_type=CONF.data_processing.endpoint_type)
def _request_and_check_resp(self, request_func, uri, resp_status):
diff --git a/tempest/services/database/json/flavors_client.py b/tempest/services/database/json/flavors_client.py
index a57b045..9a27443 100644
--- a/tempest/services/database/json/flavors_client.py
+++ b/tempest/services/database/json/flavors_client.py
@@ -15,17 +15,19 @@
import urllib
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
CONF = config.CONF
-class DatabaseFlavorsClientJSON(rest_client.RestClient):
+class DatabaseFlavorsClientJSON(service_client.ServiceClient):
def __init__(self, auth_provider):
super(DatabaseFlavorsClientJSON, self).__init__(
- auth_provider, CONF.database.catalog_type)
+ auth_provider,
+ CONF.database.catalog_type,
+ CONF.identity.region)
def list_db_flavors(self, params=None):
url = 'flavors'
diff --git a/tempest/services/database/json/versions_client.py b/tempest/services/database/json/versions_client.py
index 911b55d..f5c5217 100644
--- a/tempest/services/database/json/versions_client.py
+++ b/tempest/services/database/json/versions_client.py
@@ -15,17 +15,19 @@
import urllib
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
CONF = config.CONF
-class DatabaseVersionsClientJSON(rest_client.RestClient):
+class DatabaseVersionsClientJSON(service_client.ServiceClient):
def __init__(self, auth_provider):
super(DatabaseVersionsClientJSON, self).__init__(
- auth_provider, CONF.database.catalog_type)
+ auth_provider,
+ CONF.database.catalog_type,
+ CONF.identity.region)
self.skip_path()
def list_db_versions(self, params=None):
diff --git a/tempest/services/identity/json/identity_client.py b/tempest/services/identity/json/identity_client.py
index c91b63e..a6c5049 100644
--- a/tempest/services/identity/json/identity_client.py
+++ b/tempest/services/identity/json/identity_client.py
@@ -12,19 +12,21 @@
import json
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
from tempest import exceptions
CONF = config.CONF
-class IdentityClientJSON(rest_client.RestClient):
+class IdentityClientJSON(service_client.ServiceClient):
def __init__(self, auth_provider):
- super(IdentityClientJSON, self).__init__(auth_provider,
- CONF.identity.catalog_type,
- endpoint_type='adminURL')
+ super(IdentityClientJSON, self).__init__(
+ auth_provider,
+ CONF.identity.catalog_type,
+ CONF.identity.region,
+ endpoint_type='adminURL')
def has_admin_extensions(self):
"""
@@ -49,14 +51,14 @@
post_body = json.dumps({'role': post_body})
resp, body = self.post('OS-KSADM/roles', post_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def get_role(self, role_id):
"""Get a role by its id."""
resp, body = self.get('OS-KSADM/roles/%s' % role_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['role']
+ return service_client.ResponseBody(resp, body['role'])
def create_tenant(self, name, **kwargs):
"""
@@ -73,7 +75,7 @@
post_body = json.dumps({'tenant': post_body})
resp, body = self.post('tenants', 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_role(self, role_id):
"""Delete a role."""
@@ -86,49 +88,49 @@
url = '/tenants/%s/users/%s/roles' % (tenant_id, user_id)
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBodyList(resp, self._parse_resp(body))
def assign_user_role(self, tenant_id, user_id, role_id):
"""Add roles to a user on a tenant."""
resp, body = self.put('/tenants/%s/users/%s/roles/OS-KSADM/%s' %
(tenant_id, user_id, role_id), "")
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def remove_user_role(self, tenant_id, user_id, role_id):
"""Removes a role assignment for a user on a tenant."""
resp, body = self.delete('/tenants/%s/users/%s/roles/OS-KSADM/%s' %
(tenant_id, user_id, role_id))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def delete_tenant(self, tenant_id):
"""Delete a tenant."""
resp, body = self.delete('tenants/%s' % str(tenant_id))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_tenant(self, tenant_id):
"""Get tenant details."""
resp, body = self.get('tenants/%s' % str(tenant_id))
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def list_roles(self):
"""Returns roles."""
resp, body = self.get('OS-KSADM/roles')
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBodyList(resp, self._parse_resp(body))
def list_tenants(self):
"""Returns tenants."""
resp, body = self.get('tenants')
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['tenants']
+ return service_client.ResponseBodyList(resp, body['tenants'])
def get_tenant_by_name(self, tenant_name):
- _, tenants = self.list_tenants()
+ tenants = self.list_tenants()
for tenant in tenants:
if tenant['name'] == tenant_name:
return tenant
@@ -136,7 +138,7 @@
def update_tenant(self, tenant_id, **kwargs):
"""Updates a tenant."""
- _, body = self.get_tenant(tenant_id)
+ body = self.get_tenant(tenant_id)
name = kwargs.get('name', body['name'])
desc = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
@@ -149,7 +151,7 @@
post_body = json.dumps({'tenant': post_body})
resp, body = self.post('tenants/%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 create_user(self, name, password, tenant_id, email, **kwargs):
"""Create a user."""
@@ -165,32 +167,32 @@
post_body = json.dumps({'user': post_body})
resp, body = self.post('users', post_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def update_user(self, user_id, **kwargs):
"""Updates a user."""
put_body = json.dumps({'user': kwargs})
resp, body = self.put('users/%s' % user_id, put_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def get_user(self, user_id):
"""GET a user."""
resp, body = self.get("users/%s" % user_id)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def delete_user(self, user_id):
"""Delete a user."""
resp, body = self.delete("users/%s" % user_id)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_users(self):
"""Get the list of users."""
resp, body = self.get("users")
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBodyList(resp, self._parse_resp(body))
def enable_disable_user(self, user_id, enabled):
"""Enables or disables a user."""
@@ -200,28 +202,28 @@
put_body = json.dumps({'user': put_body})
resp, body = self.put('users/%s/enabled' % user_id, put_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def get_token(self, token_id):
"""Get token details."""
resp, body = self.get("tokens/%s" % token_id)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def delete_token(self, token_id):
"""Delete a token."""
resp, body = self.delete("tokens/%s" % token_id)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_users_for_tenant(self, tenant_id):
"""List users for a Tenant."""
resp, body = self.get('/tenants/%s/users' % tenant_id)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBodyList(resp, self._parse_resp(body))
def get_user_by_username(self, tenant_id, username):
- _, users = self.list_users_for_tenant(tenant_id)
+ users = self.list_users_for_tenant(tenant_id)
for user in users:
if user['name'] == username:
return user
@@ -237,27 +239,27 @@
post_body = json.dumps({'OS-KSADM:service': post_body})
resp, body = self.post('/OS-KSADM/services', post_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def get_service(self, service_id):
"""Get Service."""
url = '/OS-KSADM/services/%s' % service_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 list_services(self):
"""List Service - Returns Services."""
resp, body = self.get('/OS-KSADM/services')
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBodyList(resp, self._parse_resp(body))
def delete_service(self, service_id):
"""Delete Service."""
url = '/OS-KSADM/services/%s' % service_id
resp, body = self.delete(url)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def update_user_password(self, user_id, new_pass):
"""Update User Password."""
@@ -268,14 +270,15 @@
put_body = json.dumps({'user': put_body})
resp, body = self.put('users/%s/OS-KSADM/password' % user_id, put_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def list_extensions(self):
"""List all the extensions."""
resp, body = self.get('/extensions')
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['extensions']['values']
+ return service_client.ResponseBodyList(resp,
+ body['extensions']['values'])
class TokenClientJSON(IdentityClientJSON):
@@ -307,7 +310,7 @@
resp, body = self.post(self.auth_url, body=body)
self.expected_success(200, resp.status)
- return resp, body['access']
+ return service_client.ResponseBody(resp, body['access'])
def auth_token(self, token_id, tenant=None):
creds = {
@@ -325,7 +328,7 @@
resp, body = self.post(self.auth_url, body=body)
self.expected_success(200, resp.status)
- return resp, body['access']
+ return service_client.ResponseBody(resp, body['access'])
def request(self, method, url, extra_headers=False, headers=None,
body=None):
@@ -338,8 +341,8 @@
except (ValueError, TypeError):
headers = self.get_headers(accept_type="json")
- resp, resp_body = self.http_obj.request(url, method,
- headers=headers, body=body)
+ resp, resp_body = self.raw_request(url, method,
+ headers=headers, body=body)
self._log_request(method, url, resp)
if resp.status in [401, 403]:
@@ -357,7 +360,7 @@
"""
Returns (token id, token data) for supplied credentials
"""
- resp, body = self.auth(user, password, tenant)
+ body = self.auth(user, password, tenant)
if auth_data:
return body['token']['id'], body
diff --git a/tempest/services/identity/v3/json/base.py b/tempest/services/identity/v3/json/base.py
index da8e287..cba480a 100644
--- a/tempest/services/identity/v3/json/base.py
+++ b/tempest/services/identity/v3/json/base.py
@@ -12,19 +12,21 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
CONF = config.CONF
-class IdentityV3Client(rest_client.RestClient):
+class IdentityV3Client(service_client.ServiceClient):
"""
Base identity v3 client class
"""
def __init__(self, auth_provider):
- super(IdentityV3Client, self).__init__(auth_provider,
- CONF.identity.catalog_type,
- endpoint_type='adminURL')
+ super(IdentityV3Client, self).__init__(
+ auth_provider,
+ CONF.identity.catalog_type,
+ CONF.identity.region,
+ endpoint_type='adminURL')
self.api_version = "v3"
diff --git a/tempest/services/identity/v3/json/credentials_client.py b/tempest/services/identity/v3/json/credentials_client.py
index 83918f6..1289e48 100644
--- a/tempest/services/identity/v3/json/credentials_client.py
+++ b/tempest/services/identity/v3/json/credentials_client.py
@@ -15,7 +15,7 @@
import json
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest.services.identity.v3.json import base
@@ -36,7 +36,7 @@
self.expected_success(201, resp.status)
body = json.loads(body)
body['credential']['blob'] = json.loads(body['credential']['blob'])
- return rest_client.ResponseBody(resp, body['credential'])
+ return service_client.ResponseBody(resp, body['credential'])
def update_credential(self, credential_id, **kwargs):
"""Updates a credential."""
@@ -59,7 +59,7 @@
self.expected_success(200, resp.status)
body = json.loads(body)
body['credential']['blob'] = json.loads(body['credential']['blob'])
- return rest_client.ResponseBody(resp, body['credential'])
+ return service_client.ResponseBody(resp, body['credential'])
def get_credential(self, credential_id):
"""To GET Details of a credential."""
@@ -67,17 +67,17 @@
self.expected_success(200, resp.status)
body = json.loads(body)
body['credential']['blob'] = json.loads(body['credential']['blob'])
- return rest_client.ResponseBody(resp, body['credential'])
+ return service_client.ResponseBody(resp, body['credential'])
def list_credentials(self):
"""Lists out all the available credentials."""
resp, body = self.get('credentials')
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['credentials'])
+ return service_client.ResponseBodyList(resp, body['credentials'])
def delete_credential(self, credential_id):
"""Deletes a credential."""
resp, body = self.delete('credentials/%s' % credential_id)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/identity/v3/json/endpoints_client.py b/tempest/services/identity/v3/json/endpoints_client.py
index 59bfa8c..d71836e 100644
--- a/tempest/services/identity/v3/json/endpoints_client.py
+++ b/tempest/services/identity/v3/json/endpoints_client.py
@@ -15,7 +15,7 @@
import json
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest.services.identity.v3.json import base
@@ -26,7 +26,7 @@
resp, body = self.get('endpoints')
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['endpoints'])
+ return service_client.ResponseBodyList(resp, body['endpoints'])
def create_endpoint(self, service_id, interface, url, **kwargs):
"""Create endpoint.
@@ -51,7 +51,7 @@
resp, body = self.post('endpoints', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['endpoint'])
+ return service_client.ResponseBody(resp, body['endpoint'])
def update_endpoint(self, endpoint_id, service_id=None, interface=None,
url=None, region=None, enabled=None, **kwargs):
@@ -78,10 +78,10 @@
resp, body = self.patch('endpoints/%s' % endpoint_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['endpoint'])
+ return service_client.ResponseBody(resp, body['endpoint'])
def delete_endpoint(self, endpoint_id):
"""Delete endpoint."""
resp_header, resp_body = self.delete('endpoints/%s' % endpoint_id)
self.expected_success(204, resp_header.status)
- return rest_client.ResponseBody(resp_header, resp_body)
+ return service_client.ResponseBody(resp_header, resp_body)
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index 48ba909..4d333c0 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -16,7 +16,7 @@
import json
import urllib
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
from tempest import exceptions
from tempest.services.identity.v3.json import base
@@ -46,7 +46,7 @@
resp, body = self.post('users', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['user'])
+ return service_client.ResponseBody(resp, body['user'])
def update_user(self, user_id, name, **kwargs):
"""Updates a user."""
@@ -75,7 +75,7 @@
resp, body = self.patch('users/%s' % user_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['user'])
+ return service_client.ResponseBody(resp, body['user'])
def update_user_password(self, user_id, password, original_password):
"""Updates a user password."""
@@ -86,14 +86,14 @@
update_user = json.dumps({'user': update_user})
resp, _ = self.post('users/%s/password' % user_id, update_user)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp)
+ return service_client.ResponseBody(resp)
def list_user_projects(self, user_id):
"""Lists the projects on which a user has roles assigned."""
resp, body = self.get('users/%s/projects' % user_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['projects'])
+ return service_client.ResponseBodyList(resp, body['projects'])
def get_users(self, params=None):
"""Get the list of users."""
@@ -103,20 +103,20 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['users'])
+ return service_client.ResponseBodyList(resp, body['users'])
def get_user(self, user_id):
"""GET a user."""
resp, body = self.get("users/%s" % user_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['user'])
+ return service_client.ResponseBody(resp, body['user'])
def delete_user(self, user_id):
"""Deletes a User."""
resp, body = self.delete("users/%s" % user_id)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def create_project(self, name, **kwargs):
"""Creates a project."""
@@ -133,7 +133,7 @@
resp, body = self.post('projects', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['project'])
+ return service_client.ResponseBody(resp, body['project'])
def list_projects(self, params=None):
url = "projects"
@@ -142,7 +142,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['projects'])
+ return service_client.ResponseBodyList(resp, body['projects'])
def update_project(self, project_id, **kwargs):
body = self.get_project(project_id)
@@ -161,20 +161,20 @@
resp, body = self.patch('projects/%s' % project_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['project'])
+ return service_client.ResponseBody(resp, body['project'])
def get_project(self, project_id):
"""GET a Project."""
resp, body = self.get("projects/%s" % project_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['project'])
+ return service_client.ResponseBody(resp, body['project'])
def delete_project(self, project_id):
"""Delete a project."""
resp, body = self.delete('projects/%s' % str(project_id))
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def create_role(self, name):
"""Create a Role."""
@@ -185,21 +185,21 @@
resp, body = self.post('roles', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['role'])
+ return service_client.ResponseBody(resp, body['role'])
def get_role(self, role_id):
"""GET a Role."""
resp, body = self.get('roles/%s' % str(role_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['role'])
+ return service_client.ResponseBody(resp, body['role'])
def list_roles(self):
"""Get the list of Roles."""
resp, body = self.get("roles")
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBodyList(resp, body['roles'])
def update_role(self, name, role_id):
"""Create a Role."""
@@ -210,20 +210,20 @@
resp, body = self.patch('roles/%s' % str(role_id), post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['role'])
+ return service_client.ResponseBody(resp, body['role'])
def delete_role(self, role_id):
"""Delete a role."""
resp, body = self.delete('roles/%s' % str(role_id))
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def assign_user_role(self, project_id, user_id, role_id):
"""Add roles to a user on a project."""
resp, body = self.put('projects/%s/users/%s/roles/%s' %
(project_id, user_id, role_id), None)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def create_domain(self, name, **kwargs):
"""Creates a domain."""
@@ -238,20 +238,20 @@
resp, body = self.post('domains', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['domain'])
+ return service_client.ResponseBody(resp, body['domain'])
def delete_domain(self, domain_id):
"""Delete a domain."""
resp, body = self.delete('domains/%s' % str(domain_id))
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_domains(self):
"""List Domains."""
resp, body = self.get('domains')
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['domains'])
+ return service_client.ResponseBodyList(resp, body['domains'])
def update_domain(self, domain_id, **kwargs):
"""Updates a domain."""
@@ -268,14 +268,14 @@
resp, body = self.patch('domains/%s' % domain_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['domain'])
+ return service_client.ResponseBody(resp, body['domain'])
def get_domain(self, domain_id):
"""Get Domain details."""
resp, body = self.get('domains/%s' % domain_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['domain'])
+ return service_client.ResponseBody(resp, body['domain'])
def get_token(self, resp_token):
"""Get token details."""
@@ -283,14 +283,14 @@
resp, body = self.get("auth/tokens", headers=headers)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['token'])
+ return service_client.ResponseBody(resp, body['token'])
def delete_token(self, resp_token):
"""Deletes token."""
headers = {'X-Subject-Token': resp_token}
resp, body = self.delete("auth/tokens", headers=headers)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def create_group(self, name, **kwargs):
"""Creates a group."""
@@ -307,14 +307,14 @@
resp, body = self.post('groups', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['group'])
+ return service_client.ResponseBody(resp, body['group'])
def get_group(self, group_id):
"""Get group details."""
resp, body = self.get('groups/%s' % group_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['group'])
+ return service_client.ResponseBody(resp, body['group'])
def update_group(self, group_id, **kwargs):
"""Updates a group."""
@@ -329,54 +329,54 @@
resp, body = self.patch('groups/%s' % group_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['group'])
+ return service_client.ResponseBody(resp, body['group'])
def delete_group(self, group_id):
"""Delete a group."""
resp, body = self.delete('groups/%s' % str(group_id))
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def add_group_user(self, group_id, user_id):
"""Add user into group."""
resp, body = self.put('groups/%s/users/%s' % (group_id, user_id),
None)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_group_users(self, group_id):
"""List users in group."""
resp, body = self.get('groups/%s/users' % group_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['users'])
+ return service_client.ResponseBodyList(resp, body['users'])
def list_user_groups(self, user_id):
"""Lists groups which a user belongs to."""
resp, body = self.get('users/%s/groups' % user_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['groups'])
+ return service_client.ResponseBodyList(resp, body['groups'])
def delete_group_user(self, group_id, user_id):
"""Delete user in group."""
resp, body = self.delete('groups/%s/users/%s' % (group_id, user_id))
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def assign_user_role_on_project(self, project_id, user_id, role_id):
"""Add roles to a user on a project."""
resp, body = self.put('projects/%s/users/%s/roles/%s' %
(project_id, user_id, role_id), None)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def assign_user_role_on_domain(self, domain_id, user_id, role_id):
"""Add roles to a user on a domain."""
resp, body = self.put('domains/%s/users/%s/roles/%s' %
(domain_id, user_id, role_id), None)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_user_roles_on_project(self, project_id, user_id):
"""list roles of a user on a project."""
@@ -384,7 +384,7 @@
(project_id, user_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBodyList(resp, body['roles'])
def list_user_roles_on_domain(self, domain_id, user_id):
"""list roles of a user on a domain."""
@@ -392,35 +392,35 @@
(domain_id, user_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBodyList(resp, body['roles'])
def revoke_role_from_user_on_project(self, project_id, user_id, role_id):
"""Delete role of a user on a project."""
resp, body = self.delete('projects/%s/users/%s/roles/%s' %
(project_id, user_id, role_id))
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def revoke_role_from_user_on_domain(self, domain_id, user_id, role_id):
"""Delete role of a user on a domain."""
resp, body = self.delete('domains/%s/users/%s/roles/%s' %
(domain_id, user_id, role_id))
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def assign_group_role_on_project(self, project_id, group_id, role_id):
"""Add roles to a user on a project."""
resp, body = self.put('projects/%s/groups/%s/roles/%s' %
(project_id, group_id, role_id), None)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def assign_group_role_on_domain(self, domain_id, group_id, role_id):
"""Add roles to a user on a domain."""
resp, body = self.put('domains/%s/groups/%s/roles/%s' %
(domain_id, group_id, role_id), None)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_group_roles_on_project(self, project_id, group_id):
"""list roles of a user on a project."""
@@ -428,7 +428,7 @@
(project_id, group_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBodyList(resp, body['roles'])
def list_group_roles_on_domain(self, domain_id, group_id):
"""list roles of a user on a domain."""
@@ -436,21 +436,21 @@
(domain_id, group_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBodyList(resp, body['roles'])
def revoke_role_from_group_on_project(self, project_id, group_id, role_id):
"""Delete role of a user on a project."""
resp, body = self.delete('projects/%s/groups/%s/roles/%s' %
(project_id, group_id, role_id))
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def revoke_role_from_group_on_domain(self, domain_id, group_id, role_id):
"""Delete role of a user on a domain."""
resp, body = self.delete('domains/%s/groups/%s/roles/%s' %
(domain_id, group_id, role_id))
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def create_trust(self, trustor_user_id, trustee_user_id, project_id,
role_names, impersonation, expires_at):
@@ -468,13 +468,13 @@
resp, body = self.post('OS-TRUST/trusts', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['trust'])
+ return service_client.ResponseBody(resp, body['trust'])
def delete_trust(self, trust_id):
"""Deletes a trust."""
resp, body = self.delete("OS-TRUST/trusts/%s" % trust_id)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def get_trusts(self, trustor_user_id=None, trustee_user_id=None):
"""GET trusts."""
@@ -488,21 +488,21 @@
resp, body = self.get("OS-TRUST/trusts")
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['trusts'])
+ return service_client.ResponseBodyList(resp, body['trusts'])
def get_trust(self, trust_id):
"""GET trust."""
resp, body = self.get("OS-TRUST/trusts/%s" % trust_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['trust'])
+ return service_client.ResponseBody(resp, body['trust'])
def get_trust_roles(self, trust_id):
"""GET roles delegated by a trust."""
resp, body = self.get("OS-TRUST/trusts/%s/roles" % trust_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBodyList(resp, body['roles'])
def get_trust_role(self, trust_id, role_id):
"""GET role delegated by a trust."""
@@ -510,20 +510,20 @@
% (trust_id, role_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['role'])
+ return service_client.ResponseBody(resp, body['role'])
def check_trust_role(self, trust_id, role_id):
"""HEAD Check if role is delegated by a trust."""
resp, body = self.head("OS-TRUST/trusts/%s/roles/%s"
% (trust_id, role_id))
self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
-class V3TokenClientJSON(rest_client.RestClient):
+class V3TokenClientJSON(service_client.ServiceClient):
def __init__(self):
- super(V3TokenClientJSON, self).__init__(None, None)
+ super(V3TokenClientJSON, self).__init__(None, None, None)
auth_url = CONF.identity.uri_v3
if not auth_url:
raise exceptions.InvalidConfiguration('you must specify a v3 uri '
@@ -589,7 +589,7 @@
body = json.dumps(creds)
resp, body = self.post(self.auth_url, body=body)
self.expected_success(201, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def request(self, method, url, extra_headers=False, headers=None,
body=None):
@@ -605,8 +605,8 @@
except (ValueError, TypeError):
headers = self.get_headers(accept_type="json")
- resp, resp_body = self.http_obj.request(url, method,
- headers=headers, body=body)
+ resp, resp_body = self.raw_request(url, method,
+ headers=headers, body=body)
self._log_request(method, url, resp)
if resp.status in [401, 403]:
diff --git a/tempest/services/identity/v3/json/policy_client.py b/tempest/services/identity/v3/json/policy_client.py
index 04374a2..25931c8 100644
--- a/tempest/services/identity/v3/json/policy_client.py
+++ b/tempest/services/identity/v3/json/policy_client.py
@@ -15,7 +15,7 @@
import json
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest.services.identity.v3.json import base
@@ -31,14 +31,14 @@
resp, body = self.post('policies', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['policy'])
+ return service_client.ResponseBody(resp, body['policy'])
def list_policies(self):
"""Lists the policies."""
resp, body = self.get('policies')
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['policies'])
+ return service_client.ResponseBodyList(resp, body['policies'])
def get_policy(self, policy_id):
"""Lists out the given policy."""
@@ -46,7 +46,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['policy'])
+ return service_client.ResponseBody(resp, body['policy'])
def update_policy(self, policy_id, **kwargs):
"""Updates a policy."""
@@ -59,11 +59,11 @@
resp, body = self.patch(url, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['policy'])
+ return service_client.ResponseBody(resp, body['policy'])
def delete_policy(self, policy_id):
"""Deletes the policy."""
url = "policies/%s" % policy_id
resp, body = self.delete(url)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/identity/v3/json/region_client.py b/tempest/services/identity/v3/json/region_client.py
index cab937e..482cbc6 100644
--- a/tempest/services/identity/v3/json/region_client.py
+++ b/tempest/services/identity/v3/json/region_client.py
@@ -16,7 +16,7 @@
import json
import urllib
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest.services.identity.v3.json import base
@@ -37,7 +37,7 @@
resp, body = self.post('regions', req_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['region'])
+ return service_client.ResponseBody(resp, body['region'])
def update_region(self, region_id, **kwargs):
"""Updates a region."""
@@ -50,7 +50,7 @@
resp, body = self.patch('regions/%s' % region_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['region'])
+ return service_client.ResponseBody(resp, body['region'])
def get_region(self, region_id):
"""Get region."""
@@ -58,7 +58,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['region'])
+ return service_client.ResponseBody(resp, body['region'])
def list_regions(self, params=None):
"""List regions."""
@@ -68,10 +68,10 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['regions'])
+ return service_client.ResponseBodyList(resp, body['regions'])
def delete_region(self, region_id):
"""Delete region."""
resp, body = self.delete('regions/%s' % region_id)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/service_client.py
index c6595f6..2e2df13 100644
--- a/tempest/services/identity/v3/json/service_client.py
+++ b/tempest/services/identity/v3/json/service_client.py
@@ -15,7 +15,7 @@
import json
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest.services.identity.v3.json import base
@@ -36,7 +36,7 @@
resp, body = self.patch('services/%s' % service_id, patch_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['service'])
+ return service_client.ResponseBody(resp, body['service'])
def get_service(self, service_id):
"""Get Service."""
@@ -44,7 +44,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['service'])
+ return service_client.ResponseBody(resp, body['service'])
def create_service(self, serv_type, name=None, description=None,
enabled=True):
@@ -58,16 +58,16 @@
resp, body = self.post("services", body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body["service"])
+ return service_client.ResponseBody(resp, body["service"])
def delete_service(self, serv_id):
url = "services/" + serv_id
resp, body = self.delete(url)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_services(self):
resp, body = self.get('services')
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['services'])
+ return service_client.ResponseBodyList(resp, body['services'])
diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/image_client.py
index ba3a814..a7b8f63 100644
--- a/tempest/services/image/v1/json/image_client.py
+++ b/tempest/services/image/v1/json/image_client.py
@@ -21,7 +21,7 @@
import urllib
from tempest.common import glance_http
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest.common.utils import misc as misc_utils
from tempest import config
from tempest import exceptions
@@ -32,13 +32,16 @@
LOG = logging.getLogger(__name__)
-class ImageClientJSON(rest_client.RestClient):
+class ImageClientJSON(service_client.ServiceClient):
def __init__(self, auth_provider):
super(ImageClientJSON, self).__init__(
auth_provider,
CONF.image.catalog_type,
- endpoint_type=CONF.image.endpoint_type)
+ CONF.image.region or CONF.identity.region,
+ endpoint_type=CONF.image.endpoint_type,
+ build_interval=CONF.image.build_interval,
+ build_timeout=CONF.image.build_timeout)
self._http = None
def _image_meta_from_headers(self, headers):
@@ -119,7 +122,7 @@
self._error_checker('POST', '/v1/images', headers, data, resp,
body_iter)
body = json.loads(''.join([c for c in body_iter]))
- return resp, body['image']
+ return service_client.ResponseBody(resp, body['image'])
def _update_with_data(self, image_id, headers, data):
url = '/v1/images/%s' % image_id
@@ -128,7 +131,7 @@
self._error_checker('PUT', url, headers, data,
resp, body_iter)
body = json.loads(''.join([c for c in body_iter]))
- return resp, body['image']
+ return service_client.ResponseBody(resp, body['image'])
@property
def http(self):
@@ -159,7 +162,7 @@
resp, body = self.post('v1/images', None, headers)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body['image']
+ return service_client.ResponseBody(resp, body['image'])
def update_image(self, image_id, name=None, container_format=None,
data=None, properties=None):
@@ -183,13 +186,13 @@
resp, body = self.put(url, data, headers)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['image']
+ return service_client.ResponseBody(resp, body['image'])
def delete_image(self, image_id):
url = 'v1/images/%s' % image_id
resp, body = self.delete(url)
self.expected_success(200, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def image_list(self, **kwargs):
url = 'v1/images'
@@ -200,7 +203,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['images']
+ return service_client.ResponseBodyList(resp, body['images'])
def image_list_detail(self, properties=dict(), changes_since=None,
**kwargs):
@@ -221,19 +224,20 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['images']
+ return service_client.ResponseBodyList(resp, body['images'])
def get_image_meta(self, image_id):
url = 'v1/images/%s' % image_id
resp, __ = self.head(url)
self.expected_success(200, resp.status)
body = self._image_meta_from_headers(resp)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_image(self, image_id):
url = 'v1/images/%s' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
+ # We can't return a ResponseBody because the body is a string
return resp, body
def is_resource_deleted(self, id):
@@ -253,14 +257,14 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_shared_images(self, member_id):
url = 'v1/shared-images/%s' % member_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def add_member(self, member_id, image_id, can_share=False):
url = 'v1/images/%s/members/%s' % (image_id, member_id)
@@ -269,17 +273,17 @@
body = json.dumps({'member': {'can_share': True}})
resp, __ = self.put(url, body)
self.expected_success(204, resp.status)
- return resp
+ return service_client.ResponseBody(resp)
def delete_member(self, member_id, image_id):
url = 'v1/images/%s/members/%s' % (image_id, member_id)
resp, __ = self.delete(url)
self.expected_success(204, resp.status)
- return resp
+ return service_client.ResponseBody(resp)
# NOTE(afazekas): just for the wait function
def _get_image_status(self, image_id):
- resp, meta = self.get_image_meta(image_id)
+ meta = self.get_image_meta(image_id)
status = meta['status']
return status
diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/image_client.py
index 23810f9..4b1d52d 100644
--- a/tempest/services/image/v2/json/image_client.py
+++ b/tempest/services/image/v2/json/image_client.py
@@ -19,20 +19,23 @@
import jsonschema
from tempest.common import glance_http
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
from tempest import exceptions
CONF = config.CONF
-class ImageClientV2JSON(rest_client.RestClient):
+class ImageClientV2JSON(service_client.ServiceClient):
def __init__(self, auth_provider):
super(ImageClientV2JSON, self).__init__(
auth_provider,
CONF.image.catalog_type,
- endpoint_type=CONF.image.endpoint_type)
+ CONF.image.region or CONF.identity.region,
+ endpoint_type=CONF.image.endpoint_type,
+ build_interval=CONF.image.build_interval,
+ build_timeout=CONF.image.build_timeout)
self._http = None
def _get_http(self):
@@ -44,7 +47,7 @@
def _validate_schema(self, body, type='image'):
if type in ['image', 'images']:
- resp, schema = self.get_schema(type)
+ schema = self.get_schema(type)
else:
raise ValueError("%s is not a valid schema type" % type)
@@ -65,7 +68,7 @@
"-json-patch"}
resp, body = self.patch('v2/images/%s' % image_id, data, headers)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def create_image(self, name, container_format, disk_format, **kwargs):
params = {
@@ -87,12 +90,13 @@
resp, body = self.post('v2/images', data)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def delete_image(self, image_id):
url = 'v2/images/%s' % image_id
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
+ return service_client.ResponseBody(resp)
def image_list(self, params=None):
url = 'v2/images'
@@ -104,14 +108,14 @@
self.expected_success(200, resp.status)
body = json.loads(body)
self._validate_schema(body, type='images')
- return resp, body['images']
+ return service_client.ResponseBodyList(resp, body['images'])
def get_image(self, image_id):
url = 'v2/images/%s' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def is_resource_deleted(self, id):
try:
@@ -131,32 +135,33 @@
resp, body = self.http.raw_request('PUT', url, headers=headers,
body=data)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_image_file(self, image_id):
url = 'v2/images/%s/file' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
+ # We can't return a ResponseBody because the body is a string
return resp, body
def add_image_tag(self, image_id, tag):
url = 'v2/images/%s/tags/%s' % (image_id, tag)
resp, body = self.put(url, body=None)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def delete_image_tag(self, image_id, tag):
url = 'v2/images/%s/tags/%s' % (image_id, tag)
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
- return resp
+ return service_client.ResponseBody(resp)
def get_image_membership(self, image_id):
url = 'v2/images/%s/members' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def add_member(self, image_id, member_id):
url = 'v2/images/%s/members' % image_id
@@ -164,7 +169,7 @@
resp, body = self.post(url, data)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def update_member_status(self, image_id, member_id, status):
"""Valid status are: ``pending``, ``accepted``, ``rejected``."""
@@ -173,23 +178,23 @@
resp, body = self.put(url, data)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_member(self, image_id, member_id):
url = 'v2/images/%s/members/%s' % (image_id, member_id)
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return resp, json.loads(body)
+ return service_client.ResponseBody(resp, json.loads(body))
def remove_member(self, image_id, member_id):
url = 'v2/images/%s/members/%s' % (image_id, member_id)
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
- return resp
+ return service_client.ResponseBody(resp)
def get_schema(self, schema):
url = 'v2/schemas/%s' % schema
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/messaging/json/messaging_client.py b/tempest/services/messaging/json/messaging_client.py
index caed02f..c4c9f09 100644
--- a/tempest/services/messaging/json/messaging_client.py
+++ b/tempest/services/messaging/json/messaging_client.py
@@ -17,7 +17,7 @@
import urllib
from tempest.api_schema.response.messaging.v1 import queues as queues_schema
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest.common.utils import data_utils
from tempest import config
@@ -25,11 +25,13 @@
CONF = config.CONF
-class MessagingClientJSON(rest_client.RestClient):
+class MessagingClientJSON(service_client.ServiceClient):
def __init__(self, auth_provider):
- super(MessagingClientJSON, self).__init__(auth_provider,
- CONF.messaging.catalog_type)
+ super(MessagingClientJSON, self).__init__(
+ auth_provider,
+ CONF.messaging.catalog_type,
+ CONF.identity.region)
self.version = '1'
self.uri_prefix = 'v{0}'.format(self.version)
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index c279efd..8602513 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -14,7 +14,7 @@
import time
import urllib
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest.common.utils import misc
from tempest import config
from tempest import exceptions
@@ -22,7 +22,7 @@
CONF = config.CONF
-class NetworkClientJSON(rest_client.RestClient):
+class NetworkClientJSON(service_client.ServiceClient):
"""
Tempest REST client for Neutron. Uses v2 of the Neutron API, since the
@@ -39,7 +39,9 @@
def __init__(self, auth_provider):
super(NetworkClientJSON, self).__init__(
- auth_provider, CONF.network.catalog_type,
+ auth_provider,
+ CONF.network.catalog_type,
+ CONF.network.region or CONF.identity.region,
endpoint_type=CONF.network.endpoint_type,
build_interval=CONF.network.build_interval,
build_timeout=CONF.network.build_timeout)
@@ -108,7 +110,7 @@
resp, body = self.get(uri)
result = {plural_name: self.deserialize_list(body)}
self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, result)
+ return service_client.ResponseBody(resp, result)
return _list
@@ -118,7 +120,7 @@
uri = '%s/%s' % (self.get_uri(plural), resource_id)
resp, body = self.delete(uri)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
return _delete
@@ -134,7 +136,7 @@
resp, body = self.get(uri)
body = self.deserialize_single(body)
self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
return _show
@@ -146,7 +148,7 @@
resp, body = self.post(uri, post_data)
body = self.deserialize_single(body)
self.expected_success(201, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
return _create
@@ -158,7 +160,7 @@
resp, body = self.put(uri, post_data)
body = self.deserialize_single(body)
self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
return _update
@@ -184,7 +186,7 @@
resp, body = self.post(uri, body)
body = {'networks': self.deserialize_list(body)}
self.expected_success(201, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def create_bulk_subnet(self, subnet_list):
post_data = {'subnets': subnet_list}
@@ -193,7 +195,7 @@
resp, body = self.post(uri, body)
body = {'subnets': self.deserialize_list(body)}
self.expected_success(201, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def create_bulk_port(self, port_list):
post_data = {'ports': port_list}
@@ -202,7 +204,7 @@
resp, body = self.post(uri, body)
body = {'ports': self.deserialize_list(body)}
self.expected_success(201, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def wait_for_resource_deletion(self, resource_type, id):
"""Waits for a resource to be deleted."""
@@ -288,13 +290,13 @@
resp, body = self.put(uri, body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['quota'])
+ return service_client.ResponseBody(resp, body['quota'])
def reset_quotas(self, tenant_id):
uri = '%s/quotas/%s' % (self.uri_prefix, tenant_id)
resp, body = self.delete(uri)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def create_router(self, name, admin_state_up=True, **kwargs):
post_body = {'router': kwargs}
@@ -305,7 +307,7 @@
resp, body = self.post(uri, body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def _update_router(self, router_id, set_enable_snat, **kwargs):
uri = '%s/routers/%s' % (self.uri_prefix, router_id)
@@ -332,7 +334,7 @@
resp, body = self.put(uri, update_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def update_router(self, router_id, **kwargs):
"""Update a router leaving enable_snat to its default value."""
@@ -359,7 +361,7 @@
resp, body = self.put(uri, update_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def add_router_interface_with_port_id(self, router_id, port_id):
uri = '%s/routers/%s/add_router_interface' % (self.uri_prefix,
@@ -369,7 +371,7 @@
resp, body = self.put(uri, update_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def remove_router_interface_with_subnet_id(self, router_id, subnet_id):
uri = '%s/routers/%s/remove_router_interface' % (self.uri_prefix,
@@ -379,7 +381,7 @@
resp, body = self.put(uri, update_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def remove_router_interface_with_port_id(self, router_id, port_id):
uri = '%s/routers/%s/remove_router_interface' % (self.uri_prefix,
@@ -389,7 +391,7 @@
resp, body = self.put(uri, update_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def associate_health_monitor_with_pool(self, health_monitor_id,
pool_id):
@@ -404,7 +406,7 @@
resp, body = self.post(uri, body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def disassociate_health_monitor_with_pool(self, health_monitor_id,
pool_id):
@@ -412,14 +414,14 @@
health_monitor_id)
resp, body = self.delete(uri)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_router_interfaces(self, uuid):
uri = '%s/ports?device_id=%s' % (self.uri_prefix, uuid)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def update_agent(self, agent_id, agent_info):
"""
@@ -432,14 +434,14 @@
resp, body = self.put(uri, body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_pools_hosted_by_one_lbaas_agent(self, agent_id):
uri = '%s/agents/%s/loadbalancer-pools' % (self.uri_prefix, agent_id)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def show_lbaas_agent_hosting_pool(self, pool_id):
uri = ('%s/lb/pools/%s/loadbalancer-agent' %
@@ -447,21 +449,21 @@
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_routers_on_l3_agent(self, agent_id):
uri = '%s/agents/%s/l3-routers' % (self.uri_prefix, agent_id)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_l3_agents_hosting_router(self, router_id):
uri = '%s/routers/%s/l3-agents' % (self.uri_prefix, router_id)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def add_router_to_l3_agent(self, agent_id, router_id):
uri = '%s/agents/%s/l3-routers' % (self.uri_prefix, agent_id)
@@ -470,35 +472,35 @@
resp, body = self.post(uri, body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def remove_router_from_l3_agent(self, agent_id, router_id):
uri = '%s/agents/%s/l3-routers/%s' % (
self.uri_prefix, agent_id, router_id)
resp, body = self.delete(uri)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_dhcp_agent_hosting_network(self, network_id):
uri = '%s/networks/%s/dhcp-agents' % (self.uri_prefix, network_id)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_networks_hosted_by_one_dhcp_agent(self, agent_id):
uri = '%s/agents/%s/dhcp-networks' % (self.uri_prefix, agent_id)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def remove_network_from_dhcp_agent(self, agent_id, network_id):
uri = '%s/agents/%s/dhcp-networks/%s' % (self.uri_prefix, agent_id,
network_id)
resp, body = self.delete(uri)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def create_ikepolicy(self, name, **kwargs):
post_body = {
@@ -513,7 +515,7 @@
resp, body = self.post(uri, body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def update_extra_routes(self, router_id, nexthop, destination):
uri = '%s/routers/%s' % (self.uri_prefix, router_id)
@@ -527,7 +529,7 @@
resp, body = self.put(uri, body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def delete_extra_routes(self, router_id):
uri = '%s/routers/%s' % (self.uri_prefix, router_id)
@@ -541,14 +543,14 @@
resp, body = self.put(uri, body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_lb_pool_stats(self, pool_id):
uri = '%s/lb/pools/%s/stats' % (self.uri_prefix, pool_id)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def add_dhcp_agent_to_network(self, agent_id, network_id):
post_body = {'network_id': network_id}
@@ -557,7 +559,7 @@
resp, body = self.post(uri, body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def insert_firewall_rule_in_policy(self, firewall_policy_id,
firewall_rule_id, insert_after="",
@@ -573,7 +575,7 @@
resp, body = self.put(uri, body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def remove_firewall_rule_from_policy(self, firewall_policy_id,
firewall_rule_id):
@@ -584,4 +586,4 @@
resp, body = self.put(uri, update_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/object_storage/account_client.py b/tempest/services/object_storage/account_client.py
index 23984cd..c24bbba 100644
--- a/tempest/services/object_storage/account_client.py
+++ b/tempest/services/object_storage/account_client.py
@@ -17,9 +17,7 @@
import urllib
from xml.etree import ElementTree as etree
-from tempest.common import http
from tempest import config
-from tempest import exceptions
from tempest.services.object_storage import base
CONF = config.CONF
@@ -162,75 +160,3 @@
body = json.loads(body)
self.expected_success(200, resp.status)
return resp, body
-
-
-class AccountClientCustomizedHeader(base.ObjectStorageClient):
-
- # TODO(andreaf) This class is now redundant, to be removed in next patch
-
- def request(self, method, url, extra_headers=False, headers=None,
- body=None):
- """A simple HTTP request interface."""
- dscv = CONF.identity.disable_ssl_certificate_validation
- ca_certs = CONF.identity.ca_certificates_file
- self.http_obj = http.ClosingHttp(
- disable_ssl_certificate_validation=dscv,
- ca_certs=ca_certs)
- if headers is None:
- headers = {}
- elif extra_headers:
- try:
- headers.update(self.get_headers())
- except (ValueError, TypeError):
- headers = {}
-
- # Authorize the request
- req_url, req_headers, req_body = self.auth_provider.auth_request(
- method=method, url=url, headers=headers, body=body,
- filters=self.filters
- )
- # use original body
- resp, resp_body = self.http_obj.request(req_url, method,
- headers=req_headers,
- body=req_body)
- self._log_request(method, req_url, resp)
-
- if resp.status == 401 or resp.status == 403:
- raise exceptions.Unauthorized()
-
- return resp, resp_body
-
- def list_account_containers(self, params=None, metadata=None):
- """
- GET on the (base) storage URL
- Given a valid X-Auth-Token, returns a list of all containers for the
- account.
-
- Optional Arguments:
- limit=[integer value N]
- Limits the number of results to at most N values
- DEFAULT: 10,000
-
- marker=[string value X]
- Given string value X, return object names greater in value
- than the specified marker.
- DEFAULT: No Marker
-
- format=[string value, either 'json' or 'xml']
- Specify either json or xml to return the respective serialized
- response.
- DEFAULT: Python-List returned in response body
- """
-
- url = '?format=%s' % self.format
- if params:
- url += '&%s' % urllib.urlencode(params)
-
- headers = {}
- if metadata:
- for key in metadata:
- headers[str(key)] = metadata[key]
-
- resp, body = self.get(url, headers=headers)
- self.expected_success(200, resp.status)
- return resp, body
diff --git a/tempest/services/object_storage/base.py b/tempest/services/object_storage/base.py
index 3900e82..1e7355e 100644
--- a/tempest/services/object_storage/base.py
+++ b/tempest/services/object_storage/base.py
@@ -12,19 +12,21 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
CONF = config.CONF
-class ObjectStorageClient(rest_client.RestClient):
+class ObjectStorageClient(service_client.ServiceClient):
"""
Base object storage client class
"""
def __init__(self, auth_provider):
super(ObjectStorageClient, self).__init__(
- auth_provider, CONF.object_storage.catalog_type,
+ auth_provider,
+ CONF.object_storage.catalog_type,
+ CONF.object_storage.region or CONF.identity.region,
endpoint_type=CONF.object_storage.endpoint_type)
self.format = 'json'
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index a93a9df..bb74fd7 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -17,9 +17,7 @@
import urllib
import urlparse
-from tempest.common import http
from tempest import config
-from tempest import exceptions
from tempest.services.object_storage import base
CONF = config.CONF
@@ -28,10 +26,11 @@
class ObjectClient(base.ObjectStorageClient):
def create_object(self, container, object_name, data,
- params=None, metadata=None):
+ params=None, metadata=None, headers=None):
"""Create storage object."""
- headers = self.get_headers()
+ if headers is None:
+ headers = self.get_headers()
if not data:
headers['content-length'] = '0'
if metadata:
@@ -177,82 +176,6 @@
self.expected_success(201, resp.status)
return resp.status, resp.reason, resp_headers
-
-class ObjectClientCustomizedHeader(base.ObjectStorageClient):
-
- # TODO(andreaf) This class is now redundant, to be removed in next patch
-
- def request(self, method, url, extra_headers=False, headers=None,
- body=None):
- """A simple HTTP request interface."""
- dscv = CONF.identity.disable_ssl_certificate_validation
- ca_certs = CONF.identity.ca_certificates_file
- self.http_obj = http.ClosingHttp(
- disable_ssl_certificate_validation=dscv,
- ca_certs=ca_certs)
- if headers is None:
- headers = {}
- elif extra_headers:
- try:
- headers.update(self.get_headers())
- except (ValueError, TypeError):
- headers = {}
-
- # Authorize the request
- req_url, req_headers, req_body = self.auth_provider.auth_request(
- method=method, url=url, headers=headers, body=body,
- filters=self.filters
- )
- # Use original method
- resp, resp_body = self.http_obj.request(req_url, method,
- headers=req_headers,
- body=req_body)
- self._log_request(method, req_url, resp)
- if resp.status == 401 or resp.status == 403:
- raise exceptions.Unauthorized()
-
- return resp, resp_body
-
- def get_object(self, container, object_name, metadata=None):
- """Retrieve object's data."""
- headers = {}
- if metadata:
- for key in metadata:
- headers[str(key)] = metadata[key]
-
- url = "{0}/{1}".format(container, object_name)
- resp, body = self.get(url, headers=headers)
- self.expected_success(200, resp.status)
- return resp, body
-
- def create_object(self, container, object_name, data, metadata=None):
- """Create storage object."""
-
- headers = {}
- if metadata:
- for key in metadata:
- headers[str(key)] = metadata[key]
-
- if not data:
- headers['content-length'] = '0'
- url = "%s/%s" % (str(container), str(object_name))
- resp, body = self.put(url, data, headers=headers)
- self.expected_success(201, resp.status)
- return resp, body
-
- def delete_object(self, container, object_name, metadata=None):
- """Delete storage object."""
-
- headers = {}
- if metadata:
- for key in metadata:
- headers[str(key)] = metadata[key]
-
- url = "%s/%s" % (str(container), str(object_name))
- resp, body = self.delete(url, headers=headers)
- self.expected_success(200, resp.status)
- return resp, body
-
def create_object_continue(self, container, object_name,
data, metadata=None):
"""Create storage object."""
diff --git a/tempest/services/orchestration/json/orchestration_client.py b/tempest/services/orchestration/json/orchestration_client.py
index 2dedf01..d23d934 100644
--- a/tempest/services/orchestration/json/orchestration_client.py
+++ b/tempest/services/orchestration/json/orchestration_client.py
@@ -18,19 +18,20 @@
import time
import urllib
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
from tempest import exceptions
CONF = config.CONF
-class OrchestrationClient(rest_client.RestClient):
+class OrchestrationClient(service_client.ServiceClient):
def __init__(self, auth_provider):
super(OrchestrationClient, self).__init__(
auth_provider,
CONF.orchestration.catalog_type,
+ CONF.orchestration.region or CONF.identity.region,
endpoint_type=CONF.orchestration.endpoint_type,
build_interval=CONF.orchestration.build_interval,
build_timeout=CONF.orchestration.build_timeout)
diff --git a/tempest/services/telemetry/json/telemetry_client.py b/tempest/services/telemetry/json/telemetry_client.py
index 622c996..2bbd88d 100644
--- a/tempest/services/telemetry/json/telemetry_client.py
+++ b/tempest/services/telemetry/json/telemetry_client.py
@@ -15,19 +15,20 @@
import urllib
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
from tempest.openstack.common import jsonutils as json
CONF = config.CONF
-class TelemetryClientJSON(rest_client.RestClient):
+class TelemetryClientJSON(service_client.ServiceClient):
def __init__(self, auth_provider):
super(TelemetryClientJSON, self).__init__(
auth_provider,
CONF.telemetry.catalog_type,
+ CONF.identity.region,
endpoint_type=CONF.telemetry.endpoint_type)
self.version = '2'
self.uri_prefix = "v%s" % self.version
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/base.py b/tempest/services/volume/json/base.py
index 1800ee6..e6c72eb 100644
--- a/tempest/services/volume/json/base.py
+++ b/tempest/services/volume/json/base.py
@@ -12,13 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
CONF = config.CONF
-class VolumeClient(rest_client.RestClient):
+class VolumeClient(service_client.ServiceClient):
"""
Base volume client class
"""
@@ -27,6 +27,7 @@
super(VolumeClient, self).__init__(
auth_provider,
CONF.volume.catalog_type,
+ CONF.volume.region or CONF.identity.region,
endpoint_type=CONF.volume.endpoint_type,
build_interval=CONF.volume.build_interval,
build_timeout=CONF.volume.build_timeout)
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/stress/cleanup.py b/tempest/stress/cleanup.py
index 2587331..b494db6 100644
--- a/tempest/stress/cleanup.py
+++ b/tempest/stress/cleanup.py
@@ -63,13 +63,13 @@
except Exception:
pass
- _, users = admin_manager.identity_client.get_users()
+ users = admin_manager.identity_client.get_users()
LOG.info("Cleanup::remove %s users" % len(users))
for user in users:
if user['name'].startswith("stress_user"):
admin_manager.identity_client.delete_user(user['id'])
- _, tenants = admin_manager.identity_client.list_tenants()
+ tenants = admin_manager.identity_client.list_tenants()
LOG.info("Cleanup::remove %s tenants" % len(tenants))
for tenant in tenants:
if tenant['name'].startswith("stress_tenant"):
diff --git a/tempest/stress/driver.py b/tempest/stress/driver.py
index 642108a..49fac3d 100644
--- a/tempest/stress/driver.py
+++ b/tempest/stress/driver.py
@@ -143,7 +143,7 @@
tenant_name = data_utils.rand_name("stress_tenant")
password = "pass"
identity_client = admin_manager.identity_client
- _, tenant = identity_client.create_tenant(name=tenant_name)
+ tenant = identity_client.create_tenant(name=tenant_name)
identity_client.create_user(username,
password,
tenant['id'],
diff --git a/tempest/tests/cmd/test_verify_tempest_config.py b/tempest/tests/cmd/test_verify_tempest_config.py
index 65106cc..1abe29a 100644
--- a/tempest/tests/cmd/test_verify_tempest_config.py
+++ b/tempest/tests/cmd/test_verify_tempest_config.py
@@ -171,7 +171,7 @@
def test_verify_glance_version_no_v2_with_v1_1(self):
def fake_get_versions():
- return (None, ['v1.1'])
+ return (['v1.1'])
fake_os = mock.MagicMock()
fake_os.image_client.get_versions = fake_get_versions
with mock.patch.object(verify_tempest_config,
@@ -182,7 +182,7 @@
def test_verify_glance_version_no_v2_with_v1_0(self):
def fake_get_versions():
- return (None, ['v1.0'])
+ return (['v1.0'])
fake_os = mock.MagicMock()
fake_os.image_client.get_versions = fake_get_versions
with mock.patch.object(verify_tempest_config,
@@ -193,7 +193,7 @@
def test_verify_glance_version_no_v1(self):
def fake_get_versions():
- return (None, ['v2.0'])
+ return (['v2.0'])
fake_os = mock.MagicMock()
fake_os.image_client.get_versions = fake_get_versions
with mock.patch.object(verify_tempest_config,
@@ -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/common/test_accounts.py b/tempest/tests/common/test_accounts.py
index cf7ce65..0800b47 100644
--- a/tempest/tests/common/test_accounts.py
+++ b/tempest/tests/common/test_accounts.py
@@ -22,9 +22,9 @@
from tempest import auth
from tempest.common import accounts
-from tempest.common import http
from tempest import config
from tempest import exceptions
+from tempest.services.identity.json import identity_client
from tempest.tests import base
from tempest.tests import fake_config
from tempest.tests import fake_identity
@@ -68,7 +68,7 @@
return hash_list
def test_get_hash(self):
- self.stubs.Set(http.ClosingHttp, 'request',
+ self.stubs.Set(identity_client.TokenClientJSON, 'raw_request',
fake_identity._fake_v2_response)
test_account_class = accounts.Accounts('test_name')
hash_list = self._get_hash_list(self.test_accounts)
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 6a2e335..a191781 100644
--- a/tempest/tests/test_auth.py
+++ b/tempest/tests/test_auth.py
@@ -19,17 +19,25 @@
from oslotest import mockpatch
from tempest import auth
-from tempest.common import http
from tempest import config
from tempest import exceptions
+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()
@@ -45,11 +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(http.ClosingHttp, 'request', self.fake_http.request)
- 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)
@@ -125,7 +131,7 @@
def setUp(self):
super(TestKeystoneV2AuthProvider, self).setUp()
- self.stubs.Set(http.ClosingHttp, 'request',
+ self.stubs.Set(v2_client.TokenClientJSON, 'raw_request',
fake_identity._fake_v2_response)
self.target_url = 'test_api'
@@ -346,7 +352,7 @@
def setUp(self):
super(TestKeystoneV3AuthProvider, self).setUp()
- self.stubs.Set(http.ClosingHttp, 'request',
+ self.stubs.Set(v3_client.V3TokenClientJSON, 'raw_request',
fake_identity._fake_v3_response)
def _get_fake_alt_identity(self):
diff --git a/tempest/tests/test_credentials.py b/tempest/tests/test_credentials.py
index aa3df36..1abb941 100644
--- a/tempest/tests/test_credentials.py
+++ b/tempest/tests/test_credentials.py
@@ -18,10 +18,11 @@
from oslo.config import cfg
from tempest import auth
-from tempest.common import http
from tempest.common import tempest_fixtures as fixtures
from tempest import config
from tempest import exceptions
+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_config
from tempest.tests import fake_identity
@@ -76,10 +77,12 @@
identity_response = fake_identity._fake_v2_response
credentials_class = auth.KeystoneV2Credentials
+ tokenclient_class = v2_client.TokenClientJSON
def setUp(self):
super(KeystoneV2CredentialsTests, self).setUp()
- self.stubs.Set(http.ClosingHttp, 'request', self.identity_response)
+ self.stubs.Set(self.tokenclient_class, 'raw_request',
+ self.identity_response)
def _verify_credentials(self, credentials_class, filled=True,
creds_dict=None):
@@ -185,6 +188,7 @@
credentials_class = auth.KeystoneV3Credentials
identity_response = fake_identity._fake_v3_response
+ tokenclient_class = v3_client.V3TokenClientJSON
def setUp(self):
super(KeystoneV3CredentialsTests, self).setUp()
diff --git a/tempest/tests/test_list_tests.py b/tempest/tests/test_list_tests.py
index efdb413..19e4c9c 100644
--- a/tempest/tests/test_list_tests.py
+++ b/tempest/tests/test_list_tests.py
@@ -31,7 +31,7 @@
ids, err = p.communicate()
self.assertEqual(0, p.returncode,
"test discovery failed, one or more files cause an "
- "error on import")
+ "error on import %s" % ids)
ids = ids.split('\n')
for test_id in ids:
if re.match('(\w+\.){3}\w+', test_id):
diff --git a/tempest/tests/test_negative_rest_client.py b/tempest/tests/test_negative_rest_client.py
new file mode 100644
index 0000000..ce95739
--- /dev/null
+++ b/tempest/tests/test_negative_rest_client.py
@@ -0,0 +1,91 @@
+# (c) 2015 Deutsche Telekom AG
+# Copyright 2015 Red Hat, Inc.
+# Copyright 2015 NEC Corporation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import httplib2
+from oslotest import mockpatch
+
+from tempest.common import negative_rest_client
+from tempest import config
+from tempest.tests import base
+from tempest.tests import fake_auth_provider
+from tempest.tests import fake_config
+from tempest.tests import fake_http
+
+
+class TestNegativeRestClient(base.TestCase):
+
+ url = 'fake_endpoint'
+
+ def setUp(self):
+ self.fake_http = fake_http.fake_httplib2()
+ super(TestNegativeRestClient, self).setUp()
+ self.useFixture(fake_config.ConfigFixture())
+ self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
+ self.stubs.Set(httplib2.Http, 'request', self.fake_http.request)
+ self.negative_rest_client = negative_rest_client.NegativeRestClient(
+ fake_auth_provider.FakeAuthProvider(), None)
+ self.useFixture(mockpatch.PatchObject(self.negative_rest_client,
+ '_log_request'))
+
+ def test_post(self):
+ __, return_dict = self.negative_rest_client.send_request('POST',
+ self.url,
+ [], {})
+ self.assertEqual('POST', return_dict['method'])
+
+ def test_get(self):
+ __, return_dict = self.negative_rest_client.send_request('GET',
+ self.url,
+ [])
+ self.assertEqual('GET', return_dict['method'])
+
+ def test_delete(self):
+ __, return_dict = self.negative_rest_client.send_request('DELETE',
+ self.url,
+ [])
+ self.assertEqual('DELETE', return_dict['method'])
+
+ def test_patch(self):
+ __, return_dict = self.negative_rest_client.send_request('PATCH',
+ self.url,
+ [], {})
+ self.assertEqual('PATCH', return_dict['method'])
+
+ def test_put(self):
+ __, return_dict = self.negative_rest_client.send_request('PUT',
+ self.url,
+ [], {})
+ self.assertEqual('PUT', return_dict['method'])
+
+ def test_head(self):
+ self.useFixture(mockpatch.PatchObject(self.negative_rest_client,
+ 'response_checker'))
+ __, return_dict = self.negative_rest_client.send_request('HEAD',
+ self.url,
+ [])
+ self.assertEqual('HEAD', return_dict['method'])
+
+ def test_copy(self):
+ __, return_dict = self.negative_rest_client.send_request('COPY',
+ self.url,
+ [])
+ self.assertEqual('COPY', return_dict['method'])
+
+ def test_other(self):
+ self.assertRaises(AssertionError,
+ self.negative_rest_client.send_request,
+ 'OTHER', self.url, [])
diff --git a/tempest/tests/test_rest_client.py b/tempest/tests/test_rest_client.py
index 42ba5a0..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
@@ -30,18 +29,11 @@
url = 'fake_endpoint'
- def _get_region(self):
- return 'fake region'
-
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)
+ fake_auth_provider.FakeAuthProvider(), None, None)
self.stubs.Set(httplib2.Http, 'request', self.fake_http.request)
- self.useFixture(mockpatch.PatchObject(self.rest_client, '_get_region',
- side_effect=self._get_region()))
self.useFixture(mockpatch.PatchObject(self.rest_client,
'_log_request'))
@@ -99,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'])
@@ -301,10 +293,8 @@
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)
+ fake_auth_provider.FakeAuthProvider(), None, None)
def test_response_less_than_400(self):
self.rest_client._error_checker(**self.set_data("399"))
@@ -339,6 +329,11 @@
self.rest_client._error_checker,
**self.set_data("413"))
+ def test_response_415(self):
+ self.assertRaises(exceptions.InvalidContentType,
+ self.rest_client._error_checker,
+ **self.set_data("415"))
+
def test_response_422(self):
self.assertRaises(exceptions.UnprocessableEntity,
self.rest_client._error_checker,
@@ -428,66 +423,6 @@
'1234')
-class TestNegativeRestClient(BaseRestClientTestClass):
-
- def setUp(self):
- self.fake_http = fake_http.fake_httplib2()
- super(TestNegativeRestClient, self).setUp()
- self.negative_rest_client = rest_client.NegativeRestClient(
- fake_auth_provider.FakeAuthProvider(), None)
- self.useFixture(mockpatch.PatchObject(self.negative_rest_client,
- '_log_request'))
-
- def test_post(self):
- __, return_dict = self.negative_rest_client.send_request('POST',
- self.url,
- [], {})
- self.assertEqual('POST', return_dict['method'])
-
- def test_get(self):
- __, return_dict = self.negative_rest_client.send_request('GET',
- self.url,
- [])
- self.assertEqual('GET', return_dict['method'])
-
- def test_delete(self):
- __, return_dict = self.negative_rest_client.send_request('DELETE',
- self.url,
- [])
- self.assertEqual('DELETE', return_dict['method'])
-
- def test_patch(self):
- __, return_dict = self.negative_rest_client.send_request('PATCH',
- self.url,
- [], {})
- self.assertEqual('PATCH', return_dict['method'])
-
- def test_put(self):
- __, return_dict = self.negative_rest_client.send_request('PUT',
- self.url,
- [], {})
- self.assertEqual('PUT', return_dict['method'])
-
- def test_head(self):
- self.useFixture(mockpatch.PatchObject(self.negative_rest_client,
- 'response_checker'))
- __, return_dict = self.negative_rest_client.send_request('HEAD',
- self.url,
- [])
- self.assertEqual('HEAD', return_dict['method'])
-
- def test_copy(self):
- __, return_dict = self.negative_rest_client.send_request('COPY',
- self.url,
- [])
- self.assertEqual('COPY', return_dict['method'])
-
- def test_other(self):
- self.assertRaises(AssertionError,
- self.negative_rest_client.send_request,
- 'OTHER', self.url, [])
-
-
class TestExpectedSuccess(BaseRestClientTestClass):
def setUp(self):
diff --git a/tempest/tests/test_tenant_isolation.py b/tempest/tests/test_tenant_isolation.py
index 053dae1..f6779c6 100644
--- a/tempest/tests/test_tenant_isolation.py
+++ b/tempest/tests/test_tenant_isolation.py
@@ -15,8 +15,8 @@
import mock
from oslo.config import cfg
-from tempest.common import http
from tempest.common import isolated_creds
+from tempest.common import service_client
from tempest import config
from tempest import exceptions
from tempest.openstack.common.fixture import mockpatch
@@ -35,7 +35,7 @@
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(http.ClosingHttp, 'request',
+ self.stubs.Set(json_iden_client.TokenClientJSON, 'raw_request',
fake_identity._fake_v2_response)
cfg.CONF.set_default('operator_role', 'FakeRole',
group='object-storage')
@@ -51,41 +51,42 @@
user_fix = self.useFixture(mockpatch.PatchObject(
json_iden_client.IdentityClientJSON,
'create_user',
- return_value=({'status': 200},
- {'id': id, 'name': name})))
+ return_value=(service_client.ResponseBody
+ (200, {'id': id, 'name': name}))))
return user_fix
def _mock_tenant_create(self, id, name):
tenant_fix = self.useFixture(mockpatch.PatchObject(
json_iden_client.IdentityClientJSON,
'create_tenant',
- return_value=({'status': 200},
- {'id': id, 'name': name})))
+ return_value=(service_client.ResponseBody
+ (200, {'id': id, 'name': name}))))
return tenant_fix
def _mock_list_roles(self, id, name):
roles_fix = self.useFixture(mockpatch.PatchObject(
json_iden_client.IdentityClientJSON,
'list_roles',
- return_value=({'status': 200},
- [{'id': id, 'name': name},
- {'id': '1', 'name': 'FakeRole'}])))
+ return_value=(service_client.ResponseBodyList
+ (200,
+ [{'id': id, 'name': name},
+ {'id': '1', 'name': 'FakeRole'}]))))
return roles_fix
def _mock_assign_user_role(self):
tenant_fix = self.useFixture(mockpatch.PatchObject(
json_iden_client.IdentityClientJSON,
'assign_user_role',
- return_value=({'status': 200},
- {})))
+ return_value=(service_client.ResponseBody
+ (200, {}))))
return tenant_fix
def _mock_list_role(self):
roles_fix = self.useFixture(mockpatch.PatchObject(
json_iden_client.IdentityClientJSON,
'list_roles',
- return_value=({'status': 200},
- [{'id': '1', 'name': 'FakeRole'}])))
+ return_value=(service_client.ResponseBodyList
+ (200, [{'id': '1', 'name': 'FakeRole'}]))))
return roles_fix
def _mock_network_create(self, iso_creds, id, name):