Merge "Convert compute api tests to global CONF object"
diff --git a/etc/whitelist.yaml b/etc/whitelist.yaml
index 1c12b6c..2d8b741 100644
--- a/etc/whitelist.yaml
+++ b/etc/whitelist.yaml
@@ -78,6 +78,8 @@
ceilometer-acentral:
- module: "ceilometer.central.manager"
message: "403 Forbidden"
+ - module: "ceilometer.central.manager"
+ message: "get_samples\\(\\) got an unexpected keyword argument 'resources'"
ceilometer-alarm-evaluator:
- module: "ceilometer.alarm.service"
@@ -133,6 +135,8 @@
message: "but the actual state is deleting to caller"
- module: "nova.openstack.common.rpc.common"
message: "Traceback \\(most recent call last"
+ - module: "nova.openstack.common.threadgroup"
+ message: "Service with host .* topic conductor exists."
n-sch:
- module: "nova.scheduler.filter_scheduler"
diff --git a/run_tempest.sh b/run_tempest.sh
index be9b38a..f6c330d 100755
--- a/run_tempest.sh
+++ b/run_tempest.sh
@@ -13,7 +13,7 @@
echo " -t, --serial Run testr serially"
echo " -C, --config Config file location"
echo " -h, --help Print this usage message"
- echo " -d, --debug Debug this script -- set -o xtrace"
+ echo " -d, --debug Run tests with testtools instead of testr. This allows you to use PDB"
echo " -l, --logging Enable logging"
echo " -L, --logging-config Logging config file location. Default is etc/logging.conf"
echo " -- [TESTROPTIONS] After the first '--' you can pass arbitrary arguments to testr "
@@ -26,6 +26,7 @@
always_venv=0
never_venv=0
no_site_packages=0
+debug=0
force=0
wrapper=""
config_file=""
@@ -50,7 +51,7 @@
-n|--no-site-packages) no_site_packages=1;;
-f|--force) force=1;;
-u|--update) update=1;;
- -d|--debug) set -o xtrace;;
+ -d|--debug) debug=1;;
-C|--config) config_file=$2; shift;;
-s|--smoke) testrargs+="smoke"; noseargs+="--attr=type=smoke";;
-t|--serial) serial=1;;
@@ -94,6 +95,14 @@
testr_init
${wrapper} find . -type f -name "*.pyc" -delete
export OS_TEST_PATH=./tempest/test_discover
+ if [ $debug -eq 1 ]; then
+ if [ "$testrargs" = "" ]; then
+ testrargs="discover ./tempest/test_discover"
+ fi
+ ${wrapper} python -m testtools.run $testrargs
+ return $?
+ fi
+
if [ $serial -eq 1 ]; then
${wrapper} testr run --subunit $testrargs | ${wrapper} subunit-2to1 | ${wrapper} tools/colorizer.py
else
diff --git a/run_tests.sh b/run_tests.sh
index 3f00453..eaa7fd7 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -13,7 +13,7 @@
echo " -p, --pep8 Just run pep8"
echo " -c, --coverage Generate coverage report"
echo " -h, --help Print this usage message"
- echo " -d, --debug Debug this script -- set -o xtrace"
+ echo " -d, --debug Run tests with testtools instead of testr. This allows you to use PDB"
echo " -- [TESTROPTIONS] After the first '--' you can pass arbitrary arguments to testr "
}
@@ -25,6 +25,7 @@
always_venv=0
never_venv=0
no_site_packages=0
+debug=0
force=0
coverage=0
wrapper=""
@@ -48,7 +49,7 @@
-n|--no-site-packages) no_site_packages=1;;
-f|--force) force=1;;
-u|--update) update=1;;
- -d|--debug) set -o xtrace;;
+ -d|--debug) debug=1;;
-p|--pep8) let just_pep8=1;;
-c|--coverage) coverage=1;;
-t|--serial) serial=1;;
@@ -75,6 +76,14 @@
testr_init
${wrapper} find . -type f -name "*.pyc" -delete
export OS_TEST_PATH=./tempest/tests
+ if [ $debug -eq 1 ]; then
+ if [ "$testrargs" = "" ]; then
+ testrargs="discover ./tempest/tests"
+ fi
+ ${wrapper} python -m testtools.run $testrargs
+ return $?
+ fi
+
if [ $serial -eq 1 ]; then
${wrapper} testr run --subunit $testrargs | ${wrapper} subunit-2to1 | ${wrapper} tools/colorizer.py
else
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions.py b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
index 2c89391..56bd291 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
@@ -96,9 +96,7 @@
# to specific server should change the association of the Floating IP
# Create server so as to use for Multiple association
new_name = rand_name('floating_server')
- resp, body = self.servers_client.create_server(new_name,
- self.image_ref,
- self.flavor_ref)
+ resp, body = self.create_test_server(name=new_name)
self.servers_client.wait_for_server_status(body['id'], 'ACTIVE')
self.new_server_id = body['id']
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index bff6e14..2c67581 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -121,9 +121,7 @@
# Create server and add the security group created
# above to the server we just created
server_name = data_utils.rand_name('server')
- resp, server = self.servers_client.create_server(server_name,
- self.image_ref,
- self.flavor_ref)
+ resp, server = self.create_test_server(name=server_name)
server_id = server['id']
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
resp, body = self.servers_client.add_security_group(server_id,
diff --git a/tempest/api/compute/v3/images/test_images_oneserver.py b/tempest/api/compute/v3/images/test_images_oneserver.py
index c5ab691..992d158 100644
--- a/tempest/api/compute/v3/images/test_images_oneserver.py
+++ b/tempest/api/compute/v3/images/test_images_oneserver.py
@@ -119,10 +119,6 @@
@attr(type=['gate'])
def test_create_image_specify_multibyte_character_image_name(self):
- if self.__class__._interface == "xml":
- # NOTE(sdague): not entirely accurage, but we'd need a ton of work
- # in our XML client to make this good
- raise self.skipException("Not testable in XML")
# prefix character is:
# http://www.fileformat.info/info/unicode/char/1F4A9/index.htm
utf8_name = data_utils.rand_name(u'\xF0\x9F\x92\xA9')
diff --git a/tempest/api/compute/v3/images/test_images_oneserver_negative.py b/tempest/api/compute/v3/images/test_images_oneserver_negative.py
index bebec9a..3404823 100644
--- a/tempest/api/compute/v3/images/test_images_oneserver_negative.py
+++ b/tempest/api/compute/v3/images/test_images_oneserver_negative.py
@@ -88,8 +88,6 @@
@skip_because(bug="1006725")
@attr(type=['negative', 'gate'])
def test_create_image_specify_multibyte_character_image_name(self):
- if self.__class__._interface == "xml":
- raise self.skipException("Not testable in XML")
# invalid multibyte sequence from:
# http://stackoverflow.com/questions/1301402/
# example-invalid-utf8-string
diff --git a/tempest/api/compute/v3/images/test_list_image_filters.py b/tempest/api/compute/v3/images/test_list_image_filters.py
index 1459792..82b9625 100644
--- a/tempest/api/compute/v3/images/test_list_image_filters.py
+++ b/tempest/api/compute/v3/images/test_list_image_filters.py
@@ -137,8 +137,6 @@
# Verify only the expected number of results are returned
params = {'limit': '1'}
resp, images = self.client.list_images(params)
- # when _interface='xml', one element for images_links in images
- # ref: Question #224349
self.assertEqual(1, len([x for x in images if 'id' in x]))
@attr(type='gate')
diff --git a/tempest/api/compute/v3/servers/test_list_server_filters.py b/tempest/api/compute/v3/servers/test_list_server_filters.py
index 3638045..533a2c2 100644
--- a/tempest/api/compute/v3/servers/test_list_server_filters.py
+++ b/tempest/api/compute/v3/servers/test_list_server_filters.py
@@ -123,7 +123,6 @@
# Verify only the expected number of servers are returned
params = {'limit': 1}
resp, servers = self.client.list_servers(params)
- # when _interface='xml', one element for servers_links in servers
self.assertEqual(1, len([x for x in servers['servers'] if 'id' in x]))
@utils.skip_unless_attr('multiple_images', 'Only one image found')
diff --git a/tempest/api/compute/v3/servers/test_list_servers_negative.py b/tempest/api/compute/v3/servers/test_list_servers_negative.py
index 10d36bf..23f2bda 100644
--- a/tempest/api/compute/v3/servers/test_list_servers_negative.py
+++ b/tempest/api/compute/v3/servers/test_list_servers_negative.py
@@ -103,7 +103,6 @@
# List servers by specifying limits
resp, body = self.client.list_servers({'limit': 1})
self.assertEqual('200', resp['status'])
- # when _interface='xml', one element for servers_links in servers
self.assertEqual(1, len([x for x in body['servers'] if 'id' in x]))
@attr(type=['negative', 'gate'])
diff --git a/tempest/api/compute/v3/servers/test_servers_negative.py b/tempest/api/compute/v3/servers/test_servers_negative.py
index 2e01cd6..191701e 100644
--- a/tempest/api/compute/v3/servers/test_servers_negative.py
+++ b/tempest/api/compute/v3/servers/test_servers_negative.py
@@ -158,9 +158,6 @@
@test.attr(type=['negative', 'gate'])
def test_create_numeric_server_name(self):
# Create a server with a numeric name
- if self.__class__._interface == "xml":
- raise self.skipException("Not testable in XML")
-
server_name = 12345
self.assertRaises(exceptions.BadRequest,
self.create_test_server,
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index 426273c..7cabb63 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -149,6 +149,7 @@
{'network_id': self.network_cfg.public_network_id})
self._verify_gateway_port(router['id'])
+ @test.requires_ext(extension='ext-gw-mode', service='network')
@test.attr(type='smoke')
def test_update_router_set_gateway_with_snat_explicit(self):
router = self.create_router(data_utils.rand_name('router-'))
@@ -163,6 +164,7 @@
'enable_snat': True})
self._verify_gateway_port(router['id'])
+ @test.requires_ext(extension='ext-gw-mode', service='network')
@test.attr(type='smoke')
def test_update_router_set_gateway_without_snat(self):
router = self.create_router(data_utils.rand_name('router-'))
@@ -190,6 +192,7 @@
device_id=router['id'])
self.assertFalse(list_body['ports'])
+ @test.requires_ext(extension='ext-gw-mode', service='network')
@test.attr(type='smoke')
def test_update_router_reset_gateway_without_snat(self):
router = self.create_router(
diff --git a/tempest/api/object_storage/test_account_services_negative.py b/tempest/api/object_storage/test_account_services_negative.py
index 3b07e17..c8f8096 100644
--- a/tempest/api/object_storage/test_account_services_negative.py
+++ b/tempest/api/object_storage/test_account_services_negative.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Joe H. Rahme <joe.hakim.rahme@enovance.com>
diff --git a/tempest/api/object_storage/test_container_acl_negative.py b/tempest/api/object_storage/test_container_acl_negative.py
index e75f21d..f8f29de 100644
--- a/tempest/api/object_storage/test_container_acl_negative.py
+++ b/tempest/api/object_storage/test_container_acl_negative.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Joe H. Rahme <joe.hakim.rahme@enovance.com>
diff --git a/tempest/api/object_storage/test_container_services.py b/tempest/api/object_storage/test_container_services.py
index 0d477d9..18199ef 100644
--- a/tempest/api/object_storage/test_container_services.py
+++ b/tempest/api/object_storage/test_container_services.py
@@ -43,6 +43,7 @@
# create a container
container_name = data_utils.rand_name(name='TestContainer')
resp, _ = self.container_client.create_container(container_name)
+ self.assertHeaders(resp, 'Container', 'PUT')
self.containers.append(container_name)
# delete container
resp, _ = self.container_client.delete_container(container_name)
@@ -58,12 +59,14 @@
# create a container
container_name = data_utils.rand_name(name='TestContainer')
resp, _ = self.container_client.create_container(container_name)
+ self.assertHeaders(resp, 'Container', 'PUT')
self.containers.append(container_name)
# create object
object_name = data_utils.rand_name(name='TestObject')
data = data_utils.arbitrary_string()
resp, _ = self.object_client.create_object(container_name,
object_name, data)
+ self.assertHeaders(resp, 'Object', 'PUT')
# set object metadata
meta_key = data_utils.rand_name(name='Meta-Test-')
meta_value = data_utils.rand_name(name='MetaValue-')
@@ -71,6 +74,7 @@
resp, _ = self.object_client.update_object_metadata(container_name,
object_name,
orig_metadata)
+ self.assertHeaders(resp, 'Object', 'POST')
# get container contents list
params = {'format': 'json'}
resp, object_list = \
@@ -91,6 +95,7 @@
# create a container
container_name = data_utils.rand_name(name='TestContainer')
resp, _ = self.container_client.create_container(container_name)
+ self.assertHeaders(resp, 'Container', 'PUT')
self.containers.append(container_name)
# update container metadata
metadata = {'name': 'Pictures',
diff --git a/tempest/api/object_storage/test_object_expiry.py b/tempest/api/object_storage/test_object_expiry.py
index 7ca0e51..3aae0a1 100644
--- a/tempest/api/object_storage/test_object_expiry.py
+++ b/tempest/api/object_storage/test_object_expiry.py
@@ -28,30 +28,34 @@
cls.container_name = data_utils.rand_name(name='TestContainer')
cls.container_client.create_container(cls.container_name)
+ def setUp(self):
+ super(ObjectExpiryTest, self).setUp()
+ # create object
+ self.object_name = data_utils.rand_name(name='TestObject')
+ resp, _ = self.object_client.create_object(self.container_name,
+ self.object_name, '')
+
@classmethod
def tearDownClass(cls):
cls.delete_containers([cls.container_name])
super(ObjectExpiryTest, cls).tearDownClass()
def _test_object_expiry(self, metadata):
- # create object
- object_name = data_utils.rand_name(name='TestObject')
- resp, _ = self.object_client.create_object(self.container_name,
- object_name, '')
# update object metadata
resp, _ = \
self.object_client.update_object_metadata(self.container_name,
- object_name, metadata,
+ self.object_name,
+ metadata,
metadata_prefix='')
# verify object metadata
resp, _ = \
self.object_client.list_object_metadata(self.container_name,
- object_name)
+ self.object_name)
self.assertEqual(resp['status'], '200')
self.assertHeaders(resp, 'Object', 'HEAD')
self.assertIn('x-delete-at', resp)
resp, body = self.object_client.get_object(self.container_name,
- object_name)
+ self.object_name)
self.assertEqual(resp['status'], '200')
self.assertHeaders(resp, 'Object', 'GET')
self.assertIn('x-delete-at', resp)
@@ -61,7 +65,7 @@
# object should not be there anymore
self.assertRaises(exceptions.NotFound, self.object_client.get_object,
- self.container_name, object_name)
+ self.container_name, self.object_name)
@attr(type='gate')
def test_get_object_after_expiry_time(self):
diff --git a/tempest/api/object_storage/test_object_formpost_negative.py b/tempest/api/object_storage/test_object_formpost_negative.py
index a07e277..e02a058 100644
--- a/tempest/api/object_storage/test_object_formpost_negative.py
+++ b/tempest/api/object_storage/test_object_formpost_negative.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
# Author: Joe H. Rahme <joe.hakim.rahme@enovance.com>
#
diff --git a/tempest/api/object_storage/test_object_services.py b/tempest/api/object_storage/test_object_services.py
index 13f197b..bca9b93 100644
--- a/tempest/api/object_storage/test_object_services.py
+++ b/tempest/api/object_storage/test_object_services.py
@@ -14,7 +14,6 @@
# under the License.
import hashlib
-import re
from tempest.api.object_storage import base
from tempest.common import custom_matchers
@@ -264,23 +263,15 @@
resp, _ = self.object_client.list_object_metadata(
self.container_name, object_name)
- # Check only the existence of common headers with custom matcher
- self.assertThat(resp, custom_matchers.ExistsAllResponseHeaders(
- 'Object', 'HEAD'))
- self.assertIn('x-object-manifest', resp)
-
# Etag value of a large object is enclosed in double-quotations.
- # This is a special case, therefore the formats of response headers
- # are checked without a custom matcher.
+ # After etag quotes are checked they are removed and the response is
+ # checked if all common headers are present and well formatted
self.assertTrue(resp['etag'].startswith('\"'))
self.assertTrue(resp['etag'].endswith('\"'))
- self.assertTrue(resp['etag'].strip('\"').isalnum())
- self.assertTrue(re.match("^\d+\.?\d*\Z", resp['x-timestamp']))
- self.assertNotEqual(len(resp['content-type']), 0)
- self.assertTrue(re.match("^tx[0-9a-f]*-[0-9a-f]*$",
- resp['x-trans-id']))
- self.assertNotEqual(len(resp['date']), 0)
- self.assertEqual(resp['accept-ranges'], 'bytes')
+ resp['etag'] = resp['etag'].strip('"')
+ self.assertHeaders(resp, 'Object', 'HEAD')
+
+ self.assertIn('x-object-manifest', resp)
self.assertEqual(resp['x-object-manifest'],
'%s/%s/' % (self.container_name, object_name))
diff --git a/tempest/api/object_storage/test_object_slo.py b/tempest/api/object_storage/test_object_slo.py
index ee7f6a4..0443a80 100644
--- a/tempest/api/object_storage/test_object_slo.py
+++ b/tempest/api/object_storage/test_object_slo.py
@@ -14,7 +14,6 @@
import hashlib
import json
-import re
from tempest.api.object_storage import base
from tempest.common import custom_matchers
@@ -95,29 +94,19 @@
return object_name
def _assertHeadersSLO(self, resp, method):
- # Check the existence of common headers with custom matcher
- self.assertThat(resp, custom_matchers.ExistsAllResponseHeaders(
- 'Object', method))
# When sending GET or HEAD requests to SLO the response contains
# 'X-Static-Large-Object' header
if method in ('GET', 'HEAD'):
self.assertIn('x-static-large-object', resp)
+ self.assertEqual(resp['x-static-large-object'], 'True')
- # Check common headers for all HTTP methods
- self.assertTrue(re.match("^tx[0-9a-f]*-[0-9a-f]*$",
- resp['x-trans-id']))
- self.assertTrue(resp['content-length'].isdigit())
- self.assertNotEqual(len(resp['date']), 0)
# Etag value of a large object is enclosed in double-quotations.
+ # After etag quotes are checked they are removed and the response is
+ # checked if all common headers are present and well formatted
self.assertTrue(resp['etag'].startswith('\"'))
self.assertTrue(resp['etag'].endswith('\"'))
- self.assertTrue(resp['etag'].strip('\"').isalnum())
- # Check header formats for a specific method
- if method in ('GET', 'HEAD'):
- self.assertTrue(re.match("^\d+\.?\d*\Z", resp['x-timestamp']))
- self.assertNotEqual(len(resp['content-type']), 0)
- self.assertEqual(resp['accept-ranges'], 'bytes')
- self.assertEqual(resp['x-static-large-object'], 'True')
+ resp['etag'] = resp['etag'].strip('"')
+ self.assertHeaders(resp, 'Object', method)
@test.attr(type='gate')
def test_upload_manifest(self):
diff --git a/tempest/api/object_storage/test_object_temp_url_negative.py b/tempest/api/object_storage/test_object_temp_url_negative.py
index cc507c5..cf24f66 100644
--- a/tempest/api/object_storage/test_object_temp_url_negative.py
+++ b/tempest/api/object_storage/test_object_temp_url_negative.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Joe H. Rahme <joe.hakim.rahme@enovance.com>
diff --git a/tempest/api/volume/admin/test_volume_types.py b/tempest/api/volume/admin/test_volume_types.py
index 0ea999a..4add2c1 100644
--- a/tempest/api/volume/admin/test_volume_types.py
+++ b/tempest/api/volume/admin/test_volume_types.py
@@ -15,27 +15,12 @@
from tempest.api.volume import base
from tempest.common.utils import data_utils
-from tempest.services.volume.json.admin import volume_types_client
from tempest.test import attr
-class VolumeTypesTest(base.BaseVolumeV1Test):
+class VolumeTypesTest(base.BaseVolumeV1AdminTest):
_interface = "json"
- @classmethod
- def setUpClass(cls):
- super(VolumeTypesTest, cls).setUpClass()
- adm_user = cls.config.identity.admin_username
- adm_pass = cls.config.identity.admin_password
- adm_tenant = cls.config.identity.admin_tenant_name
- auth_url = cls.config.identity.uri
-
- cls.client = volume_types_client.VolumeTypesClientJSON(cls.config,
- adm_user,
- adm_pass,
- auth_url,
- adm_tenant)
-
def _delete_volume(self, volume_id):
resp, _ = self.volumes_client.delete_volume(volume_id)
self.assertEqual(202, resp.status)
diff --git a/tempest/cli/simple_read_only/test_cinder.py b/tempest/cli/simple_read_only/test_cinder.py
index cf8440d..5dcb708 100644
--- a/tempest/cli/simple_read_only/test_cinder.py
+++ b/tempest/cli/simple_read_only/test_cinder.py
@@ -18,7 +18,10 @@
import subprocess
import tempest.cli
+from tempest import config
+
+CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -30,6 +33,13 @@
their own. They only verify the structure of output if present.
"""
+ @classmethod
+ def setUpClass(cls):
+ if not CONF.service_available.cinder:
+ msg = ("%s skipped as Cinder is not available" % cls.__name__)
+ raise cls.skipException(msg)
+ super(SimpleReadOnlyCinderClientTest, cls).setUpClass()
+
def test_cinder_fake_action(self):
self.assertRaises(subprocess.CalledProcessError,
self.cinder,
diff --git a/tempest/cli/simple_read_only/test_glance.py b/tempest/cli/simple_read_only/test_glance.py
index 0e0f995..b558190 100644
--- a/tempest/cli/simple_read_only/test_glance.py
+++ b/tempest/cli/simple_read_only/test_glance.py
@@ -35,6 +35,13 @@
their own. They only verify the structure of output if present.
"""
+ @classmethod
+ def setUpClass(cls):
+ if not CONF.service_available.glance:
+ msg = ("%s skipped as Glance is not available" % cls.__name__)
+ raise cls.skipException(msg)
+ super(SimpleReadOnlyGlanceClientTest, cls).setUpClass()
+
def test_glance_fake_action(self):
self.assertRaises(subprocess.CalledProcessError,
self.glance,
diff --git a/tempest/cli/simple_read_only/test_nova.py b/tempest/cli/simple_read_only/test_nova.py
index 822e531..f8ba971 100644
--- a/tempest/cli/simple_read_only/test_nova.py
+++ b/tempest/cli/simple_read_only/test_nova.py
@@ -42,6 +42,13 @@
"""
+ @classmethod
+ def setUpClass(cls):
+ if not CONF.service_available.nova:
+ msg = ("%s skipped as Nova is not available" % cls.__name__)
+ raise cls.skipException(msg)
+ super(SimpleReadOnlyNovaClientTest, cls).setUpClass()
+
def test_admin_fake_action(self):
self.assertRaises(subprocess.CalledProcessError,
self.nova,
diff --git a/tempest/cli/simple_read_only/test_nova_manage.py b/tempest/cli/simple_read_only/test_nova_manage.py
index a92e8da..13a1589 100644
--- a/tempest/cli/simple_read_only/test_nova_manage.py
+++ b/tempest/cli/simple_read_only/test_nova_manage.py
@@ -16,9 +16,11 @@
import subprocess
import tempest.cli
+from tempest import config
from tempest.openstack.common import log as logging
+CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -34,6 +36,13 @@
"""
+ @classmethod
+ def setUpClass(cls):
+ if not CONF.service_available.nova:
+ msg = ("%s skipped as Nova is not available" % cls.__name__)
+ raise cls.skipException(msg)
+ super(SimpleReadOnlyNovaManageTest, cls).setUpClass()
+
def test_admin_fake_action(self):
self.assertRaises(subprocess.CalledProcessError,
self.nova_manage,
diff --git a/tempest/clients.py b/tempest/clients.py
index 4c40ce0..d0a1491 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -17,7 +17,6 @@
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.services.baremetal.v1.client_json import BaremetalClientJSON
-from tempest.services.baremetal.v1.client_xml import BaremetalClientXML
from tempest.services import botoclients
from tempest.services.compute.json.aggregates_client import \
AggregatesClientJSON
@@ -217,7 +216,6 @@
if interface == 'xml':
self.certificates_client = CertificatesClientXML(*client_args)
- self.baremetal_client = BaremetalClientXML(*client_args)
self.servers_client = ServersClientXML(*client_args)
self.limits_client = LimitsClientXML(*client_args)
self.images_client = ImagesClientXML(*client_args)
diff --git a/tempest/common/glance_http.py b/tempest/common/glance_http.py
index 2ce05ee..d8afab3 100644
--- a/tempest/common/glance_http.py
+++ b/tempest/common/glance_http.py
@@ -354,7 +354,7 @@
# file. Closing socket too soon will cause response
# reads to fail with socket IO error 'Bad file descriptor'.
self.sock = None
- super(VerifiedHTTPSConnection, self).close()
+ httplib.HTTPSConnection.close(self)
class ResponseBodyIterator(object):
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index ea614c3..f2df061 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -146,18 +146,28 @@
else:
self.identity_admin_client.tenants.delete(tenant)
- def _create_creds(self, suffix=None, admin=False):
- data_utils.rand_name_root = data_utils.rand_name(self.name)
- if suffix:
- data_utils.rand_name_root += suffix
- tenant_name = data_utils.rand_name_root + "-tenant"
+ def _create_creds(self, suffix="", admin=False):
+ """Create random credentials under the following schema.
+
+ If the name contains a '.' is the full class path of something, and
+ we don't really care. If it isn't, it's probably a meaningful name,
+ so use it.
+
+ For logging purposes, -user and -tenant are long and redundant,
+ don't use them. The user# will be sufficient to figure it out.
+ """
+ if '.' in self.name:
+ root = ""
+ else:
+ root = self.name
+
+ tenant_name = data_utils.rand_name(root) + suffix
tenant_desc = tenant_name + "-desc"
tenant = self._create_tenant(name=tenant_name,
description=tenant_desc)
- if suffix:
- data_utils.rand_name_root += suffix
- username = data_utils.rand_name_root + "-user"
- email = data_utils.rand_name_root + "@example.com"
+
+ username = data_utils.rand_name(root) + suffix
+ email = data_utils.rand_name(root) + suffix + "@example.com"
user = self._create_user(username, self.password,
tenant, email)
if admin:
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index a90c924..b1fef99 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -126,21 +126,6 @@
return self.token
- def basic_auth(self, user, password, auth_url):
- """
- Provides authentication for the target API.
- """
-
- params = {}
- params['headers'] = {'User-Agent': 'Test-Client', 'X-Auth-User': user,
- 'X-Auth-Key': password}
-
- resp, body = self.http_obj.request(auth_url, 'GET', **params)
- try:
- return resp['x-auth-token'], resp['x-server-management-url']
- except Exception:
- raise
-
def keystone_auth(self, user, password, auth_url, service, tenant_name):
"""
Provides authentication via Keystone using v2 identity API.
diff --git a/tempest/common/utils/data_utils.py b/tempest/common/utils/data_utils.py
index 2b2963c..cd32720 100644
--- a/tempest/common/utils/data_utils.py
+++ b/tempest/common/utils/data_utils.py
@@ -30,8 +30,12 @@
return uuid.uuid4().hex
-def rand_name(name='test'):
- return name + "-tempest-" + str(random.randint(1, 0x7fffffff))
+def rand_name(name=''):
+ randbits = str(random.randint(1, 0x7fffffff))
+ if name:
+ return name + '-' + randbits
+ else:
+ return randbits
def rand_int_id(start=0, end=0x7fffffff):
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 5276d49..bb2fcfb 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -14,7 +14,6 @@
import time
from tempest.common.ssh import Client
-from tempest.common import utils
from tempest import config
from tempest.exceptions import ServerUnreachable
@@ -76,11 +75,10 @@
return output
def get_boot_time(self):
- cmd = 'date -d "`cut -f1 -d. /proc/uptime` seconds ago" \
- "+%Y-%m-%d %H:%M:%S"'
- boot_time_string = self.ssh_client.exec_command(cmd)
- boot_time_string = boot_time_string.replace('\n', '')
- return time.strptime(boot_time_string, utils.LAST_REBOOT_TIME_FORMAT)
+ cmd = 'cut -f1 -d. /proc/uptime'
+ boot_secs = self.ssh_client.exec_command(cmd)
+ boot_time = time.time() - int(boot_secs)
+ return time.localtime(boot_time)
def write_to_console(self, message):
message = re.sub("([$\\`])", "\\\\\\\\\\1", message)
diff --git a/tempest/openstack/common/fixture/mockpatch.py b/tempest/openstack/common/fixture/mockpatch.py
index 858e77c..d7dcc11 100644
--- a/tempest/openstack/common/fixture/mockpatch.py
+++ b/tempest/openstack/common/fixture/mockpatch.py
@@ -22,14 +22,15 @@
class PatchObject(fixtures.Fixture):
"""Deal with code around mock."""
- def __init__(self, obj, attr, **kwargs):
+ def __init__(self, obj, attr, new=mock.DEFAULT, **kwargs):
self.obj = obj
self.attr = attr
self.kwargs = kwargs
+ self.new = new
def setUp(self):
super(PatchObject, self).setUp()
- _p = mock.patch.object(self.obj, self.attr, **self.kwargs)
+ _p = mock.patch.object(self.obj, self.attr, self.new, **self.kwargs)
self.mock = _p.start()
self.addCleanup(_p.stop)
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 04882f3..32b9d7e 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -128,15 +128,16 @@
def _get_object_storage_client(self, username, password, tenant_name):
auth_url = self.config.identity.uri
- # add current tenant to Member group.
+ # add current tenant to swift operator role group.
keystone_admin = self._get_identity_client(
self.config.identity.admin_username,
self.config.identity.admin_password,
self.config.identity.admin_tenant_name)
- # enable test user to operate swift by adding Member role to him.
+ # enable test user to operate swift by adding operator role to him.
roles = keystone_admin.roles.list()
- member_role = [role for role in roles if role.name == 'Member'][0]
+ operator_role = self.config.object_storage.operator_role
+ member_role = [role for role in roles if role.name == operator_role][0]
# NOTE(maurosr): This is surrounded in the try-except block cause
# neutron tests doesn't have tenant isolation.
try:
@@ -233,7 +234,7 @@
def setUpClass(cls):
super(OfficialClientTest, cls).setUpClass()
cls.isolated_creds = isolated_creds.IsolatedCreds(
- __name__, tempest_client=False,
+ cls.__name__, tempest_client=False,
network_resources=cls.network_resources)
username, password, tenant_name = cls.credentials()
diff --git a/tempest/services/baremetal/v1/client_xml.py b/tempest/services/baremetal/v1/client_xml.py
deleted file mode 100644
index 4c214fe..0000000
--- a/tempest/services/baremetal/v1/client_xml.py
+++ /dev/null
@@ -1,55 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from tempest.common import rest_client
-from tempest.services.baremetal.v1 import base_v1 as base
-from tempest.services.compute.xml import common as xml
-
-
-class BaremetalClientXML(rest_client.RestClientXML, base.BaremetalClientV1):
- """Tempest REST client for Ironic XML API v1."""
-
- def __init__(self, config, username, password, auth_url, tenant_name=None):
- super(BaremetalClientXML, self).__init__(config, username, password,
- auth_url, tenant_name)
-
- self.serialize = self.json_to_xml
- self.deserialize = xml.xml_to_json
-
- def json_to_xml(self, object_type, object_dict):
- """
- Brainlessly converts a specification of an object to XML string.
-
- :param object_type: Kind of the object.
- :param object_dict: Specification of the object attributes as a dict.
- :return: An XML string that corresponds to the specification.
-
- """
- root = xml.Element(object_type)
-
- for attr_name, value in object_dict:
- # Handle nested dictionaries
- if isinstance(value, dict):
- value = self.json_to_xml(attr_name, value)
-
- root.append(xml.Element(attr_name, value))
-
- return str(xml.Document(root))
-
- def _patch_request(self, resource_name, uuid, patch_object):
- """Changes Content-Type header to application/json for jsonpatch."""
-
- self.headers['Content-Type'] = 'application/json'
- try:
- super(self)._patch_request(self, resource_name, uuid, patch_object)
- finally:
- self.headers['Content-Type'] = 'application/xml'
diff --git a/tempest/services/telemetry/json/telemetry_client.py b/tempest/services/telemetry/json/telemetry_client.py
index 8d46bf3..d8662e9 100644
--- a/tempest/services/telemetry/json/telemetry_client.py
+++ b/tempest/services/telemetry/json/telemetry_client.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
diff --git a/tempest/services/telemetry/telemetry_client_base.py b/tempest/services/telemetry/telemetry_client_base.py
index 59127b9..883bf33 100644
--- a/tempest/services/telemetry/telemetry_client_base.py
+++ b/tempest/services/telemetry/telemetry_client_base.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
diff --git a/tempest/services/telemetry/xml/telemetry_client.py b/tempest/services/telemetry/xml/telemetry_client.py
index 245ccb5..ac5fa32 100644
--- a/tempest/services/telemetry/xml/telemetry_client.py
+++ b/tempest/services/telemetry/xml/telemetry_client.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
diff --git a/tempest/tests/test_ssh.py b/tempest/tests/test_ssh.py
index 09bb588..429ed56 100644
--- a/tempest/tests/test_ssh.py
+++ b/tempest/tests/test_ssh.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may