Merge "Remove unused add_sample()"
diff --git a/setup.cfg b/setup.cfg
index ee61788..4415063 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -35,6 +35,7 @@
tempest.cm =
init = tempest.cmd.init:TempestInit
cleanup = tempest.cmd.cleanup:TempestCleanup
+ run-stress = tempest.cmd.run_stress:TempestRunStress
oslo.config.opts =
tempest.config = tempest.config:list_opts
diff --git a/tempest/api/compute/admin/test_security_groups.py b/tempest/api/compute/admin/test_security_groups.py
index b0a3086..e31129b 100644
--- a/tempest/api/compute/admin/test_security_groups.py
+++ b/tempest/api/compute/admin/test_security_groups.py
@@ -28,7 +28,7 @@
@classmethod
def setup_clients(cls):
super(SecurityGroupsTestAdminJSON, cls).setup_clients()
- cls.adm_client = cls.os_adm.security_groups_client
+ cls.adm_client = cls.os_adm.compute_security_groups_client
cls.client = cls.security_groups_client
def _delete_security_group(self, securitygroup_id, admin=True):
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 5bc0769..2321b4e 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -69,7 +69,7 @@
cls.floating_ips_client = cls.os.compute_floating_ips_client
cls.keypairs_client = cls.os.keypairs_client
cls.security_group_rules_client = cls.os.security_group_rules_client
- cls.security_groups_client = cls.os.security_groups_client
+ cls.security_groups_client = cls.os.compute_security_groups_client
cls.quotas_client = cls.os.quotas_client
cls.quota_classes_client = cls.os.quota_classes_client
cls.compute_networks_client = cls.os.compute_networks_client
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index dbbeb70..ee840be 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -100,7 +100,7 @@
server_id = server['id']
waiters.wait_for_server_status(self.servers_client, server_id,
'ACTIVE')
- self.servers_client.add_security_group(server_id, sg['name'])
+ self.servers_client.add_security_group(server_id, name=sg['name'])
# Check that we are not able to delete the security
# group since it is in use by an active server
@@ -112,7 +112,7 @@
self.servers_client.reboot_server(server_id, 'HARD')
waiters.wait_for_server_status(self.servers_client, server_id,
'ACTIVE')
- self.servers_client.add_security_group(server_id, sg2['name'])
+ self.servers_client.add_security_group(server_id, name=sg2['name'])
# Check that we are not able to delete the other security
# group since it is in use by an active server
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 0754d27..45cdeaf 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -81,7 +81,7 @@
def test_change_server_password(self):
# The server's password should be set to the provided password
new_password = 'Newpass1234'
- self.client.change_password(self.server_id, new_password)
+ self.client.change_password(self.server_id, adminPass=new_password)
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
if CONF.validation.run_validation:
@@ -279,9 +279,9 @@
# create the first and the second backup
backup1 = data_utils.rand_name('backup-1')
resp = self.client.create_backup(self.server_id,
- 'daily',
- 2,
- backup1).response
+ backup_type='daily',
+ rotation=2,
+ name=backup1).response
oldest_backup_exist = True
# the oldest one should be deleted automatically in this test
@@ -303,9 +303,9 @@
backup2 = data_utils.rand_name('backup-2')
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
resp = self.client.create_backup(self.server_id,
- 'daily',
- 2,
- backup2).response
+ backup_type='daily',
+ rotation=2,
+ name=backup2).response
image2_id = data_utils.parse_image_id(resp['location'])
self.addCleanup(self.os.image_client.delete_image, image2_id)
self.os.image_client.wait_for_image_status(image2_id, 'active')
@@ -331,9 +331,9 @@
backup3 = data_utils.rand_name('backup-3')
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
resp = self.client.create_backup(self.server_id,
- 'daily',
- 2,
- backup3).response
+ backup_type='daily',
+ rotation=2,
+ name=backup3).response
image3_id = data_utils.parse_image_id(resp['location'])
self.addCleanup(self.os.image_client.delete_image, image3_id)
# the first back up should be deleted
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index 96ce45e..1552848 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -116,7 +116,8 @@
self.addCleanup(self._unrescue, self.server_id)
# Add Security group
- self.servers_client.add_security_group(self.server_id, self.sg_name)
+ self.servers_client.add_security_group(self.server_id,
+ name=self.sg_name)
# Delete Security group
self.servers_client.remove_security_group(self.server_id,
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index 436ed2f..1a1cc1c 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -51,13 +51,14 @@
cls.images_client = cls.os.images_client
cls.glance_client = cls.os.image_client
cls.keypairs_client = cls.os.keypairs_client
- cls.security_client = cls.os.security_groups_client
+ cls.security_client = cls.os.compute_security_groups_client
cls.rule_client = cls.os.security_group_rules_client
cls.alt_client = cls.alt_manager.servers_client
cls.alt_images_client = cls.alt_manager.images_client
cls.alt_keypairs_client = cls.alt_manager.keypairs_client
- cls.alt_security_client = cls.alt_manager.security_groups_client
+ cls.alt_security_client = (
+ cls.alt_manager.compute_security_groups_client)
cls.alt_rule_client = cls.alt_manager.security_group_rules_client
@classmethod
@@ -150,7 +151,7 @@
def test_change_password_for_alt_account_fails(self):
# A change password request for another user's server should fail
self.assertRaises(lib_exc.NotFound, self.alt_client.change_password,
- self.server['id'], 'newpass')
+ self.server['id'], adminPass='newpass')
@test.idempotent_id('14cb5ff5-f646-45ca-8f51-09081d6c0c24')
def test_reboot_server_for_alt_account_fails(self):
diff --git a/tempest/api/database/flavors/test_flavors.py b/tempest/api/database/flavors/test_flavors.py
index 62c1e05..f75b867 100644
--- a/tempest/api/database/flavors/test_flavors.py
+++ b/tempest/api/database/flavors/test_flavors.py
@@ -28,7 +28,7 @@
@test.idempotent_id('c94b825e-0132-4686-8049-8a4a2bc09525')
def test_get_db_flavor(self):
# The expected flavor details should be returned
- flavor = (self.client.get_db_flavor_details(self.db_flavor_ref)
+ flavor = (self.client.show_db_flavor(self.db_flavor_ref)
['flavor'])
self.assertEqual(self.db_flavor_ref, str(flavor['id']))
self.assertIn('ram', flavor)
@@ -38,7 +38,7 @@
@test.attr(type='smoke')
@test.idempotent_id('685025d6-0cec-4673-8a8d-995cb8e0d3bb')
def test_list_db_flavors(self):
- flavor = (self.client.get_db_flavor_details(self.db_flavor_ref)
+ flavor = (self.client.show_db_flavor(self.db_flavor_ref)
['flavor'])
# List of all flavors should contain the expected flavor
flavors = self.client.list_db_flavors()['flavors']
@@ -67,7 +67,7 @@
(os_flavors, db_flavors))
for os_flavor in os_flavors:
db_flavor =\
- self.client.get_db_flavor_details(os_flavor['id'])['flavor']
+ self.client.show_db_flavor(os_flavor['id'])['flavor']
self._check_values(['id', 'name', 'ram'], db_flavor, os_flavor)
self._check_values(['disk', 'vcpus', 'swap'], db_flavor, os_flavor,
in_db=False)
diff --git a/tempest/api/database/flavors/test_flavors_negative.py b/tempest/api/database/flavors/test_flavors_negative.py
index 68cb7d6..3dee96f 100644
--- a/tempest/api/database/flavors/test_flavors_negative.py
+++ b/tempest/api/database/flavors/test_flavors_negative.py
@@ -31,4 +31,4 @@
def test_get_non_existent_db_flavor(self):
# flavor details are not returned for non-existent flavors
self.assertRaises(lib_exc.NotFound,
- self.client.get_db_flavor_details, -1)
+ self.client.show_db_flavor, -1)
diff --git a/tempest/api/identity/admin/v2/test_tenant_negative.py b/tempest/api/identity/admin/v2/test_tenant_negative.py
index 74558d1..a02dbc1 100644
--- a/tempest/api/identity/admin/v2/test_tenant_negative.py
+++ b/tempest/api/identity/admin/v2/test_tenant_negative.py
@@ -29,7 +29,7 @@
def test_list_tenants_by_unauthorized_user(self):
# Non-administrator user should not be able to list tenants
self.assertRaises(lib_exc.Forbidden,
- self.non_admin_client.list_tenants)
+ self.non_admin_tenants_client.list_tenants)
@test.attr(type=['negative'])
@test.idempotent_id('df33926c-1c96-4d8d-a762-79cc6b0c3cf4')
@@ -37,7 +37,8 @@
# Request to list tenants without a valid token should fail
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
- self.assertRaises(lib_exc.Unauthorized, self.client.list_tenants)
+ self.assertRaises(lib_exc.Unauthorized,
+ self.tenants_client.list_tenants)
self.client.auth_provider.clear_auth()
@test.attr(type=['negative'])
@@ -45,21 +46,23 @@
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']
+ tenant = self.tenants_client.create_tenant(tenant_name)['tenant']
self.data.tenants.append(tenant)
self.assertRaises(lib_exc.Forbidden,
- self.non_admin_client.delete_tenant, tenant['id'])
+ self.non_admin_tenants_client.delete_tenant,
+ tenant['id'])
@test.attr(type=['negative'])
@test.idempotent_id('e450db62-2e9d-418f-893a-54772d6386b1')
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']
+ tenant = self.tenants_client.create_tenant(tenant_name)['tenant']
self.data.tenants.append(tenant)
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
- self.assertRaises(lib_exc.Unauthorized, self.client.delete_tenant,
+ self.assertRaises(lib_exc.Unauthorized,
+ self.tenants_client.delete_tenant,
tenant['id'])
self.client.auth_provider.clear_auth()
@@ -67,7 +70,7 @@
@test.idempotent_id('9c9a2aed-6e3c-467a-8f5c-89da9d1b516b')
def test_delete_non_existent_tenant(self):
# Attempt to delete a non existent tenant should fail
- self.assertRaises(lib_exc.NotFound, self.client.delete_tenant,
+ self.assertRaises(lib_exc.NotFound, self.tenants_client.delete_tenant,
str(uuid.uuid4().hex))
@test.attr(type=['negative'])
@@ -75,14 +78,14 @@
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)['tenant']
+ body = self.tenants_client.create_tenant(tenant_name)['tenant']
tenant = body
self.data.tenants.append(tenant)
tenant1_id = body.get('id')
- self.addCleanup(self.client.delete_tenant, tenant1_id)
+ self.addCleanup(self.tenants_client.delete_tenant, tenant1_id)
self.addCleanup(self.data.tenants.remove, tenant)
- self.assertRaises(lib_exc.Conflict, self.client.create_tenant,
+ self.assertRaises(lib_exc.Conflict, self.tenants_client.create_tenant,
tenant_name)
@test.attr(type=['negative'])
@@ -91,7 +94,8 @@
# Non-administrator user should not be authorized to create a tenant
tenant_name = data_utils.rand_name(name='tenant')
self.assertRaises(lib_exc.Forbidden,
- self.non_admin_client.create_tenant, tenant_name)
+ self.non_admin_tenants_client.create_tenant,
+ tenant_name)
@test.attr(type=['negative'])
@test.idempotent_id('a3ee9d7e-6920-4dd5-9321-d4b2b7f0a638')
@@ -100,7 +104,8 @@
tenant_name = data_utils.rand_name(name='tenant')
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
- self.assertRaises(lib_exc.Unauthorized, self.client.create_tenant,
+ self.assertRaises(lib_exc.Unauthorized,
+ self.tenants_client.create_tenant,
tenant_name)
self.client.auth_provider.clear_auth()
@@ -108,7 +113,8 @@
@test.idempotent_id('5a2e4ca9-b0c0-486c-9c48-64a94fba2395')
def test_create_tenant_with_empty_name(self):
# Tenant name should not be empty
- self.assertRaises(lib_exc.BadRequest, self.client.create_tenant,
+ self.assertRaises(lib_exc.BadRequest,
+ self.tenants_client.create_tenant,
name='')
@test.attr(type=['negative'])
@@ -116,14 +122,15 @@
def test_create_tenants_name_length_over_64(self):
# Tenant name length should not be greater than 64 characters
tenant_name = 'a' * 65
- self.assertRaises(lib_exc.BadRequest, self.client.create_tenant,
+ self.assertRaises(lib_exc.BadRequest,
+ self.tenants_client.create_tenant,
tenant_name)
@test.attr(type=['negative'])
@test.idempotent_id('bd20dc2a-9557-4db7-b755-f48d952ad706')
def test_update_non_existent_tenant(self):
# Attempt to update a non existent tenant should fail
- self.assertRaises(lib_exc.NotFound, self.client.update_tenant,
+ self.assertRaises(lib_exc.NotFound, self.tenants_client.update_tenant,
str(uuid.uuid4().hex))
@test.attr(type=['negative'])
@@ -131,20 +138,22 @@
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']
+ tenant = self.tenants_client.create_tenant(tenant_name)['tenant']
self.data.tenants.append(tenant)
self.assertRaises(lib_exc.Forbidden,
- self.non_admin_client.update_tenant, tenant['id'])
+ self.non_admin_tenants_client.update_tenant,
+ tenant['id'])
@test.attr(type=['negative'])
@test.idempotent_id('7a421573-72c7-4c22-a98e-ce539219c657')
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']
+ tenant = self.tenants_client.create_tenant(tenant_name)['tenant']
self.data.tenants.append(tenant)
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
- self.assertRaises(lib_exc.Unauthorized, self.client.update_tenant,
+ self.assertRaises(lib_exc.Unauthorized,
+ self.tenants_client.update_tenant,
tenant['id'])
self.client.auth_provider.clear_auth()
diff --git a/tempest/api/identity/admin/v2/test_tenants.py b/tempest/api/identity/admin/v2/test_tenants.py
index 4632b1e..8d0b9b1 100644
--- a/tempest/api/identity/admin/v2/test_tenants.py
+++ b/tempest/api/identity/admin/v2/test_tenants.py
@@ -28,19 +28,19 @@
tenants = []
for _ in moves.xrange(3):
tenant_name = data_utils.rand_name(name='tenant-new')
- tenant = self.client.create_tenant(tenant_name)['tenant']
+ tenant = self.tenants_client.create_tenant(tenant_name)['tenant']
self.data.tenants.append(tenant)
tenants.append(tenant)
tenant_ids = map(lambda x: x['id'], tenants)
- body = self.client.list_tenants()['tenants']
+ body = self.tenants_client.list_tenants()['tenants']
found = [t for t in body if t['id'] in tenant_ids]
self.assertEqual(len(found), len(tenants), 'Tenants not created')
for tenant in tenants:
- self.client.delete_tenant(tenant['id'])
+ self.tenants_client.delete_tenant(tenant['id'])
self.data.tenants.remove(tenant)
- body = self.client.list_tenants()['tenants']
+ body = self.tenants_client.list_tenants()['tenants']
found = [tenant for tenant in body if tenant['id'] in tenant_ids]
self.assertFalse(any(found), 'Tenants failed to delete')
@@ -49,60 +49,60 @@
# 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)['tenant']
- tenant = body
+ body = self.tenants_client.create_tenant(tenant_name,
+ description=tenant_desc)
+ tenant = body['tenant']
self.data.tenants.append(tenant)
- tenant_id = body['id']
- desc1 = body['description']
+ tenant_id = tenant['id']
+ desc1 = tenant['description']
self.assertEqual(desc1, tenant_desc, 'Description should have '
'been sent in response for create')
- body = self.client.show_tenant(tenant_id)['tenant']
+ body = self.tenants_client.show_tenant(tenant_id)['tenant']
desc2 = body['description']
self.assertEqual(desc2, tenant_desc, 'Description does not appear'
'to be set')
- self.client.delete_tenant(tenant_id)
+ self.tenants_client.delete_tenant(tenant_id)
self.data.tenants.remove(tenant)
@test.idempotent_id('670bdddc-1cd7-41c7-b8e2-751cfb67df50')
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)['tenant']
- tenant = body
+ body = self.tenants_client.create_tenant(tenant_name, enabled=True)
+ tenant = body['tenant']
self.data.tenants.append(tenant)
- tenant_id = body['id']
- en1 = body['enabled']
+ tenant_id = tenant['id']
+ en1 = tenant['enabled']
self.assertTrue(en1, 'Enable should be True in response')
- body = self.client.show_tenant(tenant_id)['tenant']
+ body = self.tenants_client.show_tenant(tenant_id)['tenant']
en2 = body['enabled']
self.assertTrue(en2, 'Enable should be True in lookup')
- self.client.delete_tenant(tenant_id)
+ self.tenants_client.delete_tenant(tenant_id)
self.data.tenants.remove(tenant)
@test.idempotent_id('3be22093-b30f-499d-b772-38340e5e16fb')
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)['tenant']
- tenant = body
+ body = self.tenants_client.create_tenant(tenant_name, enabled=False)
+ tenant = body['tenant']
self.data.tenants.append(tenant)
- tenant_id = body['id']
- en1 = body['enabled']
+ tenant_id = tenant['id']
+ en1 = tenant['enabled']
self.assertEqual('false', str(en1).lower(),
'Enable should be False in response')
- body = self.client.show_tenant(tenant_id)['tenant']
+ body = self.tenants_client.show_tenant(tenant_id)['tenant']
en2 = body['enabled']
self.assertEqual('false', str(en2).lower(),
'Enable should be False in lookup')
- self.client.delete_tenant(tenant_id)
+ self.tenants_client.delete_tenant(tenant_id)
self.data.tenants.remove(tenant)
@test.idempotent_id('781f2266-d128-47f3-8bdb-f70970add238')
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)['tenant']
+ body = self.tenants_client.create_tenant(t_name1)['tenant']
tenant = body
self.data.tenants.append(tenant)
@@ -110,18 +110,18 @@
resp1_name = body['name']
t_name2 = data_utils.rand_name(name='tenant2')
- body = self.client.update_tenant(t_id, name=t_name2)['tenant']
+ body = self.tenants_client.update_tenant(t_id, name=t_name2)['tenant']
resp2_name = body['name']
self.assertNotEqual(resp1_name, resp2_name)
- body = self.client.show_tenant(t_id)['tenant']
+ body = self.tenants_client.show_tenant(t_id)['tenant']
resp3_name = body['name']
self.assertNotEqual(resp1_name, resp3_name)
self.assertEqual(t_name1, resp1_name)
self.assertEqual(resp2_name, resp3_name)
- self.client.delete_tenant(t_id)
+ self.tenants_client.delete_tenant(t_id)
self.data.tenants.remove(tenant)
@test.idempotent_id('859fcfe1-3a03-41ef-86f9-b19a47d1cd87')
@@ -129,26 +129,27 @@
# 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)['tenant']
- tenant = body
+ body = self.tenants_client.create_tenant(t_name, description=t_desc)
+ tenant = body['tenant']
self.data.tenants.append(tenant)
- t_id = body['id']
- resp1_desc = body['description']
+ t_id = tenant['id']
+ resp1_desc = tenant['description']
t_desc2 = data_utils.rand_name(name='desc2')
- body = self.client.update_tenant(t_id, description=t_desc2)['tenant']
- resp2_desc = body['description']
+ body = self.tenants_client.update_tenant(t_id, description=t_desc2)
+ updated_tenant = body['tenant']
+ resp2_desc = updated_tenant['description']
self.assertNotEqual(resp1_desc, resp2_desc)
- body = self.client.show_tenant(t_id)['tenant']
+ body = self.tenants_client.show_tenant(t_id)['tenant']
resp3_desc = body['description']
self.assertNotEqual(resp1_desc, resp3_desc)
self.assertEqual(t_desc, resp1_desc)
self.assertEqual(resp2_desc, resp3_desc)
- self.client.delete_tenant(t_id)
+ self.tenants_client.delete_tenant(t_id)
self.data.tenants.remove(tenant)
@test.idempotent_id('8fc8981f-f12d-4c66-9972-2bdcf2bc2e1a')
@@ -156,24 +157,25 @@
# 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)['tenant']
- tenant = body
+ body = self.tenants_client.create_tenant(t_name, enabled=t_en)
+ tenant = body['tenant']
self.data.tenants.append(tenant)
- t_id = body['id']
- resp1_en = body['enabled']
+ t_id = tenant['id']
+ resp1_en = tenant['enabled']
t_en2 = True
- body = self.client.update_tenant(t_id, enabled=t_en2)['tenant']
- resp2_en = body['enabled']
+ body = self.tenants_client.update_tenant(t_id, enabled=t_en2)
+ updated_tenant = body['tenant']
+ resp2_en = updated_tenant['enabled']
self.assertNotEqual(resp1_en, resp2_en)
- body = self.client.show_tenant(t_id)['tenant']
+ body = self.tenants_client.show_tenant(t_id)['tenant']
resp3_en = body['enabled']
self.assertNotEqual(resp1_en, resp3_en)
self.assertEqual('false', str(resp1_en).lower())
self.assertEqual(resp2_en, resp3_en)
- self.client.delete_tenant(t_id)
+ self.tenants_client.delete_tenant(t_id)
self.data.tenants.remove(tenant)
diff --git a/tempest/api/identity/admin/v2/test_tokens.py b/tempest/api/identity/admin/v2/test_tokens.py
index 0e7a480..cb9250b 100644
--- a/tempest/api/identity/admin/v2/test_tokens.py
+++ b/tempest/api/identity/admin/v2/test_tokens.py
@@ -27,7 +27,7 @@
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']
+ tenant = self.tenants_client.create_tenant(tenant_name)['tenant']
self.data.tenants.append(tenant)
# second:create a user
user = self.client.create_user(user_name, user_password,
@@ -68,11 +68,11 @@
# Create a couple tenants.
tenant1_name = data_utils.rand_name(name='tenant')
- tenant1 = self.client.create_tenant(tenant1_name)['tenant']
+ tenant1 = self.tenants_client.create_tenant(tenant1_name)['tenant']
self.data.tenants.append(tenant1)
tenant2_name = data_utils.rand_name(name='tenant')
- tenant2 = self.client.create_tenant(tenant2_name)['tenant']
+ tenant2 = self.tenants_client.create_tenant(tenant2_name)['tenant']
self.data.tenants.append(tenant2)
# Create a role
diff --git a/tempest/api/identity/admin/v2/test_users.py b/tempest/api/identity/admin/v2/test_users.py
index 6341106..13d6137 100644
--- a/tempest/api/identity/admin/v2/test_users.py
+++ b/tempest/api/identity/admin/v2/test_users.py
@@ -146,7 +146,7 @@
user_ids.append(user2['id'])
self.data.users.append(user2)
# List of users for the respective tenant ID
- body = (self.client.list_tenant_users(self.data.tenant['id'])
+ body = (self.tenants_client.list_tenant_users(self.data.tenant['id'])
['users'])
for i in body:
fetched_user_ids.append(i['id'])
@@ -182,7 +182,7 @@
second_user['id'],
role['id'])['role']
# List of users with roles for the respective tenant ID
- body = (self.client.list_tenant_users(self.data.tenant['id'])
+ body = (self.tenants_client.list_tenant_users(self.data.tenant['id'])
['users'])
for i in body:
fetched_user_ids.append(i['id'])
diff --git a/tempest/api/identity/admin/v2/test_users_negative.py b/tempest/api/identity/admin/v2/test_users_negative.py
index a88053d..0c7afe8 100644
--- a/tempest/api/identity/admin/v2/test_users_negative.py
+++ b/tempest/api/identity/admin/v2/test_users_negative.py
@@ -247,4 +247,4 @@
# List the users with invalid tenant id
for invalid in invalid_id:
self.assertRaises(lib_exc.NotFound,
- self.client.list_tenant_users, invalid)
+ self.tenants_client.list_tenant_users, invalid)
diff --git a/tempest/api/identity/admin/v3/test_policies.py b/tempest/api/identity/admin/v3/test_policies.py
index 44e5c7b..f38d25d 100644
--- a/tempest/api/identity/admin/v3/test_policies.py
+++ b/tempest/api/identity/admin/v3/test_policies.py
@@ -64,7 +64,7 @@
policy['id'], type=update_type)['policy']
self.assertIn('type', data)
# Assertion for updated value with fetched value
- fetched_policy = self.policy_client.get_policy(policy['id'])['policy']
+ fetched_policy = self.policy_client.show_policy(policy['id'])['policy']
self.assertIn('id', fetched_policy)
self.assertIn('blob', fetched_policy)
self.assertIn('type', fetched_policy)
diff --git a/tempest/api/identity/admin/v3/test_users.py b/tempest/api/identity/admin/v3/test_users.py
index b56c9e6..60abde7 100644
--- a/tempest/api/identity/admin/v3/test_users.py
+++ b/tempest/api/identity/admin/v3/test_users.py
@@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import time
+
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest import test
@@ -76,6 +78,14 @@
new_password = data_utils.rand_name('pass1')
self.client.update_user_password(user['id'], new_password,
original_password)
+ # TODO(lbragstad): Sleeping after the response status has been checked
+ # and the body loaded as JSON allows requests to fail-fast. The sleep
+ # is necessary because keystone will err on the side of security and
+ # invalidate tokens within a small margin of error (within the same
+ # wall clock second) after a revocation event is issued (such as a
+ # password change). Remove this once keystone and Fernet support
+ # sub-second precision, see bug 1517697 for more details.
+ time.sleep(1)
resp = self.token.auth(user_id=user['id'],
password=new_password).response
subject_token = resp['x-subject-token']
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 0364f3a..03a0391 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -35,7 +35,7 @@
@classmethod
def disable_tenant(cls, tenant_name):
tenant = cls.get_tenant_by_name(tenant_name)
- cls.client.update_tenant(tenant['id'], enabled=False)
+ cls.tenants_client.update_tenant(tenant['id'], enabled=False)
@classmethod
def get_user_by_name(cls, name):
@@ -47,7 +47,7 @@
@classmethod
def get_tenant_by_name(cls, name):
try:
- tenants = cls.client.list_tenants()['tenants']
+ tenants = cls.tenants_client.list_tenants()['tenants']
except AttributeError:
tenants = cls.client.list_projects()['projects']
tenant = [t for t in tenants if t['name'] == name]
@@ -75,6 +75,7 @@
super(BaseIdentityV2Test, cls).setup_clients()
cls.non_admin_client = cls.os.identity_public_client
cls.non_admin_token_client = cls.os.token_client
+ cls.non_admin_tenants_client = cls.os.tenants_public_client
@classmethod
def resource_setup(cls):
@@ -95,11 +96,13 @@
cls.client = cls.os_adm.identity_client
cls.non_admin_client = cls.os.identity_client
cls.token_client = cls.os_adm.token_client
+ cls.tenants_client = cls.os_adm.tenants_client
+ cls.non_admin_tenants_client = cls.os.tenants_client
@classmethod
def resource_setup(cls):
super(BaseIdentityV2AdminTest, cls).resource_setup()
- cls.data = DataGenerator(cls.client)
+ cls.data = DataGenerator(cls.client, cls.tenants_client)
@classmethod
def resource_cleanup(cls):
@@ -184,8 +187,10 @@
class DataGenerator(object):
- def __init__(self, client):
+ def __init__(self, client, tenants_client=None):
self.client = client
+ # TODO(dmellado) split Datagenerator for v2 and v3
+ self.tenants_client = tenants_client
self.users = []
self.tenants = []
self.roles = []
@@ -219,7 +224,7 @@
"""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.tenants_client.create_tenant(
name=self.test_tenant,
description=self.test_description)['tenant']
self.tenants.append(self.tenant)
@@ -287,7 +292,7 @@
for user in self.users:
self._try_wrapper(self.client.delete_user, user)
for tenant in self.tenants:
- self._try_wrapper(self.client.delete_tenant, tenant)
+ self._try_wrapper(self.tenants_client.delete_tenant, tenant)
for role in self.roles:
self._try_wrapper(self.client.delete_role, role)
for v3_user in self.v3_users:
diff --git a/tempest/api/identity/v2/test_ec2_credentials.py b/tempest/api/identity/v2/test_ec2_credentials.py
index 763d8de..88161a3 100644
--- a/tempest/api/identity/v2/test_ec2_credentials.py
+++ b/tempest/api/identity/v2/test_ec2_credentials.py
@@ -38,7 +38,7 @@
"""Create user ec2 credentials."""
resp = self.non_admin_client.create_user_ec2_credentials(
self.creds.credentials.user_id,
- self.creds.credentials.tenant_id)["credential"]
+ tenant_id=self.creds.credentials.tenant_id)["credential"]
access = resp['access']
self.addCleanup(
self.non_admin_client.delete_user_ec2_credentials,
@@ -56,12 +56,12 @@
# create first ec2 credentials
creds1 = self.non_admin_client.create_user_ec2_credentials(
self.creds.credentials.user_id,
- self.creds.credentials.tenant_id)["credential"]
+ tenant_id=self.creds.credentials.tenant_id)["credential"]
created_creds.append(creds1['access'])
# create second ec2 credentials
creds2 = self.non_admin_client.create_user_ec2_credentials(
self.creds.credentials.user_id,
- self.creds.credentials.tenant_id)["credential"]
+ tenant_id=self.creds.credentials.tenant_id)["credential"]
created_creds.append(creds2['access'])
# add credentials to be cleaned up
self.addCleanup(
@@ -86,7 +86,7 @@
"""Get the definite user ec2 credentials."""
resp = self.non_admin_client.create_user_ec2_credentials(
self.creds.credentials.user_id,
- self.creds.credentials.tenant_id)["credential"]
+ tenant_id=self.creds.credentials.tenant_id)["credential"]
self.addCleanup(
self.non_admin_client.delete_user_ec2_credentials,
self.creds.credentials.user_id, resp['access'])
@@ -102,7 +102,7 @@
"""Delete user ec2 credentials."""
resp = self.non_admin_client.create_user_ec2_credentials(
self.creds.credentials.user_id,
- self.creds.credentials.tenant_id)["credential"]
+ tenant_id=self.creds.credentials.tenant_id)["credential"]
access = resp['access']
self.non_admin_client.delete_user_ec2_credentials(
self.creds.credentials.user_id, access)
diff --git a/tempest/api/identity/v2/test_tenants.py b/tempest/api/identity/v2/test_tenants.py
index 1fcff8d..4e31557 100644
--- a/tempest/api/identity/v2/test_tenants.py
+++ b/tempest/api/identity/v2/test_tenants.py
@@ -26,7 +26,7 @@
@test.idempotent_id('ecae2459-243d-4ba1-ad02-65f15dc82b78')
def test_list_tenants_returns_only_authorized_tenants(self):
alt_tenant_name = self.alt_manager.credentials.credentials.tenant_name
- resp = self.non_admin_client.list_tenants()
+ resp = self.non_admin_tenants_client.list_tenants()
# check that user can see only that tenants that he presents in so user
# can successfully authenticate using his credentials and tenant name
diff --git a/tempest/api/identity/v2/test_users.py b/tempest/api/identity/v2/test_users.py
index 03c6621..5f2a8c4 100644
--- a/tempest/api/identity/v2/test_users.py
+++ b/tempest/api/identity/v2/test_users.py
@@ -56,8 +56,8 @@
old_pass=new_pass)
# user updates own password
- resp = self.non_admin_client.update_user_own_password(
- user_id=user_id, new_pass=new_pass, old_pass=old_pass)['access']
+ self.non_admin_client.update_user_own_password(
+ user_id=user_id, new_pass=new_pass, old_pass=old_pass)
# TODO(lbragstad): Sleeping after the response status has been checked
# and the body loaded as JSON allows requests to fail-fast. The sleep
@@ -68,8 +68,6 @@
# sub-second precision.
time.sleep(1)
- # check authorization with new token
- self.non_admin_token_client.auth_token(resp['token']['id'])
# check authorization with new password
self.non_admin_token_client.auth(self.username,
new_pass,
diff --git a/tempest/api/image/v2/test_images_member.py b/tempest/api/image/v2/test_images_member.py
index 98ff64b..bb73318 100644
--- a/tempest/api/image/v2/test_images_member.py
+++ b/tempest/api/image/v2/test_images_member.py
@@ -19,8 +19,8 @@
@test.idempotent_id('5934c6ea-27dc-4d6e-9421-eeb5e045494a')
def test_image_share_accept(self):
image_id = self._create_image()
- member = self.os_img_client.add_image_member(image_id,
- member=self.alt_tenant_id)
+ member = self.os_img_client.create_image_member(
+ image_id, member=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')
@@ -40,8 +40,8 @@
@test.idempotent_id('d9e83e5f-3524-4b38-a900-22abcb26e90e')
def test_image_share_reject(self):
image_id = self._create_image()
- member = self.os_img_client.add_image_member(image_id,
- member=self.alt_tenant_id)
+ member = self.os_img_client.create_image_member(
+ image_id, member=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')
@@ -54,8 +54,8 @@
@test.idempotent_id('a6ee18b9-4378-465e-9ad9-9a6de58a3287')
def test_get_image_member(self):
image_id = self._create_image()
- self.os_img_client.add_image_member(image_id,
- member=self.alt_tenant_id)
+ self.os_img_client.create_image_member(
+ image_id, member=self.alt_tenant_id)
self.alt_img_client.update_image_member(image_id,
self.alt_tenant_id,
status='accepted')
@@ -70,8 +70,8 @@
@test.idempotent_id('72989bc7-2268-48ed-af22-8821e835c914')
def test_remove_image_member(self):
image_id = self._create_image()
- self.os_img_client.add_image_member(image_id,
- member=self.alt_tenant_id)
+ self.os_img_client.create_image_member(
+ image_id, member=self.alt_tenant_id)
self.alt_img_client.update_image_member(image_id,
self.alt_tenant_id,
status='accepted')
@@ -93,8 +93,8 @@
@test.idempotent_id('cb961424-3f68-4d21-8e36-30ad66fb6bfb')
def test_get_private_image(self):
image_id = self._create_image()
- member = self.os_img_client.add_image_member(image_id,
- member=self.alt_tenant_id)
+ member = self.os_img_client.create_image_member(
+ image_id, member=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')
diff --git a/tempest/api/image/v2/test_images_member_negative.py b/tempest/api/image/v2/test_images_member_negative.py
index d5ea291..eb90719 100644
--- a/tempest/api/image/v2/test_images_member_negative.py
+++ b/tempest/api/image/v2/test_images_member_negative.py
@@ -22,8 +22,8 @@
@test.idempotent_id('b79efb37-820d-4cf0-b54c-308b00cf842c')
def test_image_share_invalid_status(self):
image_id = self._create_image()
- member = self.os_img_client.add_image_member(image_id,
- member=self.alt_tenant_id)
+ member = self.os_img_client.create_image_member(
+ image_id, member=self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertRaises(lib_exc.BadRequest,
self.alt_img_client.update_image_member,
@@ -34,8 +34,8 @@
@test.idempotent_id('27002f74-109e-4a37-acd0-f91cd4597967')
def test_image_share_owner_cannot_accept(self):
image_id = self._create_image()
- member = self.os_img_client.add_image_member(image_id,
- member=self.alt_tenant_id)
+ member = self.os_img_client.create_image_member(
+ image_id, member=self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
self.assertRaises(lib_exc.Forbidden,
diff --git a/tempest/api/volume/admin/test_volume_services.py b/tempest/api/volume/admin/test_volume_services.py
index 6692594..2b7ee45 100644
--- a/tempest/api/volume/admin/test_volume_services.py
+++ b/tempest/api/volume/admin/test_volume_services.py
@@ -39,9 +39,8 @@
@test.idempotent_id('63a3e1ca-37ee-4983-826d-83276a370d25')
def test_get_service_by_service_binary_name(self):
- params = {'binary': self.binary_name}
- services = (self.admin_volume_services_client.list_services(params)
- ['services'])
+ services = (self.admin_volume_services_client.list_services(
+ binary=self.binary_name)['services'])
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(self.binary_name, service['binary'])
@@ -50,10 +49,9 @@
def test_get_service_by_host_name(self):
services_on_host = [service for service in self.services if
service['host'] == self.host_name]
- params = {'host': self.host_name}
- services = (self.admin_volume_services_client.list_services(params)
- ['services'])
+ services = (self.admin_volume_services_client.list_services(
+ host=self.host_name)['services'])
# we could have a periodic job checkin between the 2 service
# lookups, so only compare binary lists.
@@ -65,10 +63,10 @@
@test.idempotent_id('ffa6167c-4497-4944-a464-226bbdb53908')
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'])
+ services = (self.admin_volume_services_client.list_services(
+ host=self.host_name, binary=self.binary_name))['services']
+
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_volumes_backup.py b/tempest/api/volume/admin/test_volumes_backup.py
index 0399413..ed34a9b 100644
--- a/tempest/api/volume/admin/test_volumes_backup.py
+++ b/tempest/api/volume/admin/test_volumes_backup.py
@@ -48,7 +48,7 @@
# Create backup
backup_name = data_utils.rand_name('Backup')
create_backup = self.backups_adm_client.create_backup
- backup = create_backup(self.volume['id'],
+ backup = create_backup(volume_id=self.volume['id'],
name=backup_name)['backup']
self.addCleanup(self.backups_adm_client.delete_backup,
backup['id'])
@@ -85,9 +85,8 @@
def test_volume_backup_export_import(self):
# Create backup
backup_name = data_utils.rand_name('Backup')
- backup = (self.backups_adm_client.create_backup(self.volume['id'],
- name=backup_name)
- ['backup'])
+ backup = (self.backups_adm_client.create_backup(
+ volume_id=self.volume['id'], name=backup_name)['backup'])
self.addCleanup(self._delete_backup, backup['id'])
self.assertEqual(backup_name, backup['name'])
self.backups_adm_client.wait_for_backup_status(backup['id'],
diff --git a/tempest/api_schema/response/compute/v2_1/volumes.py b/tempest/api_schema/response/compute/v2_1/volumes.py
deleted file mode 100644
index bb34acb..0000000
--- a/tempest/api_schema/response/compute/v2_1/volumes.py
+++ /dev/null
@@ -1,120 +0,0 @@
-# Copyright 2014 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-create_get_volume = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'volume': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'status': {'type': 'string'},
- 'displayName': {'type': ['string', 'null']},
- 'availabilityZone': {'type': 'string'},
- 'createdAt': {'type': 'string'},
- 'displayDescription': {'type': ['string', 'null']},
- 'volumeType': {'type': ['string', 'null']},
- 'snapshotId': {'type': ['string', 'null']},
- 'metadata': {'type': 'object'},
- 'size': {'type': 'integer'},
- 'attachments': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'device': {'type': 'string'},
- 'volumeId': {'type': 'string'},
- 'serverId': {'type': 'string'}
- },
- 'additionalProperties': False,
- # NOTE- If volume is not attached to any server
- # then, 'attachments' attributes comes as array
- # with empty objects "[{}]" due to that elements
- # of 'attachments' cannot defined as 'required'.
- # If it would come as empty array "[]" then,
- # those elements can be defined as 'required'.
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['id', 'status', 'displayName', 'availabilityZone',
- 'createdAt', 'displayDescription', 'volumeType',
- 'snapshotId', 'metadata', 'size', 'attachments']
- }
- },
- 'additionalProperties': False,
- 'required': ['volume']
- }
-}
-
-list_volumes = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'volumes': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'status': {'type': 'string'},
- 'displayName': {'type': ['string', 'null']},
- 'availabilityZone': {'type': 'string'},
- 'createdAt': {'type': 'string'},
- 'displayDescription': {'type': ['string', 'null']},
- 'volumeType': {'type': ['string', 'null']},
- 'snapshotId': {'type': ['string', 'null']},
- 'metadata': {'type': 'object'},
- 'size': {'type': 'integer'},
- 'attachments': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'device': {'type': 'string'},
- 'volumeId': {'type': 'string'},
- 'serverId': {'type': 'string'}
- },
- 'additionalProperties': False,
- # NOTE- If volume is not attached to any server
- # then, 'attachments' attributes comes as array
- # with empty object "[{}]" due to that elements
- # of 'attachments' cannot defined as 'required'
- # If it would come as empty array "[]" then,
- # those elements can be defined as 'required'.
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['id', 'status', 'displayName',
- 'availabilityZone', 'createdAt',
- 'displayDescription', 'volumeType',
- 'snapshotId', 'metadata', 'size',
- 'attachments']
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['volumes']
- }
-}
-
-delete_volume = {
- 'status_code': [202]
-}
diff --git a/tempest/clients.py b/tempest/clients.py
index fe44094..f40e0ea 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -50,7 +50,7 @@
from tempest_lib.services.compute.security_group_default_rules_client import \
SecurityGroupDefaultRulesClient
from tempest_lib.services.compute.security_groups_client import \
- SecurityGroupsClient
+ SecurityGroupsClient as ComputeSecurityGroupsClient
from tempest_lib.services.compute.services_client import ServicesClient
from tempest_lib.services.compute.snapshots_client import \
SnapshotsClient as ComputeSnapshotsClient
@@ -59,6 +59,8 @@
from tempest_lib.services.compute.tenant_usages_client import \
TenantUsagesClient
from tempest_lib.services.compute.versions_client import VersionsClient
+from tempest_lib.services.compute.volumes_client import \
+ VolumesClient as ComputeVolumesClient
from tempest_lib.services.identity.v2.token_client import TokenClient
from tempest_lib.services.identity.v3.token_client import V3TokenClient
@@ -77,8 +79,6 @@
from tempest.services.compute.json.server_groups_client import \
ServerGroupsClient
from tempest.services.compute.json.servers_client import ServersClient
-from tempest.services.compute.json.volumes_client import \
- VolumesClient as ComputeVolumesClient
from tempest.services.data_processing.v1_1.data_processing_client import \
DataProcessingClient
from tempest.services.database.json.flavors_client import \
@@ -89,6 +89,8 @@
DatabaseVersionsClient
from tempest.services.identity.v2.json.identity_client import \
IdentityClient
+from tempest.services.identity.v2.json.tenants_client import \
+ TenantsClient
from tempest.services.identity.v3.json.credentials_client import \
CredentialsClient as CredentialsV3Client
from tempest.services.identity.v3.json.endpoints_client import \
@@ -124,38 +126,41 @@
from tempest.services.telemetry.json.telemetry_client import \
TelemetryClient
from tempest.services.volume.v1.json.admin.hosts_client import \
- VolumeHostsClient
+ HostsClient as VolumeHostsClient
from tempest.services.volume.v1.json.admin.quotas_client import \
- VolumeQuotasClient
+ QuotasClient as VolumeQuotasClient
from tempest.services.volume.v1.json.admin.services_client import \
- VolumesServicesClient
+ ServicesClient as VolumeServicesClient
from tempest.services.volume.v1.json.admin.types_client import \
- VolumeTypesClient
+ TypesClient as VolumeTypesClient
from tempest.services.volume.v1.json.availability_zone_client import \
- VolumeAvailabilityZoneClient
+ AvailabilityZoneClient as VolumeAvailabilityZoneClient
from tempest.services.volume.v1.json.backups_client import BackupsClient
from tempest.services.volume.v1.json.extensions_client import \
- ExtensionsClient as VolumeExtensionClient
+ ExtensionsClient as VolumeExtensionsClient
from tempest.services.volume.v1.json.qos_client import QosSpecsClient
from tempest.services.volume.v1.json.snapshots_client import SnapshotsClient
from tempest.services.volume.v1.json.volumes_client import VolumesClient
from tempest.services.volume.v2.json.admin.hosts_client import \
- VolumeHostsV2Client
+ HostsClient as VolumeHostsV2Client
from tempest.services.volume.v2.json.admin.quotas_client import \
- VolumeQuotasV2Client
+ QuotasClient as VolumeQuotasV2Client
from tempest.services.volume.v2.json.admin.services_client import \
- VolumesServicesV2Client
+ ServicesClient as VolumeServicesV2Client
from tempest.services.volume.v2.json.admin.types_client import \
- VolumeTypesV2Client
+ TypesClient as VolumeTypesV2Client
from tempest.services.volume.v2.json.availability_zone_client import \
- VolumeV2AvailabilityZoneClient
-from tempest.services.volume.v2.json.backups_client import BackupsClientV2
+ AvailabilityZoneClient as VolumeAvailabilityZoneV2Client
+from tempest.services.volume.v2.json.backups_client import \
+ BackupsClient as BackupsV2Client
from tempest.services.volume.v2.json.extensions_client import \
- ExtensionsV2Client as VolumeV2ExtensionClient
-from tempest.services.volume.v2.json.qos_client import QosSpecsV2Client
+ ExtensionsClient as VolumeExtensionsV2Client
+from tempest.services.volume.v2.json.qos_client import \
+ QosSpecsClient as QosSpecsV2Client
from tempest.services.volume.v2.json.snapshots_client import \
- SnapshotsV2Client
-from tempest.services.volume.v2.json.volumes_client import VolumesV2Client
+ SnapshotsClient as SnapshotsV2Client
+from tempest.services.volume.v2.json.volumes_client import \
+ VolumesClient as VolumesV2Client
CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -355,7 +360,7 @@
self.auth_provider, **params)
self.security_group_rules_client = SecurityGroupRulesClient(
self.auth_provider, **params)
- self.security_groups_client = SecurityGroupsClient(
+ self.compute_security_groups_client = ComputeSecurityGroupsClient(
self.auth_provider, **params)
self.interfaces_client = InterfacesClient(self.auth_provider,
**params)
@@ -420,12 +425,16 @@
# Client uses admin endpoint type of Keystone API v2
self.identity_client = IdentityClient(self.auth_provider,
**params_v2_admin)
+ self.tenants_client = TenantsClient(self.auth_provider,
+ **params_v2_admin)
params_v2_public = params.copy()
params_v2_public['endpoint_type'] = (
CONF.identity.v2_public_endpoint_type)
# Client uses public endpoint type of Keystone API v2
self.identity_public_client = IdentityClient(self.auth_provider,
**params_v2_public)
+ self.tenants_public_client = TenantsClient(self.auth_provider,
+ **params_v2_public)
params_v3 = params.copy()
params_v3['endpoint_type'] = CONF.identity.v3_endpoint_type
# Clients below use the endpoint type of Keystone API v3
@@ -471,10 +480,12 @@
**params)
self.volume_qos_v2_client = QosSpecsV2Client(
self.auth_provider, **params)
- self.volume_services_v2_client = VolumesServicesV2Client(
+ self.volume_services_client = VolumeServicesClient(
+ self.auth_provider, **params)
+ self.volume_services_v2_client = VolumeServicesV2Client(
self.auth_provider, **params)
self.backups_client = BackupsClient(self.auth_provider, **params)
- self.backups_v2_client = BackupsClientV2(self.auth_provider,
+ self.backups_v2_client = BackupsV2Client(self.auth_provider,
**params)
self.snapshots_client = SnapshotsClient(self.auth_provider,
**params)
@@ -488,7 +499,7 @@
**params)
self.volume_types_client = VolumeTypesClient(self.auth_provider,
**params)
- self.volume_services_client = VolumesServicesClient(
+ self.volume_types_v2_client = VolumeTypesV2Client(
self.auth_provider, **params)
self.volume_hosts_client = VolumeHostsClient(self.auth_provider,
**params)
@@ -498,16 +509,14 @@
**params)
self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider,
**params)
- self.volumes_extension_client = VolumeExtensionClient(
+ self.volumes_extension_client = VolumeExtensionsClient(
self.auth_provider, **params)
- self.volumes_v2_extension_client = VolumeV2ExtensionClient(
+ self.volumes_v2_extension_client = VolumeExtensionsV2Client(
self.auth_provider, **params)
self.volume_availability_zone_client = \
VolumeAvailabilityZoneClient(self.auth_provider, **params)
self.volume_v2_availability_zone_client = \
- VolumeV2AvailabilityZoneClient(self.auth_provider, **params)
- self.volume_types_v2_client = VolumeTypesV2Client(
- self.auth_provider, **params)
+ VolumeAvailabilityZoneV2Client(self.auth_provider, **params)
def _set_object_storage_clients(self):
params = {
diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py
index 613fb26..64c9b00 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -93,6 +93,7 @@
from tempest import config
from tempest import exceptions as exc
from tempest.services.identity.v2.json import identity_client
+from tempest.services.identity.v2.json import tenants_client
from tempest.services.network.json import network_client
from tempest.services.network.json import networks_client
from tempest.services.network.json import subnets_client
@@ -138,6 +139,13 @@
endpoint_type='adminURL',
**params
)
+ tenants_admin = tenants_client.TenantsClient(
+ _auth,
+ CONF.identity.catalog_type,
+ CONF.identity.region,
+ endpoint_type='adminURL',
+ **params
+ )
network_admin = None
networks_admin = None
subnets_admin = None
@@ -163,12 +171,12 @@
CONF.network.region or CONF.identity.region,
endpoint_type='adminURL',
**params)
- return (identity_admin, neutron_iso_networks, network_admin,
+ return (identity_admin, tenants_admin, neutron_iso_networks, network_admin,
networks_admin, subnets_admin)
def create_resources(opts, resources):
- (identity_admin, neutron_iso_networks,
+ (identity_admin, tenants_admin, neutron_iso_networks,
network_admin, networks_admin, subnets_admin) = get_admin_clients(opts)
roles = identity_admin.list_roles()['roles']
for u in resources['users']:
@@ -180,22 +188,22 @@
msg = "Role: %s doesn't exist" % r
raise exc.InvalidConfiguration(msg)
u['role_ids'] += [role['id']]
- existing = [x['name'] for x in identity_admin.list_tenants()['tenants']]
+ existing = [x['name'] for x in tenants_admin.list_tenants()['tenants']]
for tenant in resources['tenants']:
if tenant not in existing:
- identity_admin.create_tenant(tenant)
+ tenants_admin.create_tenant(tenant)
else:
LOG.warn("Tenant '%s' already exists in this environment" % tenant)
LOG.info('Tenants created')
for u in resources['users']:
try:
- tenant = identity.get_tenant_by_name(identity_admin, u['tenant'])
+ tenant = identity.get_tenant_by_name(tenants_admin, u['tenant'])
except tempest_lib.exceptions.NotFound:
LOG.error("Tenant: %s - not found" % u['tenant'])
continue
while True:
try:
- identity.get_user_by_username(identity_admin,
+ identity.get_user_by_username(tenants_admin,
tenant['id'], u['name'])
except tempest_lib.exceptions.NotFound:
identity_admin.create_user(
@@ -211,7 +219,7 @@
LOG.info('Users created')
if neutron_iso_networks:
for u in resources['users']:
- tenant = identity.get_tenant_by_name(identity_admin, u['tenant'])
+ tenant = identity.get_tenant_by_name(tenants_admin, u['tenant'])
network_name, router_name = create_network_resources(
network_admin, networks_admin, subnets_admin, tenant['id'],
u['name'])
@@ -220,12 +228,12 @@
LOG.info('Networks created')
for u in resources['users']:
try:
- tenant = identity.get_tenant_by_name(identity_admin, u['tenant'])
+ tenant = identity.get_tenant_by_name(tenants_admin, u['tenant'])
except tempest_lib.exceptions.NotFound:
LOG.error("Tenant: %s - not found" % u['tenant'])
continue
try:
- user = identity.get_user_by_username(identity_admin,
+ user = identity.get_user_by_username(tenants_admin,
tenant['id'], u['name'])
except tempest_lib.exceptions.NotFound:
LOG.error("User: %s - not found" % u['user'])
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index 98af9c1..b5b78c6 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -85,10 +85,10 @@
def _get_network_id(net_name, tenant_name):
am = credentials.AdminManager()
net_cl = am.networks_client
- id_cl = am.identity_client
+ tn_cl = am.tenants_client
networks = net_cl.list_networks()
- tenant = identity.get_tenant_by_name(id_cl, tenant_name)
+ tenant = identity.get_tenant_by_name(tn_cl, tenant_name)
t_id = tenant['id']
n_id = None
for net in networks['networks']:
@@ -269,7 +269,7 @@
class SecurityGroupService(BaseService):
def __init__(self, manager, **kwargs):
super(SecurityGroupService, self).__init__(kwargs)
- self.client = manager.security_groups_client
+ self.client = manager.compute_security_groups_client
def list(self):
client = self.client
@@ -895,9 +895,12 @@
class TenantService(IdentityService):
+ def __init__(self, manager, **kwargs):
+ super(TenantService, self).__init__(kwargs)
+ self.client = manager.tenants_client
+
def list(self):
- client = self.client
- tenants = client.list_tenants()['tenants']
+ tenants = self.client.list_tenants()['tenants']
if not self.is_save_state:
tenants = [tenant for tenant in tenants if (tenant['id']
not in self.saved_state_json['tenants'].keys()
@@ -911,11 +914,10 @@
return tenants
def delete(self):
- client = self.client
tenants = self.list()
for tenant in tenants:
try:
- client.delete_tenant(tenant['id'])
+ self.client.delete_tenant(tenant['id'])
except Exception:
LOG.exception("Delete Tenant exception.")
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index c5e4a7e..826d8e8 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -128,6 +128,7 @@
from tempest.services.compute.json import security_group_rules_client
from tempest.services.compute.json import servers_client
from tempest.services.identity.v2.json import identity_client
+from tempest.services.identity.v2.json import tenants_client
from tempest.services.image.v2.json import images_client
from tempest.services.network.json import network_client
from tempest.services.network.json import subnets_client
@@ -199,6 +200,12 @@
CONF.identity.region,
endpoint_type='adminURL',
**default_params_with_timeout_values)
+ self.tenants = tenants_client.TenantsClient(
+ _auth,
+ CONF.identity.catalog_type,
+ CONF.identity.region,
+ endpoint_type='adminURL',
+ **default_params_with_timeout_values)
self.servers = servers_client.ServersClient(_auth,
**compute_params)
self.flavors = flavors_client.FlavorsClient(_auth,
@@ -291,11 +298,11 @@
Don't create the tenants if they already exist.
"""
admin = keystone_admin()
- body = admin.identity.list_tenants()['tenants']
+ body = admin.tenants.list_tenants()['tenants']
existing = [x['name'] for x in body]
for tenant in tenants:
if tenant not in existing:
- admin.identity.create_tenant(tenant)['tenant']
+ admin.tenants.create_tenant(tenant)['tenant']
else:
LOG.warn("Tenant '%s' already exists in this environment" % tenant)
@@ -303,8 +310,8 @@
def destroy_tenants(tenants):
admin = keystone_admin()
for tenant in tenants:
- tenant_id = identity.get_tenant_by_name(admin.identity, tenant)['id']
- admin.identity.delete_tenant(tenant_id)
+ tenant_id = identity.get_tenant_by_name(admin.tenant, tenant)['id']
+ admin.tenants.delete_tenant(tenant_id)
##############
#
@@ -355,7 +362,7 @@
admin = keystone_admin()
for u in users:
try:
- tenant = identity.get_tenant_by_name(admin.identity, u['tenant'])
+ tenant = identity.get_tenant_by_name(admin.tenants, u['tenant'])
except lib_exc.NotFound:
LOG.error("Tenant: %s - not found" % u['tenant'])
continue
@@ -374,7 +381,7 @@
def destroy_users(users):
admin = keystone_admin()
for user in users:
- tenant_id = identity.get_tenant_by_name(admin.identity,
+ tenant_id = identity.get_tenant_by_name(admin.tenants,
user['tenant'])['id']
user_id = identity.get_user_by_username(admin.identity,
tenant_id, user['name'])['id']
@@ -386,7 +393,7 @@
LOG.info("Collecting users")
admin = keystone_admin()
for u in users:
- tenant = identity.get_tenant_by_name(admin.identity, u['tenant'])
+ tenant = identity.get_tenant_by_name(admin.tenants, u['tenant'])
u['tenant_id'] = tenant['id']
USERS[u['name']] = u
body = identity.get_user_by_username(admin.identity,
@@ -895,7 +902,7 @@
client.servers.wait_for_server_status(server_id, 'ACTIVE')
# create security group(s) after server spawning
for secgroup in server['secgroups']:
- client.servers.add_security_group(server_id, secgroup)
+ client.servers.add_security_group(server_id, name=secgroup)
if CONF.compute.use_floatingip_for_ssh:
floating_ip_pool = server.get('floating_ip_pool')
floating_ip = client.floating_ips.create_floating_ip(
diff --git a/tempest/cmd/run_stress.py b/tempest/cmd/run_stress.py
old mode 100755
new mode 100644
index 80f1b85..f99e5d9
--- a/tempest/cmd/run_stress.py
+++ b/tempest/cmd/run_stress.py
@@ -23,6 +23,7 @@
# unittest in python 2.6 does not contain loader, so uses unittest2
from unittest2 import loader
+from cliff import command
from oslo_log import log as logging
from oslo_serialization import jsonutils as json
from testtools import testsuite
@@ -70,29 +71,42 @@
return tests
-parser = argparse.ArgumentParser(description='Run stress tests')
-parser.add_argument('-d', '--duration', default=300, type=int,
- help="Duration of test in secs")
-parser.add_argument('-s', '--serial', action='store_true',
- help="Trigger running tests serially")
-parser.add_argument('-S', '--stop', action='store_true',
- default=False, help="Stop on first error")
-parser.add_argument('-n', '--number', type=int,
- help="How often an action is executed for each process")
-group = parser.add_mutually_exclusive_group(required=True)
-group.add_argument('-a', '--all', action='store_true',
- help="Execute all stress tests")
-parser.add_argument('-T', '--type',
- help="Filters tests of a certain type (e.g. gate)")
-parser.add_argument('-i', '--call-inherited', action='store_true',
- default=False,
- help="Call also inherited function with stress attribute")
-group.add_argument('-t', "--tests", nargs='?',
- help="Name of the file with test description")
+class TempestRunStress(command.Command):
+
+ def get_parser(self, prog_name):
+ pa = super(TempestRunStress, self).get_parser(prog_name)
+ pa = add_arguments(pa)
+ return pa
+
+ def take_action(self, pa):
+ return action(pa)
-def main():
- ns = parser.parse_args()
+def add_arguments(parser):
+ parser.add_argument('-d', '--duration', default=300, type=int,
+ help="Duration of test in secs")
+ parser.add_argument('-s', '--serial', action='store_true',
+ help="Trigger running tests serially")
+ parser.add_argument('-S', '--stop', action='store_true',
+ default=False, help="Stop on first error")
+ parser.add_argument('-n', '--number', type=int,
+ help="How often an action is executed for each "
+ "process")
+ group = parser.add_mutually_exclusive_group(required=True)
+ group.add_argument('-a', '--all', action='store_true',
+ help="Execute all stress tests")
+ parser.add_argument('-T', '--type',
+ help="Filters tests of a certain type (e.g. gate)")
+ parser.add_argument('-i', '--call-inherited', action='store_true',
+ default=False,
+ help="Call also inherited function with stress "
+ "attribute")
+ group.add_argument('-t', "--tests", nargs='?',
+ help="Name of the file with test description")
+ return parser
+
+
+def action(ns):
result = 0
if not ns.all:
tests = json.load(open(ns.tests, 'r'))
@@ -121,6 +135,15 @@
return result
+def main():
+ LOG.warning("Deprecated: Use 'tempest run-stress' instead. "
+ "The old entrypoint will be removed in a future release.")
+ parser = argparse.ArgumentParser(description='Run stress tests')
+ pa = add_arguments(parser)
+ ns = pa.parse_args()
+ return action(ns)
+
+
if __name__ == "__main__":
try:
sys.exit(main())
diff --git a/tempest/common/api_version_request.py b/tempest/common/api_version_request.py
index 72a11ea..d8a5b56 100644
--- a/tempest/common/api_version_request.py
+++ b/tempest/common/api_version_request.py
@@ -54,6 +54,8 @@
None value should be used to create Null APIVersionRequest,
which is equal to 0.0
"""
+ # NOTE(gmann): 'version_string' as String "None" will be considered as
+ # invalid version string.
self.ver_major = 0
self.ver_minor = 0
diff --git a/tempest/common/cred_client.py b/tempest/common/cred_client.py
index 13baafb..94515dc 100644
--- a/tempest/common/cred_client.py
+++ b/tempest/common/cred_client.py
@@ -31,9 +31,12 @@
admin credentials used for generating credentials.
"""
- def __init__(self, identity_client):
+ def __init__(self, identity_client, projects_client=None):
# The client implies version and credentials
self.identity_client = identity_client
+ # this is temporary until the v3 project client is
+ # separated, then projects_client will become mandatory
+ self.projects_client = projects_client or identity_client
def create_user(self, username, password, project, email):
user = self.identity_client.create_user(
@@ -91,8 +94,11 @@
class V2CredsClient(CredsClient):
+ def __init__(self, identity_client, projects_client):
+ super(V2CredsClient, self).__init__(identity_client, projects_client)
+
def create_project(self, name, description):
- tenant = self.identity_client.create_tenant(
+ tenant = self.projects_client.create_tenant(
name=name, description=description)['tenant']
return tenant
@@ -108,7 +114,7 @@
password=password)
def delete_project(self, project_id):
- self.identity_client.delete_tenant(project_id)
+ self.projects_client.delete_tenant(project_id)
class V3CredsClient(CredsClient):
@@ -152,8 +158,10 @@
return roles
-def get_creds_client(identity_client, project_domain_name=None):
+def get_creds_client(identity_client,
+ projects_client=None,
+ project_domain_name=None):
if isinstance(identity_client, v2_identity.IdentityClient):
- return V2CredsClient(identity_client)
+ return V2CredsClient(identity_client, projects_client)
else:
return V3CredsClient(identity_client, project_domain_name)
diff --git a/tempest/common/dynamic_creds.py b/tempest/common/dynamic_creds.py
index e950c3e..813d94f 100644
--- a/tempest/common/dynamic_creds.py
+++ b/tempest/common/dynamic_creds.py
@@ -57,7 +57,8 @@
self._creds = {}
self.ports = []
self.default_admin_creds = admin_creds
- (self.identity_admin_client, self.network_admin_client,
+ (self.identity_admin_client, self.tenants_admin_client,
+ self.network_admin_client,
self.networks_admin_client,
self.subnets_admin_client,
self.ports_admin_client) = self._get_admin_clients()
@@ -69,7 +70,9 @@
self.default_admin_creds.project_domain_name or
self.credentials_domain)
self.creds_client = cred_client.get_creds_client(
- self.identity_admin_client, self.creds_domain_name)
+ self.identity_admin_client,
+ self.tenants_admin_client,
+ self.creds_domain_name)
def _get_admin_clients(self):
"""Returns a tuple with instances of the following admin clients
@@ -80,10 +83,10 @@
"""
os = clients.Manager(self.default_admin_creds)
if self.identity_version == 'v2':
- return (os.identity_client, os.network_client, os.networks_client,
- os.subnets_client, os.ports_client)
+ return (os.identity_client, os.tenants_client, os.network_client,
+ os.networks_client, os.subnets_client, os.ports_client)
else:
- return (os.identity_v3_client, os.network_client,
+ return (os.identity_v3_client, None, os.network_client,
os.networks_client, os.subnets_client, os.ports_client)
def _create_creds(self, suffix="", admin=False, roles=None):
diff --git a/tempest/common/validation_resources.py b/tempest/common/validation_resources.py
index 1908b68..f526299 100644
--- a/tempest/common/validation_resources.py
+++ b/tempest/common/validation_resources.py
@@ -23,7 +23,7 @@
def create_ssh_security_group(os, add_rule=False):
- security_groups_client = os.security_groups_client
+ security_groups_client = os.compute_security_groups_client
security_group_rules_client = os.security_group_rules_client
sg_name = data_utils.rand_name('securitygroup-')
sg_description = data_utils.rand_name('description-')
@@ -81,7 +81,7 @@
if not has_exception:
has_exception = exc
if 'security_group' in validation_data:
- security_group_client = os.security_groups_client
+ security_group_client = os.compute_security_groups_client
sec_id = validation_data['security_group']['id']
try:
security_group_client.delete_security_group(sec_id)
diff --git a/tempest/config.py b/tempest/config.py
index 26dda2d..a6212fb 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -347,16 +347,18 @@
"The format is 'X.Y', where 'X' and 'Y' are int values. "
"Tempest selects tests based on the range between "
"min_microversion and max_microversion. "
- "If both values are None, Tempest avoids tests which "
- "require a microversion."),
+ "If both values are not specified, Tempest avoids tests "
+ "which require a microversion. Valid values are string "
+ "with format 'X.Y' or string 'latest'"),
cfg.StrOpt('max_microversion',
default=None,
help="Upper version of the test target microversion range. "
"The format is 'X.Y', where 'X' and 'Y' are int values. "
"Tempest selects tests based on the range between "
"min_microversion and max_microversion. "
- "If both values are None, Tempest avoids tests which "
- "require a microversion."),
+ "If both values are not specified, Tempest avoids tests "
+ "which require a microversion. Valid values are string "
+ "with format 'X.Y' or string 'latest'"),
cfg.BoolOpt('disk_config',
default=True,
help="If false, skip disk config tests"),
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 8537898..1d725af 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -177,8 +177,8 @@
class InvalidAPIVersionString(TempestException):
- msg_fmt = ("API Version String %(version)s is of invalid format. Must "
- "be of format MajorNum.MinorNum.")
+ message = ("API Version String %(version)s is of invalid format. Must "
+ "be of format MajorNum.MinorNum or string 'latest'.")
class CommandFailed(Exception):
diff --git a/tempest/hacking/ignored_list_T110.txt b/tempest/hacking/ignored_list_T110.txt
index dd3e489..8de3151 100644
--- a/tempest/hacking/ignored_list_T110.txt
+++ b/tempest/hacking/ignored_list_T110.txt
@@ -1,6 +1,4 @@
-./tempest/services/database/json/flavors_client.py
./tempest/services/identity/v3/json/identity_client.py
-./tempest/services/identity/v3/json/policy_client.py
./tempest/services/messaging/json/messaging_client.py
./tempest/services/object_storage/object_client.py
./tempest/services/telemetry/json/alarming_client.py
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 24877f4..c304136 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -55,7 +55,8 @@
cls.images_client = cls.manager.images_client
cls.keypairs_client = cls.manager.keypairs_client
# Nova security groups client
- cls.security_groups_client = cls.manager.security_groups_client
+ cls.compute_security_groups_client = (
+ cls.manager.compute_security_groups_client)
cls.security_group_rules_client = (
cls.manager.security_group_rules_client)
cls.servers_client = cls.manager.servers_client
@@ -286,7 +287,7 @@
return volume
def _create_loginable_secgroup_rule(self, secgroup_id=None):
- _client = self.security_groups_client
+ _client = self.compute_security_groups_client
_client_rules = self.security_group_rules_client
if secgroup_id is None:
sgs = _client.list_security_groups()['security_groups']
@@ -328,13 +329,14 @@
# Create security group
sg_name = data_utils.rand_name(self.__class__.__name__)
sg_desc = sg_name + " description"
- secgroup = self.security_groups_client.create_security_group(
+ secgroup = self.compute_security_groups_client.create_security_group(
name=sg_name, description=sg_desc)['security_group']
self.assertEqual(secgroup['name'], sg_name)
self.assertEqual(secgroup['description'], sg_desc)
- self.addCleanup(self.delete_wrapper,
- self.security_groups_client.delete_security_group,
- secgroup['id'])
+ self.addCleanup(
+ self.delete_wrapper,
+ self.compute_security_groups_client.delete_security_group,
+ secgroup['id'])
# Add rules to the security group
self._create_loginable_secgroup_rule(secgroup['id'])
diff --git a/tempest/scenario/test_large_ops.py b/tempest/scenario/test_large_ops.py
index f45fb3a..b549ecb 100644
--- a/tempest/scenario/test_large_ops.py
+++ b/tempest/scenario/test_large_ops.py
@@ -85,11 +85,12 @@
# Explicitly create secgroup to avoid cleanup at the end of testcases.
# Since no traffic is tested, we don't need to actually add rules to
# secgroup
- secgroup = self.security_groups_client.create_security_group(
+ secgroup = self.compute_security_groups_client.create_security_group(
name='secgroup-%s' % name,
description='secgroup-desc-%s' % name)['security_group']
- self.addCleanupClass(self.security_groups_client.delete_security_group,
- secgroup['id'])
+ self.addCleanupClass(
+ self.compute_security_groups_client.delete_security_group,
+ secgroup['id'])
create_kwargs = {
'min_count': CONF.scenario.large_ops_number,
'security_groups': [{'name': secgroup['name']}]
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 25e3e6f..585b19d 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -95,7 +95,7 @@
def create_and_add_security_group_to_server(self, server):
secgroup = self._create_security_group()
self.servers_client.add_security_group(server['id'],
- secgroup['name'])
+ name=secgroup['name'])
self.addCleanup(self.servers_client.remove_security_group,
server['id'], secgroup['name'])
diff --git a/tempest/services/botoclients.py b/tempest/services/botoclients.py
index e117719..9d452ff 100644
--- a/tempest/services/botoclients.py
+++ b/tempest/services/botoclients.py
@@ -101,8 +101,8 @@
break
else:
ec2_cred = (identity_client.create_user_ec2_credentials(
- identity_client.user_id, identity_client.tenant_id)
- ['credential'])
+ identity_client.user_id,
+ tenant_id=identity_client.tenant_id)['credential'])
if not all((ec2_cred, ec2_cred['access'], ec2_cred['secret'])):
raise lib_exc.NotFound("Unable to get access and secret keys")
else:
diff --git a/tempest/services/compute/json/base.py b/tempest/services/compute/json/base.py
new file mode 100644
index 0000000..02e9f8b
--- /dev/null
+++ b/tempest/services/compute/json/base.py
@@ -0,0 +1,25 @@
+# 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 service_client
+
+
+class BaseComputeClient(service_client.ServiceClient):
+ api_microversion = None
+
+ def get_headers(self):
+ headers = super(BaseComputeClient, self).get_headers()
+ if self.api_microversion:
+ headers['X-OpenStack-Nova-API-Version'] = self.api_microversion
+ return headers
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index a0251f1..80b3094 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -32,7 +32,10 @@
self.enable_instance_password = enable_instance_password
def create_server(self, **kwargs):
- """Create server
+ """Create server.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-compute-v2.1.html#createServer
Most parameters except the following are passed to the API without
any changes.
@@ -69,7 +72,10 @@
return service_client.ResponseBody(resp, body)
def update_server(self, server_id, **kwargs):
- """Update server
+ """Update server.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-compute-v2.1.html#updateServer
Most parameters except the following are passed to the API without
any changes.
@@ -85,20 +91,26 @@
return service_client.ResponseBody(resp, body)
def show_server(self, server_id):
- """Get server details"""
+ """Get server details."""
resp, body = self.get("servers/%s" % server_id)
body = json.loads(body)
self.validate_response(schema.get_server, resp, body)
return service_client.ResponseBody(resp, body)
def delete_server(self, server_id):
- """Delete server"""
+ """Delete server."""
resp, body = self.delete("servers/%s" % server_id)
self.validate_response(schema.delete_server, resp, body)
return service_client.ResponseBody(resp, body)
def list_servers(self, detail=False, **params):
- """List servers"""
+ """List servers.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-compute-v2.1.html#listServers
+ and http://developer.openstack.org/
+ api-ref-compute-v2.1.html#listDetailServers
+ """
url = 'servers'
_schema = schema.list_servers
@@ -140,17 +152,21 @@
self.validate_response(schema, resp, body)
return service_client.ResponseBody(resp, body)
- def create_backup(self, server_id, backup_type, rotation, name):
- """Backup a server instance."""
- return self.action(server_id, "createBackup",
- backup_type=backup_type,
- rotation=rotation,
- name=name)
+ def create_backup(self, server_id, **kwargs):
+ """Backup a server instance.
- def change_password(self, server_id, adminPass):
- """Changes the root password for the server."""
- return self.action(server_id, 'changePassword',
- adminPass=adminPass)
+ Available params: see http://developer.openstack.org/
+ api-ref-compute-v2.1.html#createBackup
+ """
+ return self.action(server_id, "createBackup", **kwargs)
+
+ def change_password(self, server_id, **kwargs):
+ """Change the root password for the server.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-compute-v2.1.html#changePassword
+ """
+ return self.action(server_id, 'changePassword', **kwargs)
def show_password(self, server_id):
resp, body = self.get("servers/%s/os-server-password" %
@@ -205,7 +221,11 @@
return self.action(server_id, 'resize', **kwargs)
def confirm_resize_server(self, server_id, **kwargs):
- """Confirms the flavor change for a server."""
+ """Confirm the flavor change for a server.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-compute-v2.1.html#confirmResize
+ """
return self.action(server_id, 'confirmResize',
schema.server_actions_confirm_resize,
**kwargs)
@@ -301,9 +321,16 @@
self.validate_response(schema.list_volume_attachments, resp, body)
return service_client.ResponseBody(resp, body)
- def add_security_group(self, server_id, name):
- """Adds a security group to the server."""
- return self.action(server_id, 'addSecurityGroup', name=name)
+ def add_security_group(self, server_id, **kwargs):
+ """Add a security group to the server.
+
+ Available params: TODO
+ """
+ # TODO(oomichi): The api-site doesn't contain this API description.
+ # So the above should be changed to the api-site link after
+ # adding the description on the api-site.
+ # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1524199
+ return self.action(server_id, 'addSecurityGroup', **kwargs)
def remove_security_group(self, server_id, name):
"""Removes a security group from the server."""
@@ -311,13 +338,7 @@
def live_migrate_server(self, server_id, **kwargs):
"""This should be called with administrator privileges ."""
-
- req_body = json.dumps({'os-migrateLive': kwargs})
-
- resp, body = self.post("servers/%s/action" % server_id, req_body)
- self.validate_response(schema.server_actions_common_schema,
- resp, body)
- return service_client.ResponseBody(resp, body)
+ return self.action(server_id, 'os-migrateLive', **kwargs)
def migrate_server(self, server_id, **kwargs):
"""Migrates a server to a new host."""
@@ -431,7 +452,11 @@
type=console_type)
def add_fixed_ip(self, server_id, **kwargs):
- """Add a fixed IP to input server instance."""
+ """Add a fixed IP to server instance.
+
+ Available params: http://developer.openstack.org/
+ api-ref-compute-v2.1.html#addFixedIp
+ """
return self.action(server_id, 'addFixedIp', **kwargs)
def remove_fixed_ip(self, server_id, **kwargs):
diff --git a/tempest/services/compute/json/volumes_client.py b/tempest/services/compute/json/volumes_client.py
deleted file mode 100644
index 69d982e..0000000
--- a/tempest/services/compute/json/volumes_client.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# Copyright 2012 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 oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-from tempest_lib import exceptions as lib_exc
-
-from tempest.api_schema.response.compute.v2_1 import volumes as schema
-from tempest.common import service_client
-
-
-class VolumesClient(service_client.ServiceClient):
-
- def list_volumes(self, detail=False, **params):
- """List all the volumes created."""
- url = 'os-volumes'
-
- if detail:
- url += '/detail'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_volumes, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_volume(self, volume_id):
- """Returns the details of a single volume."""
- url = "os-volumes/%s" % volume_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.create_get_volume, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def create_volume(self, **kwargs):
- """Creates a new Volume.
-
- size(Required): Size of volume in GB.
- Following optional keyword arguments are accepted:
- display_name: Optional Volume Name.
- metadata: A dictionary of values to be used as metadata.
- """
- post_body = json.dumps({'volume': kwargs})
- resp, body = self.post('os-volumes', post_body)
- body = json.loads(body)
- self.validate_response(schema.create_get_volume, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_volume(self, volume_id):
- """Deletes the Specified Volume."""
- resp, body = self.delete("os-volumes/%s" % volume_id)
- self.validate_response(schema.delete_volume, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def is_resource_deleted(self, id):
- try:
- self.show_volume(id)
- except lib_exc.NotFound:
- return True
- return False
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'volume'
diff --git a/tempest/services/database/json/flavors_client.py b/tempest/services/database/json/flavors_client.py
index 88feb17..34a91ba 100644
--- a/tempest/services/database/json/flavors_client.py
+++ b/tempest/services/database/json/flavors_client.py
@@ -31,8 +31,8 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def get_db_flavor_details(self, db_flavor_id):
- resp, body = self.get("flavors/%s" % str(db_flavor_id))
+ def show_db_flavor(self, db_flavor_id):
+ resp, body = self.get("flavors/%s" % db_flavor_id)
self.expected_success(200, resp.status)
body = json.loads(body)
return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/identity/v2/json/identity_client.py b/tempest/services/identity/v2/json/identity_client.py
index 3f6727d..f80e22d 100644
--- a/tempest/services/identity/v2/json/identity_client.py
+++ b/tempest/services/identity/v2/json/identity_client.py
@@ -44,24 +44,6 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def create_tenant(self, name, **kwargs):
- """Create a tenant
-
- name (required): New tenant name
- description: Description of new tenant (default is none)
- enabled <true|false>: Initial tenant status (default is true)
- """
- post_body = {
- 'name': name,
- 'description': kwargs.get('description', ''),
- 'enabled': kwargs.get('enabled', True),
- }
- post_body = json.dumps({'tenant': post_body})
- resp, body = self.post('tenants', post_body)
- self.expected_success(200, resp.status)
- body = json.loads(body)
- return service_client.ResponseBody(resp, body)
-
def delete_role(self, role_id):
"""Delete a role."""
resp, body = self.delete('OS-KSADM/roles/%s' % str(role_id))
@@ -91,19 +73,6 @@
self.expected_success(204, resp.status)
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 service_client.ResponseBody(resp, body)
-
- def show_tenant(self, tenant_id):
- """Get tenant details."""
- resp, body = self.get('tenants/%s' % str(tenant_id))
- self.expected_success(200, resp.status)
- body = json.loads(body)
- return service_client.ResponseBody(resp, body)
-
def list_roles(self):
"""Returns roles."""
resp, body = self.get('OS-KSADM/roles')
@@ -111,31 +80,6 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def list_tenants(self):
- """Returns tenants."""
- resp, body = self.get('tenants')
- self.expected_success(200, resp.status)
- body = json.loads(body)
- return service_client.ResponseBody(resp, body)
-
- def update_tenant(self, tenant_id, **kwargs):
- """Updates a tenant."""
- body = self.show_tenant(tenant_id)['tenant']
- name = kwargs.get('name', body['name'])
- desc = kwargs.get('description', body['description'])
- en = kwargs.get('enabled', body['enabled'])
- post_body = {
- 'id': tenant_id,
- 'name': name,
- 'description': desc,
- 'enabled': en,
- }
- post_body = json.dumps({'tenant': post_body})
- resp, body = self.post('tenants/%s' % tenant_id, post_body)
- self.expected_success(200, resp.status)
- body = json.loads(body)
- return service_client.ResponseBody(resp, body)
-
def create_user(self, name, password, tenant_id, email, **kwargs):
"""Create a user."""
post_body = {
@@ -205,13 +149,6 @@
self.expected_success(204, resp.status)
return service_client.ResponseBody(resp, body)
- def list_tenant_users(self, tenant_id):
- """List users for a Tenant."""
- resp, body = self.get('/tenants/%s/users' % tenant_id)
- self.expected_success(200, resp.status)
- body = json.loads(body)
- return service_client.ResponseBody(resp, body)
-
def create_service(self, name, type, **kwargs):
"""Create a service."""
post_body = {
@@ -307,8 +244,11 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def create_user_ec2_credentials(self, user_id, tenant_id):
- post_body = json.dumps({'tenant_id': tenant_id})
+ def create_user_ec2_credentials(self, user_id, **kwargs):
+ # TODO(piyush): Current api-site doesn't contain this API description.
+ # After fixing the api-site, we need to fix here also for putting the
+ # link to api-site.
+ post_body = json.dumps(kwargs)
resp, body = self.post('/users/%s/credentials/OS-EC2' % user_id,
post_body)
self.expected_success(200, resp.status)
diff --git a/tempest/services/identity/v2/json/tenants_client.py b/tempest/services/identity/v2/json/tenants_client.py
new file mode 100644
index 0000000..937ae6f
--- /dev/null
+++ b/tempest/services/identity/v2/json/tenants_client.py
@@ -0,0 +1,84 @@
+# Copyright 2015 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from oslo_serialization import jsonutils as json
+
+from tempest.common import service_client
+
+
+class TenantsClient(service_client.ServiceClient):
+ api_version = "v2.0"
+
+ def create_tenant(self, name, **kwargs):
+ """Create a tenant
+
+ name (required): New tenant name
+ description: Description of new tenant (default is none)
+ enabled <true|false>: Initial tenant status (default is true)
+ """
+ post_body = {
+ 'name': name,
+ 'description': kwargs.get('description', ''),
+ 'enabled': kwargs.get('enabled', True),
+ }
+ post_body = json.dumps({'tenant': post_body})
+ resp, body = self.post('tenants', post_body)
+ self.expected_success(200, resp.status)
+ body = json.loads(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 service_client.ResponseBody(resp, body)
+
+ def show_tenant(self, tenant_id):
+ """Get tenant details."""
+ resp, body = self.get('tenants/%s' % str(tenant_id))
+ self.expected_success(200, resp.status)
+ body = json.loads(body)
+ return service_client.ResponseBody(resp, body)
+
+ def list_tenants(self):
+ """Returns tenants."""
+ resp, body = self.get('tenants')
+ self.expected_success(200, resp.status)
+ body = json.loads(body)
+ return service_client.ResponseBody(resp, body)
+
+ def update_tenant(self, tenant_id, **kwargs):
+ """Updates a tenant."""
+ body = self.show_tenant(tenant_id)['tenant']
+ name = kwargs.get('name', body['name'])
+ desc = kwargs.get('description', body['description'])
+ en = kwargs.get('enabled', body['enabled'])
+ post_body = {
+ 'id': tenant_id,
+ 'name': name,
+ 'description': desc,
+ 'enabled': en,
+ }
+ post_body = json.dumps({'tenant': post_body})
+ resp, body = self.post('tenants/%s' % tenant_id, post_body)
+ self.expected_success(200, resp.status)
+ body = json.loads(body)
+ return service_client.ResponseBody(resp, body)
+
+ def list_tenant_users(self, tenant_id):
+ """List users for a Tenant."""
+ resp, body = self.get('/tenants/%s/users' % tenant_id)
+ self.expected_success(200, resp.status)
+ body = json.loads(body)
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/identity/v3/json/policy_client.py b/tempest/services/identity/v3/json/policy_client.py
index ecc9df7..7927ed5 100644
--- a/tempest/services/identity/v3/json/policy_client.py
+++ b/tempest/services/identity/v3/json/policy_client.py
@@ -44,7 +44,7 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def get_policy(self, policy_id):
+ def show_policy(self, policy_id):
"""Lists out the given policy."""
url = 'policies/%s' % policy_id
resp, body = self.get(url)
diff --git a/tempest/services/image/v2/json/images_client.py b/tempest/services/image/v2/json/images_client.py
index 33bfcb8..44062ea 100644
--- a/tempest/services/image/v2/json/images_client.py
+++ b/tempest/services/image/v2/json/images_client.py
@@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import jsonschema
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc
@@ -49,14 +48,6 @@
insecure=self.dscv,
ca_certs=self.ca_certs)
- def _validate_schema(self, body, type='image'):
- if type in ['image', 'images']:
- schema = self.show_schema(type)
- else:
- raise ValueError("%s is not a valid schema type" % type)
-
- jsonschema.validate(body, schema)
-
@property
def http(self):
if self._http is None:
@@ -65,8 +56,6 @@
def update_image(self, image_id, patch):
data = json.dumps(patch)
- self._validate_schema(data)
-
headers = {"Content-Type": "application/openstack-images-v2.0"
"-json-patch"}
resp, body = self.patch('v2/images/%s' % image_id, data, headers)
@@ -89,8 +78,6 @@
params[option] = value
data = json.dumps(params)
- self._validate_schema(data)
-
resp, body = self.post('v2/images', data)
self.expected_success(201, resp.status)
body = json.loads(body)
@@ -123,7 +110,6 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- self._validate_schema(body, type='images')
return service_client.ResponseBody(resp, body)
def show_image(self, image_id):
@@ -178,7 +164,12 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def add_image_member(self, image_id, **kwargs):
+ def create_image_member(self, image_id, **kwargs):
+ """Create an image member.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-image-v2.html#createImageMember-v2
+ """
url = 'v2/images/%s/members' % image_id
data = json.dumps(kwargs)
resp, body = self.post(url, data)
@@ -232,8 +223,6 @@
api-ref-image-v2.html#createNamespace-v2
"""
data = json.dumps(kwargs)
- self._validate_schema(data)
-
resp, body = self.post('/v2/metadefs/namespaces', data)
self.expected_success(201, resp.status)
body = json.loads(body)
@@ -257,7 +246,6 @@
params = {'namespace': namespace}
params.update(kwargs)
data = json.dumps(params)
- self._validate_schema(data)
url = '/v2/metadefs/namespaces/%s' % namespace
resp, body = self.put(url, body=data)
self.expected_success(200, resp.status)
diff --git a/tempest/services/volume/base/admin/base_hosts_client.py b/tempest/services/volume/base/admin/base_hosts_client.py
index 97bb007..074f87f 100644
--- a/tempest/services/volume/base/admin/base_hosts_client.py
+++ b/tempest/services/volume/base/admin/base_hosts_client.py
@@ -19,7 +19,7 @@
from tempest.common import service_client
-class BaseVolumeHostsClient(service_client.ServiceClient):
+class BaseHostsClient(service_client.ServiceClient):
"""Client class to send CRUD Volume Hosts API requests"""
def list_hosts(self, **params):
diff --git a/tempest/services/volume/base/admin/base_quotas_client.py b/tempest/services/volume/base/admin/base_quotas_client.py
index ad8ba03..e063a31 100644
--- a/tempest/services/volume/base/admin/base_quotas_client.py
+++ b/tempest/services/volume/base/admin/base_quotas_client.py
@@ -18,7 +18,7 @@
from tempest.common import service_client
-class BaseVolumeQuotasClient(service_client.ServiceClient):
+class BaseQuotasClient(service_client.ServiceClient):
"""Client class to send CRUD Volume Quotas API requests"""
TYPE = "json"
diff --git a/tempest/services/volume/base/admin/base_services_client.py b/tempest/services/volume/base/admin/base_services_client.py
index 1790421..3626469 100644
--- a/tempest/services/volume/base/admin/base_services_client.py
+++ b/tempest/services/volume/base/admin/base_services_client.py
@@ -19,9 +19,9 @@
from tempest.common import service_client
-class BaseVolumesServicesClient(service_client.ServiceClient):
+class BaseServicesClient(service_client.ServiceClient):
- def list_services(self, params=None):
+ def list_services(self, **params):
url = 'os-services'
if params:
url += '?%s' % urllib.urlencode(params)
diff --git a/tempest/services/volume/base/admin/base_types_client.py b/tempest/services/volume/base/admin/base_types_client.py
index 8fcf57c..de6ea8a 100644
--- a/tempest/services/volume/base/admin/base_types_client.py
+++ b/tempest/services/volume/base/admin/base_types_client.py
@@ -20,7 +20,7 @@
from tempest.common import service_client
-class BaseVolumeTypesClient(service_client.ServiceClient):
+class BaseTypesClient(service_client.ServiceClient):
"""Client class to send CRUD Volume Types API requests"""
def is_resource_deleted(self, resource):
diff --git a/tempest/services/volume/base/base_availability_zone_client.py b/tempest/services/volume/base/base_availability_zone_client.py
index d5a2fda..b63fdc2 100644
--- a/tempest/services/volume/base/base_availability_zone_client.py
+++ b/tempest/services/volume/base/base_availability_zone_client.py
@@ -18,7 +18,7 @@
from tempest.common import service_client
-class BaseVolumeAvailabilityZoneClient(service_client.ServiceClient):
+class BaseAvailabilityZoneClient(service_client.ServiceClient):
def list_availability_zones(self):
resp, body = self.get('os-availability-zone')
diff --git a/tempest/services/volume/base/base_backups_client.py b/tempest/services/volume/base/base_backups_client.py
index be926e6..fc9a40a 100644
--- a/tempest/services/volume/base/base_backups_client.py
+++ b/tempest/services/volume/base/base_backups_client.py
@@ -25,26 +25,17 @@
class BaseBackupsClient(service_client.ServiceClient):
"""Client class to send CRUD Volume backup API requests"""
- def create_backup(self, volume_id, container=None, name=None,
- description=None):
+ def create_backup(self, **kwargs):
"""Creates a backup of volume."""
- post_body = {'volume_id': volume_id}
- if container:
- post_body['container'] = container
- if name:
- post_body['name'] = name
- if description:
- post_body['description'] = description
- post_body = json.dumps({'backup': post_body})
+ post_body = json.dumps({'backup': kwargs})
resp, body = self.post('backups', post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
return service_client.ResponseBody(resp, body)
- def restore_backup(self, backup_id, volume_id=None):
+ def restore_backup(self, backup_id, **kwargs):
"""Restore volume from backup."""
- post_body = {'volume_id': volume_id}
- post_body = json.dumps({'restore': post_body})
+ post_body = json.dumps({'restore': kwargs})
resp, body = self.post('backups/%s/restore' % (backup_id), post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
@@ -82,11 +73,9 @@
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body)
- def import_backup(self, backup_service, backup_url):
+ def import_backup(self, **kwargs):
"""Import backup metadata record."""
- post_body = {'backup_service': backup_service,
- 'backup_url': backup_url}
- post_body = json.dumps({'backup-record': post_body})
+ post_body = json.dumps({'backup-record': kwargs})
resp, body = self.post("backups/import_record", post_body)
body = json.loads(body)
self.expected_success(201, resp.status)
diff --git a/tempest/services/volume/v1/json/admin/hosts_client.py b/tempest/services/volume/v1/json/admin/hosts_client.py
index 1b685bd..3b52968 100644
--- a/tempest/services/volume/v1/json/admin/hosts_client.py
+++ b/tempest/services/volume/v1/json/admin/hosts_client.py
@@ -16,5 +16,5 @@
from tempest.services.volume.base.admin import base_hosts_client
-class VolumeHostsClient(base_hosts_client.BaseVolumeHostsClient):
+class HostsClient(base_hosts_client.BaseHostsClient):
"""Client class to send CRUD Volume Host API V1 requests"""
diff --git a/tempest/services/volume/v1/json/admin/quotas_client.py b/tempest/services/volume/v1/json/admin/quotas_client.py
index 5ca074e..27fc301 100644
--- a/tempest/services/volume/v1/json/admin/quotas_client.py
+++ b/tempest/services/volume/v1/json/admin/quotas_client.py
@@ -15,5 +15,5 @@
from tempest.services.volume.base.admin import base_quotas_client
-class VolumeQuotasClient(base_quotas_client.BaseVolumeQuotasClient):
+class QuotasClient(base_quotas_client.BaseQuotasClient):
"""Client class to send CRUD Volume Type API V1 requests"""
diff --git a/tempest/services/volume/v1/json/admin/services_client.py b/tempest/services/volume/v1/json/admin/services_client.py
index efe02d8..2bffd55 100644
--- a/tempest/services/volume/v1/json/admin/services_client.py
+++ b/tempest/services/volume/v1/json/admin/services_client.py
@@ -16,5 +16,5 @@
from tempest.services.volume.base.admin import base_services_client
-class VolumesServicesClient(base_services_client.BaseVolumesServicesClient):
+class ServicesClient(base_services_client.BaseServicesClient):
"""Volume V1 volume services client"""
diff --git a/tempest/services/volume/v1/json/admin/types_client.py b/tempest/services/volume/v1/json/admin/types_client.py
index 4bd1579..0e84296 100644
--- a/tempest/services/volume/v1/json/admin/types_client.py
+++ b/tempest/services/volume/v1/json/admin/types_client.py
@@ -16,5 +16,5 @@
from tempest.services.volume.base.admin import base_types_client
-class VolumeTypesClient(base_types_client.BaseVolumeTypesClient):
+class TypesClient(base_types_client.BaseTypesClient):
"""Volume V1 Volume Types client"""
diff --git a/tempest/services/volume/v1/json/availability_zone_client.py b/tempest/services/volume/v1/json/availability_zone_client.py
index d8180fa..3a27027 100644
--- a/tempest/services/volume/v1/json/availability_zone_client.py
+++ b/tempest/services/volume/v1/json/availability_zone_client.py
@@ -16,6 +16,6 @@
from tempest.services.volume.base import base_availability_zone_client
-class VolumeAvailabilityZoneClient(
- base_availability_zone_client.BaseVolumeAvailabilityZoneClient):
+class AvailabilityZoneClient(
+ base_availability_zone_client.BaseAvailabilityZoneClient):
"""Volume V1 availability zone client."""
diff --git a/tempest/services/volume/v2/json/admin/hosts_client.py b/tempest/services/volume/v2/json/admin/hosts_client.py
index 7bdc6f7..e092c6a 100644
--- a/tempest/services/volume/v2/json/admin/hosts_client.py
+++ b/tempest/services/volume/v2/json/admin/hosts_client.py
@@ -16,6 +16,6 @@
from tempest.services.volume.base.admin import base_hosts_client
-class VolumeHostsV2Client(base_hosts_client.BaseVolumeHostsClient):
+class HostsClient(base_hosts_client.BaseHostsClient):
"""Client class to send CRUD Volume V2 API requests"""
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/admin/quotas_client.py b/tempest/services/volume/v2/json/admin/quotas_client.py
index b2d3604..11e0e22 100644
--- a/tempest/services/volume/v2/json/admin/quotas_client.py
+++ b/tempest/services/volume/v2/json/admin/quotas_client.py
@@ -16,6 +16,6 @@
from tempest.services.volume.base.admin import base_quotas_client
-class VolumeQuotasV2Client(base_quotas_client.BaseVolumeQuotasClient):
+class QuotasClient(base_quotas_client.BaseQuotasClient):
"""Client class to send CRUD Volume V2 API requests"""
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/admin/services_client.py b/tempest/services/volume/v2/json/admin/services_client.py
index 3912c9d..db19ba9 100644
--- a/tempest/services/volume/v2/json/admin/services_client.py
+++ b/tempest/services/volume/v2/json/admin/services_client.py
@@ -16,6 +16,6 @@
from tempest.services.volume.base.admin import base_services_client
-class VolumesServicesV2Client(base_services_client.BaseVolumesServicesClient):
+class ServicesClient(base_services_client.BaseServicesClient):
"""Client class to send CRUD Volume V2 API requests"""
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/admin/types_client.py b/tempest/services/volume/v2/json/admin/types_client.py
index d9eba7e..ecf5131 100644
--- a/tempest/services/volume/v2/json/admin/types_client.py
+++ b/tempest/services/volume/v2/json/admin/types_client.py
@@ -16,6 +16,6 @@
from tempest.services.volume.base.admin import base_types_client
-class VolumeTypesV2Client(base_types_client.BaseVolumeTypesClient):
+class TypesClient(base_types_client.BaseTypesClient):
"""Client class to send CRUD Volume V2 API requests"""
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/availability_zone_client.py b/tempest/services/volume/v2/json/availability_zone_client.py
index a4fc9fe..905ebdc 100644
--- a/tempest/services/volume/v2/json/availability_zone_client.py
+++ b/tempest/services/volume/v2/json/availability_zone_client.py
@@ -16,6 +16,6 @@
from tempest.services.volume.base import base_availability_zone_client
-class VolumeV2AvailabilityZoneClient(
- base_availability_zone_client.BaseVolumeAvailabilityZoneClient):
+class AvailabilityZoneClient(
+ base_availability_zone_client.BaseAvailabilityZoneClient):
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/backups_client.py b/tempest/services/volume/v2/json/backups_client.py
index 15d363b..78bab82 100644
--- a/tempest/services/volume/v2/json/backups_client.py
+++ b/tempest/services/volume/v2/json/backups_client.py
@@ -16,6 +16,6 @@
from tempest.services.volume.base import base_backups_client
-class BackupsClientV2(base_backups_client.BaseBackupsClient):
+class BackupsClient(base_backups_client.BaseBackupsClient):
"""Client class to send CRUD Volume V2 API requests"""
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/extensions_client.py b/tempest/services/volume/v2/json/extensions_client.py
index 004b232..245906f 100644
--- a/tempest/services/volume/v2/json/extensions_client.py
+++ b/tempest/services/volume/v2/json/extensions_client.py
@@ -16,5 +16,5 @@
from tempest.services.volume.base import base_extensions_client
-class ExtensionsV2Client(base_extensions_client.BaseExtensionsClient):
+class ExtensionsClient(base_extensions_client.BaseExtensionsClient):
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/qos_client.py b/tempest/services/volume/v2/json/qos_client.py
index e8b680a..3c0f74f 100644
--- a/tempest/services/volume/v2/json/qos_client.py
+++ b/tempest/services/volume/v2/json/qos_client.py
@@ -15,5 +15,5 @@
from tempest.services.volume.base import base_qos_client
-class QosSpecsV2Client(base_qos_client.BaseQosSpecsClient):
+class QosSpecsClient(base_qos_client.BaseQosSpecsClient):
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/snapshots_client.py b/tempest/services/volume/v2/json/snapshots_client.py
index 28a9e98..a2d415f 100644
--- a/tempest/services/volume/v2/json/snapshots_client.py
+++ b/tempest/services/volume/v2/json/snapshots_client.py
@@ -13,7 +13,7 @@
from tempest.services.volume.base import base_snapshots_client
-class SnapshotsV2Client(base_snapshots_client.BaseSnapshotsClient):
+class SnapshotsClient(base_snapshots_client.BaseSnapshotsClient):
"""Client class to send CRUD Volume V2 API requests."""
api_version = "v2"
create_resp = 202
diff --git a/tempest/services/volume/v2/json/volumes_client.py b/tempest/services/volume/v2/json/volumes_client.py
index 51daa94..b7d9dfb 100644
--- a/tempest/services/volume/v2/json/volumes_client.py
+++ b/tempest/services/volume/v2/json/volumes_client.py
@@ -16,7 +16,7 @@
from tempest.services.volume.base import base_volumes_client
-class VolumesV2Client(base_volumes_client.BaseVolumesClient):
+class VolumesClient(base_volumes_client.BaseVolumesClient):
"""Client class to send CRUD Volume V2 API requests"""
api_version = "v2"
create_resp = 202
diff --git a/tempest/stress/README.rst b/tempest/stress/README.rst
index 4f1f56c..33842fd 100644
--- a/tempest/stress/README.rst
+++ b/tempest/stress/README.rst
@@ -33,17 +33,17 @@
The stress test framework can automatically discover test inside the tempest
test suite. All test flag with the `@stresstest` decorator will be executed.
-In order to use this discovery you have to be in the tempest root directory
-and execute the following:
+In order to use this discovery you have to install tempest CLI, be in the
+tempest root directory and execute the following:
- run-tempest-stress -a -d 30
+ tempest run-stress -a -d 30
Running the sample test
-----------------------
To test installation, do the following:
- run-tempest-stress -t tempest/stress/etc/server-create-destroy-test.json -d 30
+ tempest run-stress -t tempest/stress/etc/server-create-destroy-test.json -d 30
This sample test tries to create a few VMs and kill a few VMs.
diff --git a/tempest/stress/actions/ssh_floating.py b/tempest/stress/actions/ssh_floating.py
index 6bac570..4f8c6bd 100644
--- a/tempest/stress/actions/ssh_floating.py
+++ b/tempest/stress/actions/ssh_floating.py
@@ -91,7 +91,7 @@
self.logger.info("deleted %s" % self.server_id)
def _create_sec_group(self):
- sec_grp_cli = self.manager.security_groups_client
+ sec_grp_cli = self.manager.compute_security_groups_client
s_name = data_utils.rand_name('sec_grp')
s_description = data_utils.rand_name('desc')
self.sec_grp = sec_grp_cli.create_security_group(
@@ -103,7 +103,7 @@
from_port=-1, to_port=-1)
def _destroy_sec_grp(self):
- sec_grp_cli = self.manager.security_groups_client
+ sec_grp_cli = self.manager.compute_security_groups_client
sec_grp_cli.delete_security_group(self.sec_grp['id'])
def _create_floating_ip(self):
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index fa0bb8b..2a23291 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -54,7 +54,7 @@
self.logger.info("deleted server: %s" % self.server_id)
def _create_sec_group(self):
- sec_grp_cli = self.manager.security_groups_client
+ sec_grp_cli = self.manager.compute_security_groups_client
s_name = data_utils.rand_name('sec_grp')
s_description = data_utils.rand_name('desc')
self.sec_grp = sec_grp_cli.create_security_group(
@@ -66,7 +66,7 @@
from_port=-1, to_port=-1)
def _destroy_sec_grp(self):
- sec_grp_cli = self.manager.security_groups_client
+ sec_grp_cli = self.manager.compute_security_groups_client
sec_grp_cli.delete_security_group(self.sec_grp['id'])
def _create_floating_ip(self):
diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py
index 993359d..5c25e32 100644
--- a/tempest/stress/cleanup.py
+++ b/tempest/stress/cleanup.py
@@ -48,7 +48,7 @@
except Exception:
pass
- secgrp_client = admin_manager.security_groups_client
+ secgrp_client = admin_manager.compute_security_groups_client
secgrp = (secgrp_client.list_security_groups(all_tenants=True)
['security_groups'])
secgrp_del = [grp for grp in secgrp if grp['name'] != 'default']
@@ -74,12 +74,11 @@
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']
+ tenants = admin_manager.tenants_client.list_tenants()['tenants']
LOG.info("Cleanup::remove %s tenants" % len(tenants))
for tenant in tenants:
if tenant['name'].startswith("stress_tenant"):
- admin_manager.identity_client.delete_tenant(tenant['id'])
+ admin_manager.tenants_client.delete_tenant(tenant['id'])
# We have to delete snapshots first or
# volume deletion may block
diff --git a/tempest/stress/driver.py b/tempest/stress/driver.py
index 8359efd..cac848b 100644
--- a/tempest/stress/driver.py
+++ b/tempest/stress/driver.py
@@ -146,14 +146,16 @@
password = "pass"
if CONF.identity.auth_version == 'v2':
identity_client = admin_manager.identity_client
+ projects_client = admin_manager.tenants_client
else:
identity_client = admin_manager.identity_v3_client
+ projects_client = None
credentials_client = cred_client.get_creds_client(
- identity_client)
+ identity_client, projects_client)
project = credentials_client.create_project(
name=tenant_name, description=tenant_name)
user = credentials_client.create_user(username, password,
- project['id'], "email")
+ project, "email")
# Add roles specified in config file
for conf_role in CONF.auth.tempest_roles:
credentials_client.assign_user_role(user, project,
diff --git a/tempest/test.py b/tempest/test.py
index 30eb93d..8e961f4 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -436,15 +436,18 @@
"""
if CONF.identity.auth_version == 'v2':
client = self.os_admin.identity_client
+ project_client = self.os_admin.tenants_client
else:
client = self.os_admin.identity_v3_client
+ project_client = None
try:
domain = client.auth_provider.credentials.project_domain_name
except AttributeError:
domain = 'Default'
- return cred_client.get_creds_client(client, domain)
+ return cred_client.get_creds_client(client, project_client,
+ project_domain_name=domain)
@classmethod
def get_identity_version(cls):
diff --git a/tempest/tests/cmd/test_javelin.py b/tempest/tests/cmd/test_javelin.py
index d328d56..56bc96c 100644
--- a/tempest/tests/cmd/test_javelin.py
+++ b/tempest/tests/cmd/test_javelin.py
@@ -85,24 +85,24 @@
class TestCreateResources(JavelinUnitTest):
def test_create_tenants(self):
- self.fake_client.identity.list_tenants.return_value = {'tenants': []}
+ self.fake_client.tenants.list_tenants.return_value = {'tenants': []}
self.useFixture(mockpatch.PatchObject(javelin, "keystone_admin",
return_value=self.fake_client))
javelin.create_tenants([self.fake_object['name']])
- mocked_function = self.fake_client.identity.create_tenant
+ mocked_function = self.fake_client.tenants.create_tenant
mocked_function.assert_called_once_with(self.fake_object['name'])
def test_create_duplicate_tenant(self):
- self.fake_client.identity.list_tenants.return_value = {'tenants': [
+ self.fake_client.tenants.list_tenants.return_value = {'tenants': [
{'name': self.fake_object['name']}]}
self.useFixture(mockpatch.PatchObject(javelin, "keystone_admin",
return_value=self.fake_client))
javelin.create_tenants([self.fake_object['name']])
- mocked_function = self.fake_client.identity.create_tenant
+ mocked_function = self.fake_client.tenants.create_tenant
self.assertFalse(mocked_function.called)
def test_create_users(self):
@@ -299,7 +299,7 @@
return_value=fake_auth))
javelin.destroy_tenants([fake_tenant])
- mocked_function = fake_auth.identity.delete_tenant
+ mocked_function = fake_auth.tenants.delete_tenant
mocked_function.assert_called_once_with(fake_tenant['id'])
def test_destroy_users(self):
@@ -308,7 +308,7 @@
fake_tenant = self.fake_object['tenant']
fake_auth = self.fake_client
- fake_auth.identity.list_tenants.return_value = \
+ fake_auth.tenants.list_tenants.return_value = \
{'tenants': [fake_tenant]}
fake_auth.identity.list_users.return_value = {'users': [fake_user]}
diff --git a/tempest/tests/common/test_dynamic_creds.py b/tempest/tests/common/test_dynamic_creds.py
index 78064a7..10acd14 100644
--- a/tempest/tests/common/test_dynamic_creds.py
+++ b/tempest/tests/common/test_dynamic_creds.py
@@ -24,6 +24,8 @@
from tempest import exceptions
from tempest.services.identity.v2.json import identity_client as \
json_iden_client
+from tempest.services.identity.v2.json import tenants_client as \
+ json_tenants_client
from tempest.services.network.json import network_client as json_network_client
from tempest.tests import base
from tempest.tests import fake_config
@@ -74,7 +76,7 @@
def _mock_tenant_create(self, id, name):
tenant_fix = self.useFixture(mockpatch.PatchObject(
- json_iden_client.IdentityClient,
+ json_tenants_client.TenantsClient,
'create_tenant',
return_value=(service_client.ResponseBody
(200, {'tenant': {'id': id, 'name': name}}))))
@@ -240,8 +242,8 @@
'tempest.services.identity.v2.json.identity_client.'
'IdentityClient.delete_user')
tenant_mock = self.patch(
- 'tempest.services.identity.v2.json.identity_client.'
- 'IdentityClient.delete_tenant')
+ 'tempest.services.identity.v2.json.tenants_client.'
+ 'TenantsClient.delete_tenant')
creds.clear_creds()
# Verify user delete calls
calls = user_mock.mock_calls
@@ -371,8 +373,8 @@
creds.get_admin_creds()
self.patch('tempest.services.identity.v2.json.identity_client.'
'IdentityClient.delete_user')
- self.patch('tempest.services.identity.v2.json.identity_client.'
- 'IdentityClient.delete_tenant')
+ self.patch('tempest.services.identity.v2.json.tenants_client.'
+ 'TenantsClient.delete_tenant')
net = mock.patch.object(creds.networks_admin_client,
'delete_network')
net_mock = net.start()
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index f051ac0..c313071 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -21,8 +21,6 @@
from tempest.services.compute.json import security_group_rules_client
from tempest.services.compute.json import server_groups_client
from tempest.services.compute.json import servers_client
-from tempest.services.compute.json import volumes_client \
- as compute_volumes_client
from tempest.services.data_processing.v1_1 import data_processing_client
from tempest.services.database.json import flavors_client as db_flavor_client
from tempest.services.database.json import versions_client as db_version_client
@@ -93,7 +91,6 @@
security_group_rules_client.SecurityGroupRulesClient,
server_groups_client.ServerGroupsClient,
servers_client.ServersClient,
- compute_volumes_client.VolumesClient,
data_processing_client.DataProcessingClient,
db_flavor_client.DatabaseFlavorsClient,
db_version_client.DatabaseVersionsClient,
@@ -106,25 +103,25 @@
telemetry_client.TelemetryClient,
alarming_client.AlarmingClient,
qos_client.QosSpecsClient,
- volume_hosts_client.VolumeHostsClient,
- volume_quotas_client.VolumeQuotasClient,
- volume_services_client.VolumesServicesClient,
- volume_types_client.VolumeTypesClient,
- volume_az_client.VolumeAvailabilityZoneClient,
+ volume_hosts_client.HostsClient,
+ volume_quotas_client.QuotasClient,
+ volume_services_client.ServicesClient,
+ volume_types_client.TypesClient,
+ volume_az_client.AvailabilityZoneClient,
backups_client.BackupsClient,
volume_extensions_client.ExtensionsClient,
snapshots_client.SnapshotsClient,
volumes_client.VolumesClient,
- volume_v2_hosts_client.VolumeHostsV2Client,
- volume_v2_quotas_client.VolumeQuotasV2Client,
- volume_v2_services_client.VolumesServicesV2Client,
- volume_v2_types_client.VolumeTypesV2Client,
- volume_v2_az_client.VolumeV2AvailabilityZoneClient,
- volume_v2_backups_client.BackupsClientV2,
- volume_v2_extensions_client.ExtensionsV2Client,
- volume_v2_qos_client.QosSpecsV2Client,
- volume_v2_snapshots_client.SnapshotsV2Client,
- volume_v2_volumes_client.VolumesV2Client,
+ volume_v2_hosts_client.HostsClient,
+ volume_v2_quotas_client.QuotasClient,
+ volume_v2_services_client.ServicesClient,
+ volume_v2_types_client.TypesClient,
+ volume_v2_az_client.AvailabilityZoneClient,
+ volume_v2_backups_client.BackupsClient,
+ volume_v2_extensions_client.ExtensionsClient,
+ volume_v2_qos_client.QosSpecsClient,
+ volume_v2_snapshots_client.SnapshotsClient,
+ volume_v2_volumes_client.VolumesClient,
identity_v2_identity_client.IdentityClient,
credentials_client.CredentialsClient,
endpoints_client.EndPointClient,
diff --git a/tempest/tests/services/compute/test_base_compute_client.py b/tempest/tests/services/compute/test_base_compute_client.py
new file mode 100644
index 0000000..13461e4
--- /dev/null
+++ b/tempest/tests/services/compute/test_base_compute_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.
+
+import httplib2
+import mock
+from tempest_lib.common import rest_client
+
+from tempest.services.compute.json import base as base_compute_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestClientWithoutMicroversionHeader(base.BaseComputeServiceTest):
+
+ def setUp(self):
+ super(TestClientWithoutMicroversionHeader, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = base_compute_client.BaseComputeClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def test_no_microverion_header(self):
+ header = self.client.get_headers()
+ self.assertNotIn('X-OpenStack-Nova-API-Version', header)
+
+ def test_no_microverion_header_in_raw_request(self):
+ def raw_request(*args, **kwargs):
+ self.assertNotIn('X-OpenStack-Nova-API-Version', kwargs['headers'])
+ return (httplib2.Response({'status': 200}), {})
+
+ with mock.patch.object(rest_client.RestClient,
+ 'raw_request') as mock_get:
+ mock_get.side_effect = raw_request
+ self.client.get('fake_url')
+
+
+class TestClientWithMicroversionHeader(base.BaseComputeServiceTest):
+
+ def setUp(self):
+ super(TestClientWithMicroversionHeader, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = base_compute_client.BaseComputeClient(
+ fake_auth, 'compute', 'regionOne')
+ self.client.api_microversion = '2.2'
+
+ def test_microverion_header(self):
+ header = self.client.get_headers()
+ self.assertIn('X-OpenStack-Nova-API-Version', header)
+ self.assertEqual(self.client.api_microversion,
+ header['X-OpenStack-Nova-API-Version'])
+
+ def test_microverion_header_in_raw_request(self):
+ def raw_request(*args, **kwargs):
+ self.assertIn('X-OpenStack-Nova-API-Version', kwargs['headers'])
+ self.assertEqual(self.client.api_microversion,
+ kwargs['headers']['X-OpenStack-Nova-API-Version'])
+ return (httplib2.Response({'status': 200}), {})
+
+ with mock.patch.object(rest_client.RestClient,
+ 'raw_request') as mock_get:
+ mock_get.side_effect = raw_request
+ self.client.get('fake_url')
diff --git a/tempest/tests/services/compute/test_volumes_client.py b/tempest/tests/services/compute/test_volumes_client.py
deleted file mode 100644
index 33d4bad..0000000
--- a/tempest/tests/services/compute/test_volumes_client.py
+++ /dev/null
@@ -1,114 +0,0 @@
-# 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 copy
-
-from oslotest import mockpatch
-from tempest_lib import exceptions as lib_exc
-
-from tempest.services.compute.json import volumes_client
-from tempest.tests import fake_auth_provider
-from tempest.tests.services.compute import base
-
-
-class TestVolumesClient(base.BaseComputeServiceTest):
-
- FAKE_VOLUME = {
- "id": "521752a6-acf6-4b2d-bc7a-119f9148cd8c",
- "displayName": u"v\u12345ol-001",
- "displayDescription": u"Another \u1234volume.",
- "size": 30,
- "status": "Active",
- "volumeType": "289da7f8-6440-407c-9fb4-7db01ec49164",
- "metadata": {
- "contents": "junk"
- },
- "availabilityZone": "us-east1",
- "snapshotId": None,
- "attachments": [],
- "createdAt": "2012-02-14T20:53:07Z"
- }
-
- FAKE_VOLUMES = {"volumes": [FAKE_VOLUME]}
-
- def setUp(self):
- super(TestVolumesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = volumes_client.VolumesClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_list_volumes(self, bytes_body=False, **params):
- self.check_service_client_function(
- self.client.list_volumes,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_VOLUMES, to_utf=bytes_body, **params)
-
- def test_list_volumes_with_str_body(self):
- self._test_list_volumes()
-
- def test_list_volumes_with_byte_body(self):
- self._test_list_volumes(bytes_body=True)
-
- def test_list_volumes_with_params(self):
- self._test_list_volumes(name='fake')
-
- def _test_show_volume(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_volume,
- 'tempest.common.service_client.ServiceClient.get',
- {"volume": self.FAKE_VOLUME},
- to_utf=bytes_body, volume_id=self.FAKE_VOLUME['id'])
-
- def test_show_volume_with_str_body(self):
- self._test_show_volume()
-
- def test_show_volume_with_bytes_body(self):
- self._test_show_volume(bytes_body=True)
-
- def _test_create_volume(self, bytes_body=False):
- post_body = copy.deepcopy(self.FAKE_VOLUME)
- del post_body['id']
- del post_body['createdAt']
- del post_body['status']
- self.check_service_client_function(
- self.client.create_volume,
- 'tempest.common.service_client.ServiceClient.post',
- {"volume": self.FAKE_VOLUME},
- to_utf=bytes_body, status=200, **post_body)
-
- def test_create_volume_with_str_body(self):
- self._test_create_volume()
-
- def test_create_volume_with_bytes_body(self):
- self._test_create_volume(bytes_body=True)
-
- def test_delete_volume(self):
- self.check_service_client_function(
- self.client.delete_volume,
- 'tempest.common.service_client.ServiceClient.delete',
- {}, status=202, volume_id=self.FAKE_VOLUME['id'])
-
- def test_is_resource_deleted_true(self):
- module = ('tempest.services.compute.json.volumes_client.'
- 'VolumesClient.show_volume')
- self.useFixture(mockpatch.Patch(
- module, side_effect=lib_exc.NotFound))
- self.assertTrue(self.client.is_resource_deleted('fake-id'))
-
- def test_is_resource_deleted_false(self):
- module = ('tempest.services.compute.json.volumes_client.'
- 'VolumesClient.show_volume')
- self.useFixture(mockpatch.Patch(
- module, return_value={}))
- self.assertFalse(self.client.is_resource_deleted('fake-id'))
diff --git a/tempest/tests/test_glance_http.py b/tempest/tests/test_glance_http.py
index ed886da..db9db34 100644
--- a/tempest/tests/test_glance_http.py
+++ b/tempest/tests/test_glance_http.py
@@ -123,9 +123,9 @@
def test_get_connection_kwargs_default_for_https(self):
kwargs = self.client._get_connection_kwargs('https')
self.assertEqual(600, kwargs['timeout'])
- self.assertEqual(None, kwargs['ca_certs'])
- self.assertEqual(None, kwargs['cert_file'])
- self.assertEqual(None, kwargs['key_file'])
+ self.assertIsNone(kwargs['ca_certs'])
+ self.assertIsNone(kwargs['cert_file'])
+ self.assertIsNone(kwargs['key_file'])
self.assertEqual(False, kwargs['insecure'])
self.assertEqual(True, kwargs['ssl_compression'])
self.assertEqual(6, len(kwargs.keys()))
diff --git a/tox.ini b/tox.ini
index 41eece1..fedd04c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = pep8,py27,py34
+envlist = pep8,py34,py27
minversion = 1.6
skipsdist = True