Merge "update identity to handle new table attributes"
diff --git a/cli/simple_read_only/test_compute.py b/cli/simple_read_only/test_compute.py
index 742b5a4..073fde1 100644
--- a/cli/simple_read_only/test_compute.py
+++ b/cli/simple_read_only/test_compute.py
@@ -55,6 +55,7 @@
cls.identity = config.TempestConfig().identity
super(SimpleReadOnlyNovaCLientTest, cls).setUpClass()
+ #NOTE(jogo): This should eventually be moved into a base class
def nova(self, action, flags='', params='', admin=True, fail_ok=False):
"""Executes nova command for the given action."""
#TODO(jogo) make admin=False work
@@ -66,39 +67,144 @@
cmd = ' '.join([CONF.cli.cli_dir + 'nova', flags, action, params])
LOG.info("running: '%s'" % cmd)
cmd = shlex.split(cmd)
- result = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
+ try:
+ result = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
+ except subprocess.CalledProcessError, e:
+ LOG.error("command output:\n%s" % e.output)
+ raise
return result
- def test_admin_version(self):
- self.nova('', flags='--version')
-
- def test_admin_timing(self):
- self.nova('list', flags='--timing')
-
- def test_admin_timeout(self):
- self.nova('list', flags='--timeout 2')
-
- def test_admin_debug_list(self):
- self.nova('list', flags='--debug')
-
def test_admin_fake_action(self):
self.assertRaises(subprocess.CalledProcessError,
self.nova,
'this-does-nova-exist')
+ #NOTE(jogo): Commands in order listed in 'nova help'
+
+ # Positional arguments:
+
+ def test_admin_absolute_limites(self):
+ self.nova('absolute-limits')
+
def test_admin_aggregate_list(self):
self.nova('aggregate-list')
+ def test_admin_availability_zone_list(self):
+ self.nova('availability-zone-list')
+
def test_admin_cloudpipe_list(self):
self.nova('cloudpipe-list')
- def test_admin_image_list(self):
- self.nova('image-list')
+ def test_admin_credentials(self):
+ self.nova('credentials')
def test_admin_dns_domains(self):
self.nova('dns-domains')
+ @testtools.skip("needs parameters")
+ def test_admin_dns_list(self):
+ self.nova('dns-list')
+
+ def test_admin_endpoints(self):
+ self.nova('endpoints')
+
+ def test_admin_flavor_acces_list(self):
+ self.assertRaises(subprocess.CalledProcessError,
+ self.nova,
+ 'flavor-access-list')
+ # Failed to get access list for public flavor type
+ self.assertRaises(subprocess.CalledProcessError,
+ self.nova,
+ 'flavor-access-list',
+ params='--flavor m1.tiny')
+
def test_admin_flavor_list(self):
self.nova('flavor-list')
- #TODO(jogo) add more tests
+ def test_admin_floating_ip_bulk_list(self):
+ self.nova('floating-ip-bulk-list')
+
+ def test_admin_floating_ip_list(self):
+ self.nova('floating-ip-list')
+
+ def test_admin_floating_ip_pool_list(self):
+ self.nova('floating-ip-pool-list')
+
+ def test_admin_host_list(self):
+ self.nova('host-list')
+
+ def test_admin_hypervisor_list(self):
+ self.nova('hypervisor-list')
+
+ def test_admin_image_list(self):
+ self.nova('image-list')
+
+ @testtools.skip("needs parameters")
+ def test_admin_interface_list(self):
+ self.nova('interface-list')
+
+ def test_admin_keypair_list(self):
+ self.nova('keypair-list')
+
+ def test_admin_list(self):
+ self.nova('list')
+ self.nova('list', params='--all-tenants 1')
+ self.nova('list', params='--all-tenants 0')
+ self.assertRaises(subprocess.CalledProcessError,
+ self.nova,
+ 'list',
+ params='--all-tenants bad')
+
+ def test_admin_network_list(self):
+ self.nova('network-list')
+
+ def test_admin_rate_limits(self):
+ self.nova('rate-limits')
+
+ def test_admin_secgroup_list(self):
+ self.nova('secgroup-list')
+
+ @testtools.skip("needs parameters")
+ def test_admin_secgroup_list_rules(self):
+ self.nova('secgroup-list-rules')
+
+ def test_admin_servce_list(self):
+ self.nova('service-list')
+
+ def test_admin_usage(self):
+ self.nova('usage')
+
+ def test_admin_usage_list(self):
+ self.nova('usage-list')
+
+ def test_admin_volume_list(self):
+ self.nova('volume-list')
+
+ def test_admin_volume_snapshot_list(self):
+ self.nova('volume-snapshot-list')
+
+ def test_admin_volume_type_list(self):
+ self.nova('volume-type-list')
+
+ def test_admin_help(self):
+ self.nova('help')
+
+ def test_admin_list_extensions(self):
+ self.nova('list-extensions')
+
+ def test_admin_net_list(self):
+ self.nova('net-list')
+
+ # Optional arguments:
+
+ def test_admin_version(self):
+ self.nova('', flags='--version')
+
+ def test_admin_debug_list(self):
+ self.nova('list', flags='--debug')
+
+ def test_admin_timeout(self):
+ self.nova('list', flags='--timeout 2')
+
+ def test_admin_timing(self):
+ self.nova('list', flags='--timing')
diff --git a/tempest/common/glance_http.py b/tempest/common/glance_http.py
index 45737be..36a9abd 100644
--- a/tempest/common/glance_http.py
+++ b/tempest/common/glance_http.py
@@ -16,9 +16,11 @@
# Originally copied from python-glanceclient
import copy
+import hashlib
import httplib
import logging
import posixpath
+import re
import socket
import StringIO
import struct
@@ -42,6 +44,7 @@
LOG = logging.getLogger(__name__)
USER_AGENT = 'tempest'
CHUNKSIZE = 1024 * 64 # 64kB
+TOKEN_CHARS_RE = re.compile('^[-A-Za-z0-9+/=]*$')
class HTTPClient(object):
@@ -92,42 +95,6 @@
except httplib.InvalidURL:
raise exc.EndpointNotFound
- def log_curl_request(self, method, url, kwargs):
- curl = ['curl -i -X %s' % method]
-
- for (key, value) in kwargs['headers'].items():
- header = '-H \'%s: %s\'' % (key, value)
- curl.append(header)
-
- conn_params_fmt = [
- ('key_file', '--key %s'),
- ('cert_file', '--cert %s'),
- ('cacert', '--cacert %s'),
- ]
- for (key, fmt) in conn_params_fmt:
- value = self.connection_kwargs.get(key)
- if value:
- curl.append(fmt % value)
-
- if self.connection_kwargs.get('insecure'):
- curl.append('-k')
-
- if 'body' in kwargs:
- curl.append('-d \'%s\'' % kwargs['body'])
-
- curl.append('%s%s' % (self.endpoint, url))
- LOG.debug(' '.join(curl))
-
- @staticmethod
- def log_http_response(resp, body=None):
- status = (resp.version / 10.0, resp.status, resp.reason)
- dump = ['\nHTTP/%.1f %s %s' % status]
- dump.extend(['%s: %s' % (k, v) for k, v in resp.getheaders()])
- dump.append('')
- if body:
- dump.extend([body, ''])
- LOG.debug('\n'.join(dump))
-
def _http_request(self, url, method, **kwargs):
"""Send an http request with the specified characteristics.
@@ -140,7 +107,8 @@
if self.auth_token:
kwargs['headers'].setdefault('X-Auth-Token', self.auth_token)
- self.log_curl_request(method, url, kwargs)
+ self._log_request(method, url, kwargs['headers'])
+
conn = self.get_connection()
try:
@@ -172,13 +140,37 @@
# Read body into string if it isn't obviously image data
if resp.getheader('content-type', None) != 'application/octet-stream':
body_str = ''.join([chunk for chunk in body_iter])
- self.log_http_response(resp, body_str)
body_iter = StringIO.StringIO(body_str)
+ self._log_response(resp, None)
else:
- self.log_http_response(resp)
+ self._log_response(resp, body_iter)
return resp, body_iter
+ def _log_request(self, method, url, headers):
+ LOG.info('Request: ' + method + ' ' + url)
+ if headers:
+ headers_out = headers
+ if 'X-Auth-Token' in headers and headers['X-Auth-Token']:
+ token = headers['X-Auth-Token']
+ if len(token) > 64 and TOKEN_CHARS_RE.match(token):
+ headers_out = headers.copy()
+ headers_out['X-Auth-Token'] = "<Token omitted>"
+ LOG.info('Request Headers: ' + str(headers_out))
+
+ def _log_response(self, resp, body):
+ status = str(resp.status)
+ LOG.info("Response Status: " + status)
+ if resp.getheaders():
+ LOG.info('Response Headers: ' + str(resp.getheaders()))
+ if body:
+ str_body = str(body)
+ length = len(body)
+ LOG.info('Response Body: ' + str_body[:2048])
+ if length >= 2048:
+ self.LOG.debug("Large body (%d) md5 summary: %s", length,
+ hashlib.md5(str_body).hexdigest())
+
def json_request(self, method, url, **kwargs):
kwargs.setdefault('headers', {})
kwargs['headers'].setdefault('Content-Type', 'application/json')
diff --git a/tempest/smoke.py b/tempest/smoke.py
index 1e7da8e..0d4043f 100644
--- a/tempest/smoke.py
+++ b/tempest/smoke.py
@@ -51,8 +51,8 @@
# order, and because test methods in smoke tests generally create
# resources in a particular order, we destroy resources in the reverse
# order in which resources are added to the smoke test class object
- while cls.resources:
- thing = cls.resources.pop()
+ while cls.os_resources:
+ thing = cls.os_resources.pop()
LOG.debug("Deleting %r from shared resources of %s" %
(thing, cls.__name__))
diff --git a/tempest/test.py b/tempest/test.py
index 616a866..90793ac 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -19,8 +19,10 @@
import time
import nose.plugins.attrib
+import testresources
import testtools
+from tempest import config
from tempest import manager
LOG = logging.getLogger(__name__)
@@ -46,7 +48,16 @@
return decorator
-class TestCase(testtools.TestCase):
+class BaseTestCase(testtools.TestCase,
+ testtools.testcase.WithAttributes,
+ testresources.ResourcedTestCase):
+ def __init__(self, *args, **kwargs):
+ super(BaseTestCase, self).__init__(*args, **kwargs)
+ #NOTE(afazekas): inspection workaround
+ BaseTestCase.config = config.TempestConfig()
+
+
+class TestCase(BaseTestCase):
"""
Base test case class for all Tempest tests
@@ -58,7 +69,6 @@
@classmethod
def setUpClass(cls):
cls.manager = cls.manager_class()
- cls.config = cls.manager.config
for attr_name in cls.manager.client_attr_names:
# Ensure that pre-existing class attributes won't be
# accidentally overriden.
@@ -66,20 +76,20 @@
client = getattr(cls.manager, attr_name)
setattr(cls, attr_name, client)
cls.resource_keys = {}
- cls.resources = []
+ cls.os_resources = []
def set_resource(self, key, thing):
LOG.debug("Adding %r to shared resources of %s" %
(thing, self.__class__.__name__))
self.resource_keys[key] = thing
- self.resources.append(thing)
+ self.os_resources.append(thing)
def get_resource(self, key):
return self.resource_keys[key]
def remove_resource(self, key):
thing = self.resource_keys[key]
- self.resources.remove(thing)
+ self.os_resources.remove(thing)
del self.resource_keys[key]
diff --git a/tempest/testboto.py b/tempest/testboto.py
index 30c7e93..5625841 100644
--- a/tempest/testboto.py
+++ b/tempest/testboto.py
@@ -23,10 +23,9 @@
from boto import ec2
from boto import exception
from boto import s3
-import testresources
-import testtools
from tempest import exceptions
+import tempest.test
import tempest.tests.boto
from tempest.tests.boto.utils.wait import re_search_wait
from tempest.tests.boto.utils.wait import state_wait
@@ -119,9 +118,7 @@
return string + ")"
-class BotoTestCase(testtools.testcase.WithAttributes,
- testtools.TestCase,
- testresources.ResourcedTestCase):
+class BotoTestCase(tempest.test.BaseTestCase):
"""Recommended to use as base class for boto related test."""
conclusion = tempest.tests.boto.generic_setup_package()
diff --git a/tempest/tests/boto/test_ec2_instance_run.py b/tempest/tests/boto/test_ec2_instance_run.py
index b0a7fcd..6b61c11 100644
--- a/tempest/tests/boto/test_ec2_instance_run.py
+++ b/tempest/tests/boto/test_ec2_instance_run.py
@@ -45,8 +45,8 @@
cls.os = clients.Manager()
cls.s3_client = cls.os.s3_client
cls.ec2_client = cls.os.ec2api_client
- config = cls.os.config
cls.zone = cls.ec2_client.get_good_zone()
+ config = cls.config
cls.materials_path = config.boto.s3_materials_path
ami_manifest = config.boto.ami_manifest
aki_manifest = config.boto.aki_manifest
diff --git a/tempest/tests/boto/test_s3_buckets.py b/tempest/tests/boto/test_s3_buckets.py
index a4d1927..0a05ae0 100644
--- a/tempest/tests/boto/test_s3_buckets.py
+++ b/tempest/tests/boto/test_s3_buckets.py
@@ -31,7 +31,6 @@
super(S3BucketsTest, cls).setUpClass()
cls.os = clients.Manager()
cls.client = cls.os.s3_client
- cls.config = cls.os.config
@testtools.skip("Skipped until the Bug #1076965 is resolved")
@attr(type='smoke')
diff --git a/tempest/tests/boto/test_s3_ec2_images.py b/tempest/tests/boto/test_s3_ec2_images.py
index 0f7628b..1088b00 100644
--- a/tempest/tests/boto/test_s3_ec2_images.py
+++ b/tempest/tests/boto/test_s3_ec2_images.py
@@ -40,7 +40,7 @@
cls.os = clients.Manager()
cls.s3_client = cls.os.s3_client
cls.images_client = cls.os.ec2api_client
- config = cls.os.config
+ config = cls.config
cls.materials_path = config.boto.s3_materials_path
cls.ami_manifest = config.boto.ami_manifest
cls.aki_manifest = config.boto.aki_manifest
diff --git a/tempest/tests/boto/test_s3_objects.py b/tempest/tests/boto/test_s3_objects.py
index 8334b07..d50dc45 100644
--- a/tempest/tests/boto/test_s3_objects.py
+++ b/tempest/tests/boto/test_s3_objects.py
@@ -34,7 +34,6 @@
super(S3BucketsTest, cls).setUpClass()
cls.os = clients.Manager()
cls.client = cls.os.s3_client
- cls.config = cls.os.config
@testtools.skip("Skipped until the Bug #1076534 is resolved")
@attr(type='smoke')
diff --git a/tempest/tests/compute/admin/test_flavors.py b/tempest/tests/compute/admin/test_flavors.py
index 30c3d59..7fabf7a 100644
--- a/tempest/tests/compute/admin/test_flavors.py
+++ b/tempest/tests/compute/admin/test_flavors.py
@@ -23,14 +23,17 @@
from tempest.tests.compute import base
-class FlavorsAdminTestBase(object):
+class FlavorsAdminTestJSON(base.BaseComputeAdminTest):
"""
Tests Flavors API Create and Delete that require admin privileges
"""
+ _interface = 'json'
+
@classmethod
- def setUpClass(self, cls):
+ def setUpClass(cls):
+ super(FlavorsAdminTestJSON, cls).setUpClass()
if not compute.FLAVOR_EXTRA_DATA_ENABLED:
msg = "FlavorExtraData extension not enabled."
raise cls.skipException(msg)
@@ -315,23 +318,5 @@
#TODO(afazekas): Negative tests with regular user
-class FlavorsAdminTestXML(base.BaseComputeAdminTestXML,
- base.BaseComputeTestXML,
- FlavorsAdminTestBase):
-
- @classmethod
- def setUpClass(cls):
- super(FlavorsAdminTestXML, cls).setUpClass()
- base.BaseComputeTestXML.setUpClass()
- FlavorsAdminTestBase.setUpClass(cls)
-
-
-class FlavorsAdminTestJSON(base.BaseComputeAdminTestJSON,
- base.BaseComputeTestJSON,
- FlavorsAdminTestBase):
-
- @classmethod
- def setUpClass(cls):
- super(FlavorsAdminTestJSON, cls).setUpClass()
- base.BaseComputeTestJSON.setUpClass()
- FlavorsAdminTestBase.setUpClass(cls)
+class FlavorsAdminTestXML(FlavorsAdminTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/admin/test_flavors_extra_specs.py b/tempest/tests/compute/admin/test_flavors_extra_specs.py
index 968603d..711b73f 100644
--- a/tempest/tests/compute/admin/test_flavors_extra_specs.py
+++ b/tempest/tests/compute/admin/test_flavors_extra_specs.py
@@ -21,7 +21,7 @@
import testtools
-class FlavorsExtraSpecsTestBase(object):
+class FlavorsExtraSpecsTestJSON(base.BaseComputeAdminTest):
"""
Tests Flavor Extra Spec API extension.
@@ -29,8 +29,11 @@
GET Flavor Extra specs can be performed even by without admin privileges.
"""
+ _interface = 'json'
+
@classmethod
- def setUpClass(self, cls):
+ def setUpClass(cls):
+ super(FlavorsExtraSpecsTestJSON, cls).setUpClass()
if not compute.FLAVOR_EXTRA_DATA_ENABLED:
msg = "FlavorExtraData extension not enabled."
raise cls.skipException(msg)
@@ -53,8 +56,9 @@
swap=swap, rxtx=rxtx)
@classmethod
- def tearDownClass(self, cls):
+ def tearDownClass(cls):
resp, body = cls.client.delete_flavor(cls.flavor['id'])
+ super(FlavorsExtraSpecsTestJSON, cls).tearDownClass()
def test_flavor_set_get_unset_keys(self):
#Test to SET, GET UNSET flavor extra spec as a user
@@ -123,33 +127,5 @@
self.fail(msg)
-class FlavorsExtraSpecsTestXML(base.BaseComputeAdminTestXML,
- base.BaseComputeTestXML,
- FlavorsExtraSpecsTestBase):
-
- @classmethod
- def setUpClass(cls):
- super(FlavorsExtraSpecsTestXML, cls).setUpClass()
- base.BaseComputeTestXML.setUpClass()
- FlavorsExtraSpecsTestBase.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- FlavorsExtraSpecsTestBase.tearDownClass(cls)
- super(FlavorsExtraSpecsTestXML, cls).tearDownClass()
-
-
-class FlavorsExtraSpecsTestJSON(base.BaseComputeAdminTestJSON,
- base.BaseComputeTestJSON,
- FlavorsExtraSpecsTestBase):
-
- @classmethod
- def setUpClass(cls):
- super(FlavorsExtraSpecsTestJSON, cls).setUpClass()
- base.BaseComputeTestJSON.setUpClass()
- FlavorsExtraSpecsTestBase.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- FlavorsExtraSpecsTestBase.tearDownClass(cls)
- super(FlavorsExtraSpecsTestJSON, cls).tearDownClass()
+class FlavorsExtraSpecsTestXML(FlavorsExtraSpecsTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/admin/test_quotas.py b/tempest/tests/compute/admin/test_quotas.py
index a845632..d63f72f 100644
--- a/tempest/tests/compute/admin/test_quotas.py
+++ b/tempest/tests/compute/admin/test_quotas.py
@@ -20,10 +20,12 @@
from tempest.tests.compute import base
-class QuotasAdminTestBase(object):
+class QuotasAdminTestJSON(base.BaseComputeAdminTest):
+ _interface = 'json'
@classmethod
def setUpClass(cls):
+ super(QuotasAdminTestJSON, cls).setUpClass()
cls.auth_url = cls.config.identity.uri
cls.client = cls.os.quotas_client
cls.adm_client = cls.os_adm.quotas_client
@@ -54,6 +56,7 @@
cls.servers_client.delete_server(server['id'])
except exceptions.NotFound:
continue
+ super(QuotasAdminTestJSON, cls).tearDownClass()
@attr(type='smoke')
def test_get_default_quotas(self):
@@ -150,31 +153,5 @@
#TODO(afazekas): Add test that tried to update the quota_set as a regular user
-class QuotasAdminTestJSON(QuotasAdminTestBase, base.BaseComputeAdminTestJSON,
- base.BaseComputeTest):
-
- @classmethod
- def setUpClass(cls):
- base.BaseComputeAdminTestJSON.setUpClass()
- base.BaseComputeTest.setUpClass()
- super(QuotasAdminTestJSON, cls).setUpClass()
-
- @classmethod
- def tearDownClass(cls):
- super(QuotasAdminTestJSON, cls).tearDownClass()
- base.BaseComputeTest.tearDownClass()
-
-
-class QuotasAdminTestXML(QuotasAdminTestBase, base.BaseComputeAdminTestXML,
- base.BaseComputeTest):
-
- @classmethod
- def setUpClass(cls):
- base.BaseComputeAdminTestXML.setUpClass()
- base.BaseComputeTest.setUpClass()
- super(QuotasAdminTestXML, cls).setUpClass()
-
- @classmethod
- def tearDownClass(cls):
- super(QuotasAdminTestXML, cls).tearDownClass()
- base.BaseComputeTest.tearDownClass()
+class QuotasAdminTestXML(QuotasAdminTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/base.py b/tempest/tests/compute/base.py
index 2c6b861..2e5b4fe 100644
--- a/tempest/tests/compute/base.py
+++ b/tempest/tests/compute/base.py
@@ -18,31 +18,23 @@
import logging
import time
-import testresources
-import testtools
-
from tempest import clients
from tempest.common.utils.data_utils import rand_name
-from tempest import config
from tempest import exceptions
+import tempest.test
from tempest.tests import compute
-__all__ = ['BaseComputeTest', 'BaseComputeTestJSON', 'BaseComputeTestXML',
- 'BaseComputeAdminTestJSON', 'BaseComputeAdminTestXML']
LOG = logging.getLogger(__name__)
-class BaseCompTest(testtools.testcase.WithAttributes,
- testtools.TestCase,
- testresources.ResourcedTestCase):
+class BaseComputeTest(tempest.test.BaseTestCase):
"""Base test case class for all Compute API tests."""
conclusion = compute.generic_setup_package()
@classmethod
def setUpClass(cls):
- cls.config = config.TempestConfig()
cls.isolated_creds = []
if cls.config.compute.allow_tenant_isolation:
@@ -230,25 +222,7 @@
time.sleep(self.build_interval)
-class BaseComputeTestJSON(BaseCompTest):
- @classmethod
- def setUpClass(cls):
- cls._interface = "json"
- super(BaseComputeTestJSON, cls).setUpClass()
-
-# NOTE(danms): For transition, keep the old name active as JSON
-BaseComputeTest = BaseComputeTestJSON
-
-
-class BaseComputeTestXML(BaseCompTest):
- @classmethod
- def setUpClass(cls):
- cls._interface = "xml"
- super(BaseComputeTestXML, cls).setUpClass()
-
-
-class BaseComputeAdminTest(BaseCompTest):
-
+class BaseComputeAdminTest(BaseComputeTest):
"""Base test case class for all Compute Admin API tests."""
@classmethod
@@ -264,17 +238,3 @@
raise cls.skipException(msg)
cls.os_adm = clients.ComputeAdminManager(interface=cls._interface)
-
-
-class BaseComputeAdminTestJSON(BaseComputeAdminTest):
- @classmethod
- def setUpClass(cls):
- cls._interface = "json"
- super(BaseComputeAdminTestJSON, cls).setUpClass()
-
-
-class BaseComputeAdminTestXML(BaseComputeAdminTest):
- @classmethod
- def setUpClass(cls):
- cls._interface = "xml"
- super(BaseComputeAdminTestXML, cls).setUpClass()
diff --git a/tempest/tests/compute/flavors/test_flavors.py b/tempest/tests/compute/flavors/test_flavors.py
index 8b49390..95244df 100644
--- a/tempest/tests/compute/flavors/test_flavors.py
+++ b/tempest/tests/compute/flavors/test_flavors.py
@@ -20,7 +20,13 @@
from tempest.tests.compute import base
-class FlavorsTestBase(object):
+class FlavorsTestJSON(base.BaseComputeTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(FlavorsTestJSON, cls).setUpClass()
+ cls.client = cls.flavors_client
@attr(type='smoke')
def test_list_flavors(self):
@@ -149,19 +155,5 @@
9999)
-class FlavorsTestXML(base.BaseComputeTestXML,
- FlavorsTestBase):
-
- @classmethod
- def setUpClass(cls):
- super(FlavorsTestXML, cls).setUpClass()
- cls.client = cls.flavors_client
-
-
-class FlavorsTestJSON(base.BaseComputeTestJSON,
- FlavorsTestBase):
-
- @classmethod
- def setUpClass(cls):
- super(FlavorsTestJSON, cls).setUpClass()
- cls.client = cls.flavors_client
+class FlavorsTestXML(FlavorsTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/floating_ips/test_floating_ips_actions.py b/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
index 165cf79..ffff1f7 100644
--- a/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
@@ -21,12 +21,14 @@
from tempest.tests.compute import base
-class FloatingIPsTestBase(object):
+class FloatingIPsTestJSON(base.BaseComputeTest):
+ _interface = 'json'
server_id = None
floating_ip = None
- @staticmethod
+ @classmethod
def setUpClass(cls):
+ super(FloatingIPsTestJSON, cls).setUpClass()
cls.client = cls.floating_ips_client
cls.servers_client = cls.servers_client
@@ -51,8 +53,9 @@
if cls.non_exist_id not in cls.floating_ip_ids:
break
- @staticmethod
+ @classmethod
def tearDownClass(cls):
+ super(FloatingIPsTestJSON, cls).tearDownClass()
#Deleting the server which is created in this method
resp, body = cls.servers_client.delete_server(cls.server_id)
#Deleting the floating IP which is created in this method
@@ -202,25 +205,5 @@
' with out passing floating IP should raise BadRequest')
-class FloatingIPsTestJSON(base.BaseComputeTestJSON, FloatingIPsTestBase):
- @classmethod
- def setUpClass(cls):
- super(FloatingIPsTestJSON, cls).setUpClass()
- FloatingIPsTestBase.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- FloatingIPsTestBase.tearDownClass(cls)
- super(FloatingIPsTestJSON, cls).tearDownClass()
-
-
-class FloatingIPsTestXML(base.BaseComputeTestXML, FloatingIPsTestBase):
- @classmethod
- def setUpClass(cls):
- super(FloatingIPsTestXML, cls).setUpClass()
- FloatingIPsTestBase.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- FloatingIPsTestBase.tearDownClass(cls)
- super(FloatingIPsTestXML, cls).tearDownClass()
+class FloatingIPsTestXML(FloatingIPsTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/floating_ips/test_list_floating_ips.py b/tempest/tests/compute/floating_ips/test_list_floating_ips.py
index 42befd0..11b9465 100644
--- a/tempest/tests/compute/floating_ips/test_list_floating_ips.py
+++ b/tempest/tests/compute/floating_ips/test_list_floating_ips.py
@@ -21,10 +21,12 @@
from tempest.tests.compute import base
-class FloatingIPDetailsTestBase(object):
+class FloatingIPDetailsTestJSON(base.BaseComputeTest):
+ _interface = 'json'
- @staticmethod
+ @classmethod
def setUpClass(cls):
+ super(FloatingIPDetailsTestJSON, cls).setUpClass()
cls.client = cls.floating_ips_client
cls.floating_ip = []
cls.floating_ip_id = []
@@ -34,10 +36,11 @@
cls.floating_ip.append(body)
cls.floating_ip_id.append(body['id'])
- @staticmethod
+ @classmethod
def tearDownClass(cls):
for i in range(3):
cls.client.delete_floating_ip(cls.floating_ip_id[i])
+ super(FloatingIPDetailsTestJSON, cls).tearDownClass()
@attr(type='positive')
def test_list_floating_ips(self):
@@ -97,27 +100,5 @@
'nonexistant floating IP')
-class FloatingIPDetailsTestJSON(base.BaseComputeTestJSON,
- FloatingIPDetailsTestBase):
- @classmethod
- def setUpClass(cls):
- super(FloatingIPDetailsTestJSON, cls).setUpClass()
- FloatingIPDetailsTestBase.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- FloatingIPDetailsTestBase.tearDownClass(cls)
- super(FloatingIPDetailsTestJSON, cls).tearDownClass()
-
-
-class FloatingIPDetailsTestXML(base.BaseComputeTestXML,
- FloatingIPDetailsTestBase):
- @classmethod
- def setUpClass(cls):
- super(FloatingIPDetailsTestXML, cls).setUpClass()
- FloatingIPDetailsTestBase.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- FloatingIPDetailsTestBase.tearDownClass(cls)
- super(FloatingIPDetailsTestXML, cls).tearDownClass()
+class FloatingIPDetailsTestXML(FloatingIPDetailsTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/images/test_image_metadata.py b/tempest/tests/compute/images/test_image_metadata.py
index 7119a8e..fa69395 100644
--- a/tempest/tests/compute/images/test_image_metadata.py
+++ b/tempest/tests/compute/images/test_image_metadata.py
@@ -18,10 +18,11 @@
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest.test import attr
-from tempest.tests.compute.base import BaseComputeTest
+from tempest.tests.compute import base
-class ImagesMetadataTest(BaseComputeTest):
+class ImagesMetadataTest(base.BaseComputeTest):
+ _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/tests/compute/images/test_images.py b/tempest/tests/compute/images/test_images.py
index edc58e7..d8d38aa 100644
--- a/tempest/tests/compute/images/test_images.py
+++ b/tempest/tests/compute/images/test_images.py
@@ -26,7 +26,28 @@
from tempest.tests.compute import base
-class ImagesTestBase(object):
+class ImagesTestJSON(base.BaseComputeTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(ImagesTestJSON, cls).setUpClass()
+ cls.client = cls.images_client
+ cls.servers_client = cls.servers_client
+
+ cls.image_ids = []
+
+ if compute.MULTI_USER:
+ if cls.config.compute.allow_tenant_isolation:
+ creds = cls._get_isolated_creds()
+ username, tenant_name, password = creds
+ cls.alt_manager = clients.Manager(username=username,
+ password=password,
+ tenant_name=tenant_name)
+ else:
+ # Use the alt_XXX credentials in the config file
+ cls.alt_manager = clients.AltManager()
+ cls.alt_client = cls.alt_manager.images_client
def tearDown(self):
"""Terminate test instances created after a test is executed."""
@@ -39,6 +60,7 @@
for image_id in self.image_ids:
self.client.delete_image(image_id)
self.image_ids.remove(image_id)
+ super(ImagesTestJSON, self).tearDown()
@attr(type='negative')
def test_create_image_from_deleted_server(self):
@@ -211,55 +233,5 @@
"exceeds 35 character ID length limit")
-class ImagesTestJSON(base.BaseComputeTestJSON,
- ImagesTestBase):
- def tearDown(self):
- ImagesTestBase.tearDown(self)
- base.BaseComputeTestJSON.tearDown(self)
-
- @classmethod
- def setUpClass(cls):
- super(ImagesTestJSON, cls).setUpClass()
- cls.client = cls.images_client
- cls.servers_client = cls.servers_client
-
- cls.image_ids = []
-
- if compute.MULTI_USER:
- if cls.config.compute.allow_tenant_isolation:
- creds = cls._get_isolated_creds()
- username, tenant_name, password = creds
- cls.alt_manager = clients.Manager(username=username,
- password=password,
- tenant_name=tenant_name)
- else:
- # Use the alt_XXX credentials in the config file
- cls.alt_manager = clients.AltManager()
- cls.alt_client = cls.alt_manager.images_client
-
-
-class ImagesTestXML(base.BaseComputeTestXML,
- ImagesTestBase):
- def tearDown(self):
- ImagesTestBase.tearDown(self)
- base.BaseComputeTestXML.tearDown(self)
-
- @classmethod
- def setUpClass(cls):
- super(ImagesTestXML, cls).setUpClass()
- cls.client = cls.images_client
- cls.servers_client = cls.servers_client
-
- cls.image_ids = []
-
- if compute.MULTI_USER:
- if cls.config.compute.allow_tenant_isolation:
- creds = cls._get_isolated_creds()
- username, tenant_name, password = creds
- cls.alt_manager = clients.Manager(username=username,
- password=password,
- tenant_name=tenant_name)
- else:
- # Use the alt_XXX credentials in the config file
- cls.alt_manager = clients.AltManager()
- cls.alt_client = cls.alt_manager.images_client
+class ImagesTestXML(ImagesTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/images/test_images_oneserver.py b/tempest/tests/compute/images/test_images_oneserver.py
index 08966fd..34ea868 100644
--- a/tempest/tests/compute/images/test_images_oneserver.py
+++ b/tempest/tests/compute/images/test_images_oneserver.py
@@ -26,12 +26,36 @@
from tempest.tests.compute import base
-class ImagesOneServerTestBase(object):
+class ImagesOneServerTestJSON(base.BaseComputeTest):
+ _interface = 'json'
+
def tearDown(self):
"""Terminate test instances created after a test is executed."""
for image_id in self.image_ids:
self.client.delete_image(image_id)
self.image_ids.remove(image_id)
+ super(ImagesOneServerTestJSON, self).tearDown()
+
+ @classmethod
+ def setUpClass(cls):
+ super(ImagesOneServerTestJSON, cls).setUpClass()
+ cls.client = cls.images_client
+ cls.servers_client = cls.servers_client
+ cls.server = cls.create_server()
+
+ cls.image_ids = []
+
+ if compute.MULTI_USER:
+ if cls.config.compute.allow_tenant_isolation:
+ creds = cls._get_isolated_creds()
+ username, tenant_name, password = creds
+ cls.alt_manager = clients.Manager(username=username,
+ password=password,
+ tenant_name=tenant_name)
+ else:
+ # Use the alt_XXX credentials in the config file
+ cls.alt_manager = clients.AltManager()
+ cls.alt_client = cls.alt_manager.images_client
@attr(type='negative')
@testtools.skip("Until Bug 1006725 is fixed")
@@ -178,59 +202,5 @@
self.assertRaises(exceptions.NotFound, self.client.get_image, image_id)
-class ImagesOneServerTestJSON(base.BaseComputeTestJSON,
- ImagesOneServerTestBase):
-
- def tearDown(self):
- ImagesOneServerTestBase.tearDown(self)
- base.BaseComputeTestJSON.tearDown(self)
-
- @classmethod
- def setUpClass(cls):
- super(ImagesOneServerTestJSON, cls).setUpClass()
- cls.client = cls.images_client
- cls.servers_client = cls.servers_client
- cls.server = cls.create_server()
-
- cls.image_ids = []
-
- if compute.MULTI_USER:
- if cls.config.compute.allow_tenant_isolation:
- creds = cls._get_isolated_creds()
- username, tenant_name, password = creds
- cls.alt_manager = clients.Manager(username=username,
- password=password,
- tenant_name=tenant_name)
- else:
- # Use the alt_XXX credentials in the config file
- cls.alt_manager = clients.AltManager()
- cls.alt_client = cls.alt_manager.images_client
-
-
-class ImagesOneServerTestXML(base.BaseComputeTestXML,
- ImagesOneServerTestBase):
-
- def tearDown(self):
- ImagesOneServerTestBase.tearDown(self)
- base.BaseComputeTestXML.tearDown(self)
-
- @classmethod
- def setUpClass(cls):
- super(ImagesOneServerTestXML, cls).setUpClass()
- cls.client = cls.images_client
- cls.servers_client = cls.servers_client
- cls.server = cls.create_server()
-
- cls.image_ids = []
-
- if compute.MULTI_USER:
- if cls.config.compute.allow_tenant_isolation:
- creds = cls._get_isolated_creds()
- username, tenant_name, password = creds
- cls.alt_manager = clients.Manager(username=username,
- password=password,
- tenant_name=tenant_name)
- else:
- # Use the alt_XXX credentials in the config file
- cls.alt_manager = clients.AltManager()
- cls.alt_client = cls.alt_manager.images_client
+class ImagesOneServerTestXML(ImagesOneServerTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/images/test_images_whitebox.py b/tempest/tests/compute/images/test_images_whitebox.py
index 88f3b53..8af812c 100644
--- a/tempest/tests/compute/images/test_images_whitebox.py
+++ b/tempest/tests/compute/images/test_images_whitebox.py
@@ -24,6 +24,7 @@
@attr(type='whitebox')
class ImagesWhiteboxTest(whitebox.ComputeWhiteboxTest, base.BaseComputeTest):
+ _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/tests/compute/images/test_list_image_filters.py b/tempest/tests/compute/images/test_list_image_filters.py
index 316d90a..56f388d 100644
--- a/tempest/tests/compute/images/test_list_image_filters.py
+++ b/tempest/tests/compute/images/test_list_image_filters.py
@@ -19,10 +19,11 @@
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest.test import attr
-from tempest.tests.compute.base import BaseComputeTest
+from tempest.tests.compute import base
-class ListImageFiltersTest(BaseComputeTest):
+class ListImageFiltersTest(base.BaseComputeTest):
+ _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/tests/compute/images/test_list_images.py b/tempest/tests/compute/images/test_list_images.py
index 0f661b7..d583a95 100644
--- a/tempest/tests/compute/images/test_list_images.py
+++ b/tempest/tests/compute/images/test_list_images.py
@@ -16,10 +16,11 @@
# under the License.
from tempest.test import attr
-from tempest.tests.compute.base import BaseComputeTest
+from tempest.tests.compute import base
-class ListImagesTest(BaseComputeTest):
+class ListImagesTest(base.BaseComputeTest):
+ _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/tests/compute/keypairs/test_keypairs.py b/tempest/tests/compute/keypairs/test_keypairs.py
index 6f4569b..aefc5ff 100644
--- a/tempest/tests/compute/keypairs/test_keypairs.py
+++ b/tempest/tests/compute/keypairs/test_keypairs.py
@@ -20,11 +20,16 @@
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest.test import attr
-from tempest.tests.compute.base import BaseComputeTestJSON
-from tempest.tests.compute.base import BaseComputeTestXML
+from tempest.tests.compute import base
-class KeyPairsTestBase(object):
+class KeyPairsTestJSON(base.BaseComputeTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(KeyPairsTestJSON, cls).setUpClass()
+ cls.client = cls.keypairs_client
@attr(type='positive')
def test_keypairs_create_list_delete(self):
@@ -222,15 +227,5 @@
self.fail('invalid name')
-class KeyPairsTestXML(BaseComputeTestXML, KeyPairsTestBase):
- @classmethod
- def setUpClass(cls):
- super(KeyPairsTestXML, cls).setUpClass()
- cls.client = cls.keypairs_client
-
-
-class KeyPairsTestJSON(BaseComputeTestJSON, KeyPairsTestBase):
- @classmethod
- def setUpClass(cls):
- super(KeyPairsTestJSON, cls).setUpClass()
- cls.client = cls.keypairs_client
+class KeyPairsTestXML(KeyPairsTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/limits/test_absolute_limits.py b/tempest/tests/compute/limits/test_absolute_limits.py
index 4b17af9..129339c 100644
--- a/tempest/tests/compute/limits/test_absolute_limits.py
+++ b/tempest/tests/compute/limits/test_absolute_limits.py
@@ -20,10 +20,12 @@
from tempest.tests.compute import base
-class AbsoluteLimitsTest(object):
+class AbsoluteLimitsTestJSON(base.BaseComputeTest):
+ _interface = 'json'
- @staticmethod
+ @classmethod
def setUpClass(cls):
+ super(AbsoluteLimitsTestJSON, cls).setUpClass()
cls.client = cls.limits_client
def test_absLimits_get(self):
@@ -46,17 +48,5 @@
% ', '.join(ele for ele in missing_elements))
-class AbsoluteLimitsTestJSON(base.BaseComputeTestJSON,
- AbsoluteLimitsTest):
- @classmethod
- def setUpClass(cls):
- super(AbsoluteLimitsTestJSON, cls).setUpClass()
- AbsoluteLimitsTest.setUpClass(cls)
-
-
-class AbsoluteLimitsTestXML(base.BaseComputeTestXML,
- AbsoluteLimitsTest):
- @classmethod
- def setUpClass(cls):
- super(AbsoluteLimitsTestXML, cls).setUpClass()
- AbsoluteLimitsTest.setUpClass(cls)
+class AbsoluteLimitsTestXML(AbsoluteLimitsTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/security_groups/test_security_group_rules.py b/tempest/tests/compute/security_groups/test_security_group_rules.py
index 41ad2c8..5063fd3 100644
--- a/tempest/tests/compute/security_groups/test_security_group_rules.py
+++ b/tempest/tests/compute/security_groups/test_security_group_rules.py
@@ -21,10 +21,12 @@
from tempest.tests.compute import base
-class SecurityGroupRulesTest(object):
+class SecurityGroupRulesTestJSON(base.BaseComputeTest):
+ _interface = 'json'
- @staticmethod
+ @classmethod
def setUpClass(cls):
+ super(SecurityGroupRulesTestJSON, cls).setUpClass()
cls.client = cls.security_groups_client
@attr(type='positive')
@@ -243,17 +245,5 @@
'with nonexistant rule id')
-class SecurityGroupRulesTestJSON(base.BaseComputeTestJSON,
- SecurityGroupRulesTest):
- @classmethod
- def setUpClass(cls):
- super(SecurityGroupRulesTestJSON, cls).setUpClass()
- SecurityGroupRulesTest.setUpClass(cls)
-
-
-class SecurityGroupRulesTestXML(base.BaseComputeTestXML,
- SecurityGroupRulesTest):
- @classmethod
- def setUpClass(cls):
- super(SecurityGroupRulesTestXML, cls).setUpClass()
- SecurityGroupRulesTest.setUpClass(cls)
+class SecurityGroupRulesTestXML(SecurityGroupRulesTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/security_groups/test_security_groups.py b/tempest/tests/compute/security_groups/test_security_groups.py
index f6caf2b..c086280 100644
--- a/tempest/tests/compute/security_groups/test_security_groups.py
+++ b/tempest/tests/compute/security_groups/test_security_groups.py
@@ -21,10 +21,12 @@
from tempest.tests.compute import base
-class SecurityGroupsTest(object):
+class SecurityGroupsTestJSON(base.BaseComputeTest):
+ _interface = 'json'
- @staticmethod
+ @classmethod
def setUpClass(cls):
+ super(SecurityGroupsTestJSON, cls).setUpClass()
cls.client = cls.security_groups_client
@attr(type='positive')
@@ -297,17 +299,5 @@
self.assertEqual(202, resp.status)
-class SecurityGroupsTestJSON(base.BaseComputeTestJSON,
- SecurityGroupsTest):
- @classmethod
- def setUpClass(cls):
- super(SecurityGroupsTestJSON, cls).setUpClass()
- SecurityGroupsTest.setUpClass(cls)
-
-
-class SecurityGroupsTestXML(base.BaseComputeTestXML,
- SecurityGroupsTest):
- @classmethod
- def setUpClass(cls):
- super(SecurityGroupsTestXML, cls).setUpClass()
- SecurityGroupsTest.setUpClass(cls)
+class SecurityGroupsTestXML(SecurityGroupsTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/servers/test_console_output.py b/tempest/tests/compute/servers/test_console_output.py
index bdf449d..4ddbc2f 100644
--- a/tempest/tests/compute/servers/test_console_output.py
+++ b/tempest/tests/compute/servers/test_console_output.py
@@ -23,10 +23,14 @@
from tempest.tests.compute import base
-class ConsoleOutputTest(object):
+#TODO(afazekas): move these to the server actions test
+@attr(type='smoke')
+class ConsoleOutputTestJSON(base.BaseComputeTest):
+ _interface = 'json'
@classmethod
- def setUpClass(self, cls):
+ def setUpClass(cls):
+ super(ConsoleOutputTestJSON, cls).setUpClass()
cls.name = rand_name('server')
resp, server = cls.servers_client.create_server(cls.name,
cls.image_ref,
@@ -36,8 +40,9 @@
cls.servers_client.wait_for_server_status(cls.server_id, 'ACTIVE')
@classmethod
- def tearDownClass(self, cls):
+ def tearDownClass(cls):
cls.servers_client.delete_server(cls.server_id)
+ super(ConsoleOutputTestJSON, cls).tearDownClass()
@attr(type='positive')
def test_get_console_output(self):
@@ -87,28 +92,5 @@
@attr(type='smoke')
-class ConsoleOutputTestJSON(base.BaseComputeTestJSON,
- ConsoleOutputTest):
- @classmethod
- def setUpClass(cls):
- super(ConsoleOutputTestJSON, cls).setUpClass()
- ConsoleOutputTest.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- ConsoleOutputTest.tearDownClass(cls)
- super(ConsoleOutputTestJSON, cls).tearDownClass()
-
-
-@attr(type='smoke')
-class ConsoleOutputTestXML(base.BaseComputeTestXML,
- ConsoleOutputTest):
- @classmethod
- def setUpClass(cls):
- super(ConsoleOutputTestXML, cls).setUpClass()
- ConsoleOutputTest.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- ConsoleOutputTest.tearDownClass(cls)
- super(ConsoleOutputTestXML, cls).tearDownClass()
+class ConsoleOutputTestXML(ConsoleOutputTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/servers/test_create_server.py b/tempest/tests/compute/servers/test_create_server.py
index 838b382..3c8aeda 100644
--- a/tempest/tests/compute/servers/test_create_server.py
+++ b/tempest/tests/compute/servers/test_create_server.py
@@ -29,12 +29,15 @@
from tempest.tests.compute import base
-class ServersTest(object):
-
+@attr(type='smoke')
+class ServersTestJSON(base.BaseComputeTest):
+ _interface = 'json'
run_ssh = tempest.config.TempestConfig().compute.run_ssh
+ disk_config = None
- @staticmethod
+ @classmethod
def setUpClass(cls):
+ super(ServersTestJSON, cls).setUpClass()
cls.meta = {'hello': 'world'}
cls.accessIPv4 = '1.1.1.1'
cls.accessIPv6 = '0000:0000:0000:0000:0000:babe:220.12.22.2'
@@ -56,9 +59,10 @@
cls.client.wait_for_server_status(cls.server_initial['id'], 'ACTIVE')
resp, cls.server = cls.client.get_server(cls.server_initial['id'])
- @staticmethod
+ @classmethod
def tearDownClass(cls):
cls.client.delete_server(cls.server_initial['id'])
+ super(ServersTestJSON, cls).tearDownClass()
@attr(type='smoke')
def test_create_server_response(self):
@@ -121,66 +125,28 @@
@attr(type='positive')
-class ServersTestAutoDisk(base.BaseComputeTestJSON,
- ServersTest):
+class ServersTestAutoDisk(ServersTestJSON):
+ disk_config = 'AUTO'
+
@classmethod
def setUpClass(cls):
if not compute.DISK_CONFIG_ENABLED:
msg = "DiskConfig extension not enabled."
raise cls.skipException(msg)
super(ServersTestAutoDisk, cls).setUpClass()
- cls.disk_config = 'AUTO'
- ServersTest.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- ServersTest.tearDownClass(cls)
- super(ServersTestAutoDisk, cls).tearDownClass()
@attr(type='positive')
-class ServersTestManualDisk(base.BaseComputeTestJSON,
- ServersTest):
+class ServersTestManualDisk(ServersTestJSON):
+ disk_config = 'MANUAL'
+
@classmethod
def setUpClass(cls):
if not compute.DISK_CONFIG_ENABLED:
msg = "DiskConfig extension not enabled."
raise cls.skipException(msg)
super(ServersTestManualDisk, cls).setUpClass()
- cls.disk_config = 'MANUAL'
- ServersTest.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- ServersTest.tearDownClass(cls)
- super(ServersTestManualDisk, cls).tearDownClass()
-@attr(type='smoke')
-class ServersTestJSON(base.BaseComputeTestJSON,
- ServersTest):
- @classmethod
- def setUpClass(cls):
- super(ServersTestJSON, cls).setUpClass()
- cls.disk_config = None
- ServersTest.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- ServersTest.tearDownClass(cls)
- super(ServersTestJSON, cls).tearDownClass()
-
-
-@attr(type='smoke')
-class ServersTestXML(base.BaseComputeTestXML,
- ServersTest):
- @classmethod
- def setUpClass(cls):
- super(ServersTestXML, cls).setUpClass()
- cls.disk_config = None
- ServersTest.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- ServersTest.tearDownClass(cls)
- super(ServersTestXML, cls).tearDownClass()
+class ServersTestXML(ServersTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/servers/test_disk_config.py b/tempest/tests/compute/servers/test_disk_config.py
index 57b95f2..671abf9 100644
--- a/tempest/tests/compute/servers/test_disk_config.py
+++ b/tempest/tests/compute/servers/test_disk_config.py
@@ -20,10 +20,11 @@
from tempest.common.utils.data_utils import rand_name
from tempest.test import attr
from tempest.tests import compute
-from tempest.tests.compute.base import BaseComputeTest
+from tempest.tests.compute import base
-class TestServerDiskConfig(BaseComputeTest):
+class TestServerDiskConfig(base.BaseComputeTest):
+ _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/tests/compute/servers/test_list_server_filters.py b/tempest/tests/compute/servers/test_list_server_filters.py
index 9b061b5..897ca34 100644
--- a/tempest/tests/compute/servers/test_list_server_filters.py
+++ b/tempest/tests/compute/servers/test_list_server_filters.py
@@ -23,10 +23,12 @@
from tempest.tests import utils
-class ListServerFiltersTest(object):
+class ListServerFiltersTestJSON(base.BaseComputeTest):
+ _interface = 'json'
- @staticmethod
+ @classmethod
def setUpClass(cls):
+ super(ListServerFiltersTestJSON, cls).setUpClass()
cls.client = cls.servers_client
# Check to see if the alternate image ref actually exists...
@@ -77,11 +79,12 @@
cls.s2_min = cls._convert_to_min_details(cls.s2)
cls.s3_min = cls._convert_to_min_details(cls.s3)
- @staticmethod
+ @classmethod
def tearDownClass(cls):
cls.client.delete_server(cls.s1['id'])
cls.client.delete_server(cls.s2['id'])
cls.client.delete_server(cls.s3['id'])
+ super(ListServerFiltersTestJSON, cls).tearDownClass()
def _server_id_in_results(self, server_id, results):
ids = [row['id'] for row in results]
@@ -200,27 +203,5 @@
return min_detail
-class ListServerFiltersTestJSON(base.BaseComputeTestJSON,
- ListServerFiltersTest):
- @classmethod
- def setUpClass(cls):
- super(ListServerFiltersTestJSON, cls).setUpClass()
- ListServerFiltersTest.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- super(ListServerFiltersTestJSON, cls).tearDownClass()
- ListServerFiltersTest.tearDownClass(cls)
-
-
-class ListServerFiltersTestXML(base.BaseComputeTestXML,
- ListServerFiltersTest):
- @classmethod
- def setUpClass(cls):
- super(ListServerFiltersTestXML, cls).setUpClass()
- ListServerFiltersTest.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- super(ListServerFiltersTestXML, cls).tearDownClass()
- ListServerFiltersTest.tearDownClass(cls)
+class ListServerFiltersTestXML(ListServerFiltersTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/servers/test_list_servers_negative.py b/tempest/tests/compute/servers/test_list_servers_negative.py
index f93bebf..320f920 100644
--- a/tempest/tests/compute/servers/test_list_servers_negative.py
+++ b/tempest/tests/compute/servers/test_list_servers_negative.py
@@ -19,10 +19,11 @@
from tempest import clients
from tempest import exceptions
from tempest.tests import compute
-from tempest.tests.compute.base import BaseComputeTest
+from tempest.tests.compute import base
-class ListServersNegativeTest(BaseComputeTest):
+class ListServersNegativeTest(base.BaseComputeTest):
+ _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/tests/compute/servers/test_server_actions.py b/tempest/tests/compute/servers/test_server_actions.py
index 06e441a..a9ada39 100644
--- a/tempest/tests/compute/servers/test_server_actions.py
+++ b/tempest/tests/compute/servers/test_server_actions.py
@@ -29,11 +29,26 @@
from tempest.tests.compute import base
-class ServerActionsTestBase(object):
-
+class ServerActionsTestJSON(base.BaseComputeTest):
+ _interface = 'json'
resize_available = tempest.config.TempestConfig().compute.resize_available
run_ssh = tempest.config.TempestConfig().compute.run_ssh
+ def setUp(self):
+ super(ServerActionsTestJSON, self).setUp()
+ # Check if the server is in a clean state after test
+ try:
+ self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ except exceptions:
+ # Rebuild server if something happened to it during a test
+ self.rebuild_servers()
+
+ @classmethod
+ def setUpClass(cls):
+ super(ServerActionsTestJSON, cls).setUpClass()
+ cls.client = cls.servers_client
+ cls.rebuild_servers()
+
@attr(type='smoke')
@testtools.skipUnless(compute.CHANGE_PASSWORD_AVAILABLE,
'Change password not available.')
@@ -219,37 +234,5 @@
cls.client.wait_for_server_status(cls.server_id, 'ACTIVE')
-class ServerActionsTestXML(base.BaseComputeTestXML,
- ServerActionsTestBase):
- def setUp(self):
- super(ServerActionsTestXML, self).setUp()
- # Check if the server is in a clean state after test
- try:
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
- except exceptions:
- # Rebuild server if something happened to it during a test
- self.rebuild_servers()
-
- @classmethod
- def setUpClass(cls):
- super(ServerActionsTestXML, cls).setUpClass()
- cls.client = cls.servers_client
- cls.rebuild_servers()
-
-
-class ServerActionsTestJSON(base.BaseComputeTestJSON,
- ServerActionsTestBase):
- def setUp(self):
- super(ServerActionsTestJSON, self).setUp()
- # Check if the server is in a clean state after test
- try:
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
- except exceptions:
- # Rebuild server if something happened to it during a test
- self.rebuild_servers()
-
- @classmethod
- def setUpClass(cls):
- super(ServerActionsTestJSON, cls).setUpClass()
- cls.client = cls.servers_client
- cls.rebuild_servers()
+class ServerActionsTestXML(ServerActionsTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/servers/test_server_addresses.py b/tempest/tests/compute/servers/test_server_addresses.py
index 8888281..b811d52 100644
--- a/tempest/tests/compute/servers/test_server_addresses.py
+++ b/tempest/tests/compute/servers/test_server_addresses.py
@@ -18,10 +18,11 @@
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest.test import attr
-from tempest.tests.compute.base import BaseComputeTest
+from tempest.tests.compute import base
-class ServerAddressesTest(BaseComputeTest):
+class ServerAddressesTest(base.BaseComputeTest):
+ _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/tests/compute/servers/test_server_metadata.py b/tempest/tests/compute/servers/test_server_metadata.py
index ef1b956..6958a7d 100644
--- a/tempest/tests/compute/servers/test_server_metadata.py
+++ b/tempest/tests/compute/servers/test_server_metadata.py
@@ -18,10 +18,11 @@
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest.test import attr
-from tempest.tests.compute.base import BaseComputeTest
+from tempest.tests.compute import base
-class ServerMetadataTest(BaseComputeTest):
+class ServerMetadataTest(base.BaseComputeTest):
+ _interface = 'json'
@classmethod
def setUpClass(cls):
@@ -162,6 +163,21 @@
'not succeed')
@attr(type='negative')
+ def test_set_server_metadata_item_incorrect_uri_key(self):
+ #Raise BadRequest if key in uri does not match
+ #the key passed in body.
+
+ meta = {'testkey': 'testvalue'}
+ try:
+ resp, metadata = self.client.set_server_metadata_item(
+ self.server_id, 'key', meta)
+ except exceptions.BadRequest:
+ pass
+ else:
+ self.fail('Should raise BadRequest if URI key does not match key'
+ 'passed in the body')
+
+ @attr(type='negative')
def test_set_nonexistant_server_metadata(self):
# Negative test: Set metadata on a non existant server should not
# succeed
diff --git a/tempest/tests/compute/servers/test_server_personality.py b/tempest/tests/compute/servers/test_server_personality.py
index 862cfb2..816ca76 100644
--- a/tempest/tests/compute/servers/test_server_personality.py
+++ b/tempest/tests/compute/servers/test_server_personality.py
@@ -23,7 +23,14 @@
from tempest.tests.compute import base
-class ServerPersonalityTestBase(object):
+class ServerPersonalityTestJSON(base.BaseComputeTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(ServerPersonalityTestJSON, cls).setUpClass()
+ cls.client = cls.servers_client
+ cls.user_client = cls.limits_client
def test_personality_files_exceed_limit(self):
# Server creation should fail if greater than the maximum allowed
@@ -74,21 +81,5 @@
self.client.delete_server(server['id'])
-class ServerPersonalityTestXML(base.BaseComputeTestXML,
- ServerPersonalityTestBase):
- @classmethod
- def setUpClass(cls):
- cls._interface = "xml"
- super(ServerPersonalityTestXML, cls).setUpClass()
- cls.client = cls.servers_client
- cls.user_client = cls.limits_client
-
-
-class ServerPersonalityTestJSON(base.BaseComputeTestJSON,
- ServerPersonalityTestBase):
- @classmethod
- def setUpClass(cls):
- cls._interface = "json"
- super(ServerPersonalityTestJSON, cls).setUpClass()
- cls.client = cls.servers_client
- cls.user_client = cls.limits_client
+class ServerPersonalityTestXML(ServerPersonalityTestJSON):
+ _interface = "xml"
diff --git a/tempest/tests/compute/servers/test_servers.py b/tempest/tests/compute/servers/test_servers.py
index caf0679..a912652 100644
--- a/tempest/tests/compute/servers/test_servers.py
+++ b/tempest/tests/compute/servers/test_servers.py
@@ -20,7 +20,13 @@
from tempest.tests.compute import base
-class ServersTestBase(object):
+class ServersTestJSON(base.BaseComputeTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(ServersTestJSON, cls).setUpClass()
+ cls.client = cls.servers_client
@attr(type='positive')
def test_create_server_with_admin_password(self):
@@ -155,15 +161,5 @@
self.assertEqual('204', resp['status'])
-class ServersTestJSON(base.BaseComputeTestJSON, ServersTestBase):
- @classmethod
- def setUpClass(cls):
- super(ServersTestJSON, cls).setUpClass()
- cls.client = cls.servers_client
-
-
-class ServersTestXML(base.BaseComputeTestXML, ServersTestBase):
- @classmethod
- def setUpClass(cls):
- super(ServersTestXML, cls).setUpClass()
- cls.client = cls.servers_client
+class ServersTestXML(ServersTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/servers/test_servers_negative.py b/tempest/tests/compute/servers/test_servers_negative.py
index 9b528f6..553af78 100644
--- a/tempest/tests/compute/servers/test_servers_negative.py
+++ b/tempest/tests/compute/servers/test_servers_negative.py
@@ -287,3 +287,9 @@
pass
else:
self.fail('Server was created with nonexistent security group')
+
+ @attr(type='negative')
+ def test_get_non_existent_server(self):
+ # Get a non existent server details
+ self.assertRaises(exceptions.NotFound, self.client.get_server,
+ '999erra43')
diff --git a/tempest/tests/compute/servers/test_servers_whitebox.py b/tempest/tests/compute/servers/test_servers_whitebox.py
index 94502c3..9b75cd5 100644
--- a/tempest/tests/compute/servers/test_servers_whitebox.py
+++ b/tempest/tests/compute/servers/test_servers_whitebox.py
@@ -23,11 +23,13 @@
@attr(type='whitebox')
class ServersWhiteboxTest(whitebox.ComputeWhiteboxTest):
+ _interface = 'json'
@classmethod
def setUpClass(cls):
raise cls.skipException("Until Bug 1034129 is fixed")
super(ServersWhiteboxTest, cls).setUpClass()
+ #NOTE(afazekas): Strange relationship
BaseIdentityAdminTest.setUpClass()
cls.client = cls.servers_client
cls.img_client = cls.images_client
diff --git a/tempest/tests/compute/servers/test_virtual_interfaces.py b/tempest/tests/compute/servers/test_virtual_interfaces.py
index 6198526..65da24f 100644
--- a/tempest/tests/compute/servers/test_virtual_interfaces.py
+++ b/tempest/tests/compute/servers/test_virtual_interfaces.py
@@ -21,10 +21,13 @@
from tempest.tests.compute import base
-class VirtualInterfacesTest(object):
+@attr(type='smoke')
+class VirtualInterfacesTestJSON(base.BaseComputeTest):
+ _interface = 'json'
@classmethod
- def setUpClass(self, cls):
+ def setUpClass(cls):
+ super(VirtualInterfacesTestJSON, cls).setUpClass()
cls.name = rand_name('server')
cls.client = cls.servers_client
resp, server = cls.servers_client.create_server(cls.name,
@@ -35,8 +38,9 @@
cls.servers_client.wait_for_server_status(cls.server_id, 'ACTIVE')
@classmethod
- def tearDownClass(self, cls):
+ def tearDownClass(cls):
cls.servers_client.delete_server(cls.server_id)
+ super(VirtualInterfacesTestJSON, cls).tearDownClass()
@attr(type='positive')
def test_list_virtual_interfaces(self):
@@ -60,28 +64,5 @@
@attr(type='smoke')
-class VirtualInterfacesTestJSON(base.BaseComputeTestJSON,
- VirtualInterfacesTest):
- @classmethod
- def setUpClass(cls):
- super(VirtualInterfacesTestJSON, cls).setUpClass()
- VirtualInterfacesTest.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- VirtualInterfacesTest.tearDownClass(cls)
- super(VirtualInterfacesTestJSON, cls).tearDownClass()
-
-
-@attr(type='smoke')
-class VirtualInterfacesTestXML(base.BaseComputeTestXML,
- VirtualInterfacesTest):
- @classmethod
- def setUpClass(cls):
- super(VirtualInterfacesTestXML, cls).setUpClass()
- VirtualInterfacesTest.setUpClass(cls)
-
- @classmethod
- def tearDownClass(cls):
- VirtualInterfacesTest.tearDownClass(cls)
- super(VirtualInterfacesTestXML, cls).tearDownClass()
+class VirtualInterfacesTestXML(VirtualInterfacesTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/test_authorization.py b/tempest/tests/compute/test_authorization.py
index d826d40..52e457d 100644
--- a/tempest/tests/compute/test_authorization.py
+++ b/tempest/tests/compute/test_authorization.py
@@ -22,10 +22,11 @@
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest.tests import compute
-from tempest.tests.compute.base import BaseComputeTest
+from tempest.tests.compute import base
-class AuthorizationTest(BaseComputeTest):
+class AuthorizationTest(base.BaseComputeTest):
+ _interface = 'json'
@classmethod
def setUpClass(cls):
@@ -243,6 +244,7 @@
# Reset the base_url...
self.alt_security_client.base_url = self.saved_base_url
if resp['status'] is not None:
+ #TODO(afazekas): body not defined
self.alt_security_client.delete_security_group(body['id'])
self.fail("Create Security Group request should not happen if"
"the tenant id does not match the current user")
@@ -283,7 +285,7 @@
self.alt_security_client.base_url = self.saved_base_url
if resp['status'] is not None:
self.alt_security_client.delete_security_group_rule(
- body['id'])
+ body['id']) # BUG
self.fail("Create security group rule request should not "
"happen if the tenant id does not match the"
" current user")
diff --git a/tempest/tests/compute/test_extensions.py b/tempest/tests/compute/test_extensions.py
index 36a04d2..2c13fb9 100644
--- a/tempest/tests/compute/test_extensions.py
+++ b/tempest/tests/compute/test_extensions.py
@@ -20,27 +20,16 @@
from tempest.tests.compute import base
-class ExtensionsTestBase(object):
+class ExtensionsTestJSON(base.BaseComputeTest):
+ _interface = 'json'
@attr(type='positive')
def test_list_extensions(self):
# List of all extensions
- resp, extensions = self.client.list_extensions()
+ resp, extensions = self.extensions_client.list_extensions()
self.assertTrue("extensions" in extensions)
self.assertEqual(200, resp.status)
-class ExtensionsTestJSON(base.BaseComputeTest, ExtensionsTestBase):
-
- @classmethod
- def setUpClass(cls):
- super(ExtensionsTestJSON, cls).setUpClass()
- cls.client = cls.extensions_client
-
-
-class ExtensionsTestXML(base.BaseComputeTestXML, ExtensionsTestBase):
-
- @classmethod
- def setUpClass(cls):
- super(ExtensionsTestXML, cls).setUpClass()
- cls.client = cls.extensions_client
+class ExtensionsTestXML(ExtensionsTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/test_live_block_migration.py b/tempest/tests/compute/test_live_block_migration.py
index 6449ddc..078026a 100644
--- a/tempest/tests/compute/test_live_block_migration.py
+++ b/tempest/tests/compute/test_live_block_migration.py
@@ -30,6 +30,7 @@
@attr(category='live-migration')
class LiveBlockMigrationTest(base.BaseComputeTest):
+ _interface = 'json'
live_migration_available = (
config.TempestConfig().compute.live_migration_available)
diff --git a/tempest/tests/compute/test_quotas.py b/tempest/tests/compute/test_quotas.py
index c2ad358..dbff275 100644
--- a/tempest/tests/compute/test_quotas.py
+++ b/tempest/tests/compute/test_quotas.py
@@ -19,10 +19,12 @@
from tempest.tests.compute import base
-class QuotasTestBase(object):
+class QuotasTestJSON(base.BaseComputeTest):
+ _interface = 'json'
@classmethod
def setUpClass(cls):
+ super(QuotasTestJSON, cls).setUpClass()
cls.client = cls.quotas_client
cls.admin_client = cls._get_identity_admin_client()
resp, tenants = cls.admin_client.list_tenants()
@@ -47,17 +49,5 @@
self.fail("Quota set for tenant did not have default limits")
-class QuotasTestJSON(QuotasTestBase, base.BaseComputeTestJSON):
-
- @classmethod
- def setUpClass(cls):
- base.BaseComputeTestJSON.setUpClass()
- super(QuotasTestJSON, cls).setUpClass()
-
-
-class QuotasTestXML(QuotasTestBase, base.BaseComputeTestXML):
-
- @classmethod
- def setUpClass(cls):
- base.BaseComputeTestXML.setUpClass()
- super(QuotasTestXML, cls).setUpClass()
+class QuotasTestXML(QuotasTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/volumes/test_attach_volume.py b/tempest/tests/compute/volumes/test_attach_volume.py
index 1aed833..2679312 100644
--- a/tempest/tests/compute/volumes/test_attach_volume.py
+++ b/tempest/tests/compute/volumes/test_attach_volume.py
@@ -24,12 +24,13 @@
from tempest.tests.compute import base
-class AttachVolumeTest(object):
-
+class AttachVolumeTestJSON(base.BaseComputeTest):
+ _interface = 'json'
run_ssh = tempest.config.TempestConfig().compute.run_ssh
- @staticmethod
+ @classmethod
def setUpClass(cls):
+ super(AttachVolumeTestJSON, cls).setUpClass()
cls.device = 'vdb'
def _detach(self, server_id, volume_id):
@@ -106,17 +107,5 @@
self._delete(server['id'], volume['id'])
-class TestAttachVolumeJSON(base.BaseComputeTestJSON,
- AttachVolumeTest):
- @classmethod
- def setUpClass(cls):
- super(TestAttachVolumeJSON, cls).setUpClass()
- AttachVolumeTest.setUpClass(cls)
-
-
-class TestAttachVolumeXML(base.BaseComputeTestXML,
- AttachVolumeTest):
- @classmethod
- def setUpClass(cls):
- super(TestAttachVolumeXML, cls).setUpClass()
- AttachVolumeTest.setUpClass(cls)
+class AttachVolumeTestXML(AttachVolumeTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/volumes/test_volumes_get.py b/tempest/tests/compute/volumes/test_volumes_get.py
index edbfc32..65d2d45 100644
--- a/tempest/tests/compute/volumes/test_volumes_get.py
+++ b/tempest/tests/compute/volumes/test_volumes_get.py
@@ -20,7 +20,14 @@
from tempest.tests.compute import base
-class VolumesGetTestBase(object):
+class VolumesGetTestJSON(base.BaseComputeTest):
+
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(VolumesGetTestJSON, cls).setUpClass()
+ cls.client = cls.volumes_extensions_client
@attr(type='smoke')
def test_volume_create_get_delete(self):
@@ -94,17 +101,5 @@
self.client.wait_for_resource_deletion(volume['id'])
-class VolumesGetTestXML(base.BaseComputeTestXML, VolumesGetTestBase):
- @classmethod
- def setUpClass(cls):
- cls._interface = "xml"
- super(VolumesGetTestXML, cls).setUpClass()
- cls.client = cls.volumes_extensions_client
-
-
-class VolumesGetTestJSON(base.BaseComputeTestJSON, VolumesGetTestBase):
- @classmethod
- def setUpClass(cls):
- cls._interface = "json"
- super(VolumesGetTestJSON, cls).setUpClass()
- cls.client = cls.volumes_extensions_client
+class VolumesGetTestXML(VolumesGetTestJSON):
+ _interface = "xml"
diff --git a/tempest/tests/compute/volumes/test_volumes_list.py b/tempest/tests/compute/volumes/test_volumes_list.py
index cc690a5..ffd6a8c 100644
--- a/tempest/tests/compute/volumes/test_volumes_list.py
+++ b/tempest/tests/compute/volumes/test_volumes_list.py
@@ -20,7 +20,7 @@
from tempest.tests.compute import base
-class VolumesTestBase(object):
+class VolumesTestJSON(base.BaseComputeTest):
"""
This test creates a number of 1G volumes. To run successfully,
@@ -30,87 +30,10 @@
VOLUME_BACKING_FILE_SIZE is atleast 4G in your localrc
"""
- def test_volume_list(self):
- # Should return the list of Volumes
- # Fetch all Volumes
- resp, fetched_list = self.client.list_volumes()
- self.assertEqual(200, resp.status)
- # Now check if all the Volumes created in setup are in fetched list
- missing_volumes = [
- v for v in self.volume_list if v not in fetched_list
- ]
+ _interface = 'json'
- self.assertFalse(missing_volumes,
- "Failed to find volume %s in fetched list" %
- ', '.join(m_vol['displayName']
- for m_vol in missing_volumes))
-
- def test_volume_list_with_details(self):
- # Should return the list of Volumes with details
- #Fetch all Volumes
- resp, fetched_list = self.client.list_volumes_with_detail()
- self.assertEqual(200, resp.status)
- #Now check if all the Volumes created in setup are in fetched list
- missing_volumes = [
- v for v in self.volume_list if v not in fetched_list
- ]
-
- self.assertFalse(missing_volumes,
- "Failed to find volume %s in fetched list" %
- ', '.join(m_vol['displayName']
- for m_vol in missing_volumes))
-
-
-class VolumesTestXML(base.BaseComputeTestXML, VolumesTestBase):
@classmethod
def setUpClass(cls):
- cls._interface = 'xml'
- super(VolumesTestXML, cls).setUpClass()
- cls.client = cls.volumes_extensions_client
- # Create 3 Volumes
- cls.volume_list = list()
- cls.volume_id_list = list()
- for i in range(3):
- v_name = rand_name('volume')
- metadata = {'Type': 'work'}
- v_name += cls._interface
- try:
- resp, volume = cls.client.create_volume(size=1,
- display_name=v_name,
- metadata=metadata)
- cls.client.wait_for_volume_status(volume['id'], 'available')
- resp, volume = cls.client.get_volume(volume['id'])
- cls.volume_list.append(volume)
- cls.volume_id_list.append(volume['id'])
- except Exception:
- if cls.volume_list:
- # We could not create all the volumes, though we were able
- # to create *some* of the volumes. This is typically
- # because the backing file size of the volume group is
- # too small. So, here, we clean up whatever we did manage
- # to create and raise a SkipTest
- for volume in cls.volume_list:
- cls.client.delete_volume(volume)
- msg = ("Failed to create ALL necessary volumes to run "
- "test. This typically means that the backing file "
- "size of the nova-volumes group is too small to "
- "create the 3 volumes needed by this test case")
- raise cls.skipException(msg)
- raise
-
- @classmethod
- def tearDownClass(cls):
- # Delete the created Volumes
- for volume in cls.volume_list:
- resp, _ = cls.client.delete_volume(volume['id'])
- cls.client.wait_for_resource_deletion(volume['id'])
- super(VolumesTestXML, cls).tearDownClass()
-
-
-class VolumesTestJSON(base.BaseComputeTestJSON, VolumesTestBase):
- @classmethod
- def setUpClass(cls):
- cls._interface = 'json'
super(VolumesTestJSON, cls).setUpClass()
cls.client = cls.volumes_extensions_client
# Create 3 Volumes
@@ -151,3 +74,37 @@
resp, _ = cls.client.delete_volume(volume['id'])
cls.client.wait_for_resource_deletion(volume['id'])
super(VolumesTestJSON, cls).tearDownClass()
+
+ def test_volume_list(self):
+ # Should return the list of Volumes
+ # Fetch all Volumes
+ resp, fetched_list = self.client.list_volumes()
+ self.assertEqual(200, resp.status)
+ # Now check if all the Volumes created in setup are in fetched list
+ missing_volumes = [
+ v for v in self.volume_list if v not in fetched_list
+ ]
+
+ self.assertFalse(missing_volumes,
+ "Failed to find volume %s in fetched list" %
+ ', '.join(m_vol['displayName']
+ for m_vol in missing_volumes))
+
+ def test_volume_list_with_details(self):
+ # Should return the list of Volumes with details
+ #Fetch all Volumes
+ resp, fetched_list = self.client.list_volumes_with_detail()
+ self.assertEqual(200, resp.status)
+ #Now check if all the Volumes created in setup are in fetched list
+ missing_volumes = [
+ v for v in self.volume_list if v not in fetched_list
+ ]
+
+ self.assertFalse(missing_volumes,
+ "Failed to find volume %s in fetched list" %
+ ', '.join(m_vol['displayName']
+ for m_vol in missing_volumes))
+
+
+class VolumesTestXML(VolumesTestJSON):
+ _interface = 'xml'
diff --git a/tempest/tests/compute/volumes/test_volumes_negative.py b/tempest/tests/compute/volumes/test_volumes_negative.py
index b24c240..c0fa565 100644
--- a/tempest/tests/compute/volumes/test_volumes_negative.py
+++ b/tempest/tests/compute/volumes/test_volumes_negative.py
@@ -20,7 +20,13 @@
from tempest.tests.compute import base
-class VolumesNegativeTestBase(object):
+class VolumesNegativeTest(base.BaseComputeTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(VolumesNegativeTest, cls).setUpClass()
+ cls.client = cls.volumes_extensions_client
def test_volume_get_nonexistant_volume_id(self):
# Negative: Should not be able to get details of nonexistant volume
@@ -104,19 +110,5 @@
self.assertRaises(exceptions.NotFound, self.client.delete_volume, '')
-class VolumesNegativeTestXML(base.BaseComputeTestXML,
- VolumesNegativeTestBase):
- @classmethod
- def setUpClass(cls):
- cls._interface = "xml"
- super(VolumesNegativeTestXML, cls).setUpClass()
- cls.client = cls.volumes_extensions_client
-
-
-class VolumesNegativeTestJSON(base.BaseComputeTestJSON,
- VolumesNegativeTestBase):
- @classmethod
- def setUpClass(cls):
- cls._interface = "json"
- super(VolumesNegativeTestJSON, cls).setUpClass()
- cls.client = cls.volumes_extensions_client
+class VolumesNegativeTestXML(VolumesNegativeTest):
+ _interface = "xml"
diff --git a/tempest/tests/identity/admin/test_services.py b/tempest/tests/identity/admin/test_services.py
index 9ac102a..77c8e83 100644
--- a/tempest/tests/identity/admin/test_services.py
+++ b/tempest/tests/identity/admin/test_services.py
@@ -56,12 +56,13 @@
self.assertEqual(fetched_service['description'],
service_data['description'])
finally:
- #Deleting the service created in this method
- resp, _ = self.client.delete_service(service_data['id'])
- self.assertTrue(resp['status'].startswith('2'))
- #Checking whether service is deleted successfully
- self.assertRaises(exceptions.NotFound, self.client.get_service,
- service_data['id'])
+ if 'service_data' in locals():
+ # Deleting the service created in this method
+ resp, _ = self.client.delete_service(service_data['id'])
+ self.assertEqual(resp['status'], '204')
+ # Checking whether service is deleted successfully
+ self.assertRaises(exceptions.NotFound, self.client.get_service,
+ service_data['id'])
def test_list_services(self):
# Create, List, Verify and Delete Services
diff --git a/tempest/tests/identity/base.py b/tempest/tests/identity/base.py
index fbff88f..2c4162c 100644
--- a/tempest/tests/identity/base.py
+++ b/tempest/tests/identity/base.py
@@ -15,14 +15,13 @@
# License for the specific language governing permissions and limitations
# under the License.
-import testtools
from tempest import clients
from tempest.common.utils.data_utils import rand_name
+import tempest.test
-class BaseIdAdminTest(testtools.testcase.WithAttributes,
- testtools.TestCase):
+class BaseIdAdminTest(tempest.test.BaseTestCase):
@classmethod
def setUpClass(cls):
diff --git a/tempest/tests/image/test_images.py b/tempest/tests/image/test_images.py
index 511f8b0..6ac852e 100644
--- a/tempest/tests/image/test_images.py
+++ b/tempest/tests/image/test_images.py
@@ -18,7 +18,7 @@
import cStringIO as StringIO
import random
-import testtools
+import tempest.test
from tempest.test import attr
@@ -27,8 +27,7 @@
from tempest import exceptions
-class CreateRegisterImagesTest(testtools.testcase.WithAttributes,
- testtools.TestCase):
+class CreateRegisterImagesTest(tempest.test.BaseTestCase):
"""
Here we test the registration and creation of images
@@ -108,8 +107,7 @@
self.assertEqual('active', body.get('status'))
-class ListImagesTest(testtools.testcase.WithAttributes,
- testtools.TestCase):
+class ListImagesTest(tempest.test.BaseTestCase):
"""
Here we test the listing of image information
diff --git a/tempest/tests/network/base.py b/tempest/tests/network/base.py
index 8606079..4cc8b29 100644
--- a/tempest/tests/network/base.py
+++ b/tempest/tests/network/base.py
@@ -15,28 +15,25 @@
# License for the specific language governing permissions and limitations
# under the License.
-import testtools
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
+import tempest.test
-class BaseNetworkTest(testtools.testcase.WithAttributes,
- testtools.TestCase):
+class BaseNetworkTest(tempest.test.BaseTestCase):
@classmethod
def setUpClass(cls):
os = clients.Manager()
client = os.network_client
- enabled = True
# Validate that there is even an endpoint configured
# for networks, and mark the attr for skipping if not
try:
client.list_networks()
except exceptions.EndpointNotFound:
- enabled = False
skip_msg = "No OpenStack Network API endpoint"
raise cls.skipException(skip_msg)
diff --git a/tempest/tests/object_storage/base.py b/tempest/tests/object_storage/base.py
index 2492d8b..5bfe1a3 100644
--- a/tempest/tests/object_storage/base.py
+++ b/tempest/tests/object_storage/base.py
@@ -15,15 +15,14 @@
# License for the specific language governing permissions and limitations
# under the License.
-import testtools
from tempest import clients
from tempest import exceptions
+import tempest.test
from tempest.tests.identity.base import DataGenerator
-class BaseObjectTest(testtools.testcase.WithAttributes,
- testtools.TestCase):
+class BaseObjectTest(tempest.test.BaseTestCase):
@classmethod
def setUpClass(cls):
@@ -31,7 +30,6 @@
cls.object_client = cls.os.object_client
cls.container_client = cls.os.container_client
cls.account_client = cls.os.account_client
- cls.config = cls.os.config
cls.custom_object_client = cls.os.custom_object_client
cls.os_admin = clients.AdminManager()
cls.token_client = cls.os_admin.token_client
diff --git a/tempest/tests/volume/base.py b/tempest/tests/volume/base.py
index 4ddd670..00e8668 100644
--- a/tempest/tests/volume/base.py
+++ b/tempest/tests/volume/base.py
@@ -18,24 +18,20 @@
import logging
import time
-import testtools
-
from tempest import clients
from tempest.common.utils.data_utils import rand_name
-from tempest import config
from tempest import exceptions
+import tempest.test
LOG = logging.getLogger(__name__)
-class BaseVolumeTest(testtools.testcase.WithAttributes,
- testtools.TestCase):
+class BaseVolumeTest(tempest.test.BaseTestCase):
"""Base test case class for all Cinder API tests."""
@classmethod
def setUpClass(cls):
- cls.config = config.TempestConfig()
cls.isolated_creds = []
if cls.config.compute.allow_tenant_isolation:
diff --git a/tempest/whitebox.py b/tempest/whitebox.py
index d5fa023..bfcc373 100644
--- a/tempest/whitebox.py
+++ b/tempest/whitebox.py
@@ -89,18 +89,18 @@
# NOTE(jaypipes): Tests often add things in a particular order
# so we destroy resources in the reverse order in which resources
# are added to the test class object
- if not cls.resources:
+ if not cls.os_resources:
return
- thing = cls.resources.pop()
+ thing = cls.os_resources.pop()
while True:
LOG.debug("Deleting %r from shared resources of %s" %
(thing, cls.__name__))
# Resources in novaclient all have a delete() method
# which destroys the resource...
thing.delete()
- if not cls.resources:
+ if not cls.os_resources:
return
- thing = cls.resources.pop()
+ thing = cls.os_resources.pop()
@classmethod
def create_server(cls, image_id=None):