Merge "Update stress tests to properly use tempest.config"
diff --git a/tempest/clients.py b/tempest/clients.py
index 7d314f3..ef07d9c 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -25,6 +25,7 @@
from tempest.services.compute.json.flavors_client import FlavorsClientJSON
from tempest.services.compute.json.floating_ips_client import \
FloatingIPsClientJSON
+from tempest.services.compute.json.hosts_client import HostsClientJSON
from tempest.services.compute.json.images_client import ImagesClientJSON
from tempest.services.compute.json.keypairs_client import KeyPairsClientJSON
from tempest.services.compute.json.limits_client import LimitsClientJSON
@@ -211,6 +212,7 @@
msg = "Unsupported interface type `%s'" % interface
raise exceptions.InvalidConfiguration(msg)
self.network_client = NetworkClient(*client_args)
+ self.hosts_client = HostsClientJSON(*client_args)
self.account_client = AccountClient(*client_args)
self.image_client = ImageClientJSON(*client_args)
self.container_client = ContainerClient(*client_args)
diff --git a/tempest/tests/compute/servers/test_server_metadata.py b/tempest/tests/compute/servers/test_server_metadata.py
index 7896466..cdfe2f1 100644
--- a/tempest/tests/compute/servers/test_server_metadata.py
+++ b/tempest/tests/compute/servers/test_server_metadata.py
@@ -233,3 +233,12 @@
self.assertRaises(exceptions.OverLimit,
self.client.update_server_metadata,
self.server_id, req_metadata)
+
+ @attr(type='negative')
+ def test_update_all_metadata_field_error(self):
+ # Raise a bad request error for blank key.
+ # set_server_metadata will replace all metadata with new value
+ meta = {'': 'data1'}
+ self.assertRaises(exceptions.BadRequest,
+ self.client.set_server_metadata,
+ self.server_id, meta=meta)
diff --git a/tempest/tests/compute/test_live_block_migration.py b/tempest/tests/compute/test_live_block_migration.py
index 078026a..dcd6a78 100644
--- a/tempest/tests/compute/test_live_block_migration.py
+++ b/tempest/tests/compute/test_live_block_migration.py
@@ -22,14 +22,12 @@
from tempest import config
from tempest import exceptions
-from tempest.services.compute.json.hosts_client import HostsClientJSON
-from tempest.services.compute.json.servers_client import ServersClientJSON
from tempest.test import attr
from tempest.tests.compute import base
@attr(category='live-migration')
-class LiveBlockMigrationTest(base.BaseComputeTest):
+class LiveBlockMigrationTest(base.BaseComputeAdminTest):
_interface = 'json'
live_migration_available = (
@@ -42,12 +40,8 @@
def setUpClass(cls):
super(LiveBlockMigrationTest, cls).setUpClass()
- tenant_name = cls.config.compute_admin.tenant_name
- cls.admin_hosts_client = HostsClientJSON(
- *cls._get_client_args(), tenant_name=tenant_name)
-
- cls.admin_servers_client = ServersClientJSON(
- *cls._get_client_args(), tenant_name=tenant_name)
+ cls.admin_hosts_client = cls.os_adm.hosts_client
+ cls.admin_servers_client = cls.os_adm.servers_client
cls.created_server_ids = []
@@ -102,7 +96,7 @@
@attr(type='positive')
@testtools.skipIf(not live_migration_available,
'Block Live migration not available')
- def test_001_live_block_migration(self):
+ def test_live_block_migration(self):
# Live block migrate an instance to another host
if len(self._get_compute_hostnames()) < 2:
raise self.skipTest(
@@ -114,11 +108,10 @@
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
self.assertEquals(target_host, self._get_host_for_server(server_id))
- @attr(type='positive', bug='lp1051881')
@testtools.skip('Until bug 1051881 is dealt with.')
@testtools.skipIf(not live_migration_available,
'Block Live migration not available')
- def test_002_invalid_host_for_migration(self):
+ def test_invalid_host_for_migration(self):
# Migrating to an invalid host should not change the status
server_id = self._get_an_active_server()
diff --git a/tempest/tests/identity/admin/test_roles.py b/tempest/tests/identity/admin/test_roles.py
index 46db4fb..53c5b0d 100644
--- a/tempest/tests/identity/admin/test_roles.py
+++ b/tempest/tests/identity/admin/test_roles.py
@@ -20,11 +20,12 @@
from tempest.tests.identity import base
-class RolesTestBase(object):
+class RolesTestJSON(base.BaseIdentityAdminTest):
+ _interface = 'json'
- @staticmethod
+ @classmethod
def setUpClass(cls):
-
+ super(RolesTestJSON, cls).setUpClass()
for _ in xrange(5):
resp, role = cls.client.create_role(rand_name('role-'))
cls.data.roles.append(role)
@@ -37,6 +38,13 @@
role = self.get_role_by_name(self.data.test_role)
return (user, tenant, role)
+ def assert_role_in_role_list(self, role, roles):
+ found = False
+ for user_role in roles:
+ if user_role['id'] == role['id']:
+ found = True
+ self.assertTrue(found, "assigned role was not in list")
+
def test_list_roles(self):
# Return a list of all roles
resp, body = self.client.list_roles()
@@ -97,34 +105,6 @@
pass
self.client.delete_role(role1_id)
-
-class RolesTestJSON(base.BaseIdentityAdminTestJSON,
- RolesTestBase):
-
- @classmethod
- def setUpClass(cls):
- super(RolesTestJSON, cls).setUpClass()
- RolesTestBase.setUpClass(cls)
-
-
-class RolesTestXML(base.BaseIdentityAdminTestXML,
- RolesTestBase):
-
- @classmethod
- def setUpClass(cls):
- super(RolesTestXML, cls).setUpClass()
- RolesTestBase.setUpClass(cls)
-
-
-class UserRolesTestBase(RolesTestBase):
-
- def assert_role_in_role_list(self, role, roles):
- found = False
- for user_role in roles:
- if user_role['id'] == role['id']:
- found = True
- self.assertTrue(found, "assigned role was not in list")
-
def test_assign_user_role(self):
# Assign a role to a user on a tenant
(user, tenant, role) = self._get_role_params()
@@ -267,17 +247,5 @@
tenant['id'], 'junk-role-aabbcc11')
-class UserRolesTestJSON(RolesTestJSON,
- UserRolesTestBase):
-
- @classmethod
- def setUpClass(cls):
- super(UserRolesTestJSON, cls).setUpClass()
-
-
-class UserRolesTestXML(RolesTestXML,
- UserRolesTestBase):
-
- @classmethod
- def setUpClass(cls):
- super(UserRolesTestXML, cls).setUpClass()
+class RolesTestXML(RolesTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/identity/admin/test_services.py b/tempest/tests/identity/admin/test_services.py
index 77c8e83..caf57bd 100644
--- a/tempest/tests/identity/admin/test_services.py
+++ b/tempest/tests/identity/admin/test_services.py
@@ -21,7 +21,8 @@
from tempest.tests.identity import base
-class ServicesTestBase(object):
+class ServicesTestJSON(base.BaseIdentityAdminTest):
+ _interface = 'json'
def test_create_get_delete_service(self):
# GET Service
@@ -91,14 +92,5 @@
self.assertFalse(any(found), 'Services failed to delete')
-class ServicesTestJSON(base.BaseIdentityAdminTestJSON, ServicesTestBase):
- @classmethod
- def setUpClass(cls):
- super(ServicesTestJSON, cls).setUpClass()
-
-
-class ServicesTestXML(base.BaseIdentityAdminTestXML,
- ServicesTestBase):
- @classmethod
- def setUpClass(cls):
- super(ServicesTestXML, cls).setUpClass()
+class ServicesTestXML(ServicesTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/identity/admin/test_tenants.py b/tempest/tests/identity/admin/test_tenants.py
index 6385cec..a3c9246 100644
--- a/tempest/tests/identity/admin/test_tenants.py
+++ b/tempest/tests/identity/admin/test_tenants.py
@@ -21,7 +21,8 @@
from tempest.tests.identity import base
-class TenantsTestBase(object):
+class TenantsTestJSON(base.BaseIdentityAdminTest):
+ _interface = 'json'
def test_list_tenants_by_unauthorized_user(self):
# Non-admin user should not be able to list tenants
@@ -272,16 +273,5 @@
self.data.tenants.remove(tenant)
-class TenantsTestJSON(base.BaseIdentityAdminTestJSON,
- TenantsTestBase):
-
- @classmethod
- def setUpClass(cls):
- super(TenantsTestJSON, cls).setUpClass()
-
-
-class TenantsTestXML(base.BaseIdentityAdminTestXML, TenantsTestBase):
-
- @classmethod
- def setUpClass(cls):
- super(TenantsTestXML, cls).setUpClass()
+class TenantsTestXML(TenantsTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/identity/admin/test_users.py b/tempest/tests/identity/admin/test_users.py
index 67b2517..224272e 100644
--- a/tempest/tests/identity/admin/test_users.py
+++ b/tempest/tests/identity/admin/test_users.py
@@ -23,7 +23,8 @@
from testtools.matchers._basic import Contains
-class UsersTestBase(object):
+class UsersTestJSON(base.BaseIdentityAdminTest):
+ _interface = 'json'
alt_user = rand_name('test_user_')
alt_password = rand_name('pass_')
@@ -338,14 +339,5 @@
'tenant ids %s' % fail)
-class UsersTestJSON(base.BaseIdentityAdminTestJSON,
- UsersTestBase):
- @classmethod
- def setUpClass(cls):
- super(UsersTestJSON, cls).setUpClass()
-
-
-class UsersTestXML(base.BaseIdentityAdminTestXML, UsersTestBase):
- @classmethod
- def setUpClass(cls):
- super(UsersTestXML, cls).setUpClass()
+class UsersTestXML(UsersTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/identity/base.py b/tempest/tests/identity/base.py
index 2c4162c..168b2ff 100644
--- a/tempest/tests/identity/base.py
+++ b/tempest/tests/identity/base.py
@@ -21,7 +21,7 @@
import tempest.test
-class BaseIdAdminTest(tempest.test.BaseTestCase):
+class BaseIdentityAdminTest(tempest.test.BaseTestCase):
@classmethod
def setUpClass(cls):
@@ -68,22 +68,6 @@
return role[0]
-class BaseIdentityAdminTestJSON(BaseIdAdminTest):
- @classmethod
- def setUpClass(cls):
- cls._interface = "json"
- super(BaseIdentityAdminTestJSON, cls).setUpClass()
-
-BaseIdentityAdminTest = BaseIdentityAdminTestJSON
-
-
-class BaseIdentityAdminTestXML(BaseIdAdminTest):
- @classmethod
- def setUpClass(cls):
- cls._interface = "xml"
- super(BaseIdentityAdminTestXML, cls).setUpClass()
-
-
class DataGenerator(object):
def __init__(self, client):