Merge "Input scenario capability for tempest"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 049da00..7ce0c0b 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -563,11 +563,11 @@
# (string value)
#region=
-# Number of seconds to time on waiting for a containerto
+# Number of seconds to time on waiting for a container to
# container synchronization complete. (integer value)
#container_sync_timeout=120
-# Number of seconds to wait while looping to check thestatus
+# Number of seconds to wait while looping to check the status
# of a container to container synchronization (integer value)
#container_sync_interval=5
diff --git a/run_tests.sh b/run_tests.sh
index 9dc8d7b..285b372 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -11,6 +11,7 @@
echo " -u, --update Update the virtual environment with any newer package versions"
echo " -t, --serial Run testr serially"
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 " -- [TESTROPTIONS] After the first '--' you can pass arbitrary arguments to testr "
@@ -25,11 +26,12 @@
never_venv=0
no_site_packages=0
force=0
+coverage=0
wrapper=""
config_file=""
update=0
-if ! options=$(getopt -o VNnfutphd -l virtual-env,no-virtual-env,no-site-packages,force,update,serial,pep8,help,debug -- "$@")
+if ! options=$(getopt -o VNnfuctphd -l virtual-env,no-virtual-env,no-site-packages,force,update,serial,coverage,pep8,help,debug -- "$@")
then
# parse error
usage
@@ -48,6 +50,7 @@
-u|--update) update=1;;
-d|--debug) set -o xtrace;;
-p|--pep8) let just_pep8=1;;
+ -c|--coverage) coverage=1;;
-t|--serial) serial=1;;
--) [ "yes" == "$first_uu" ] || testrargs="$testrargs $1"; first_uu=no ;;
*) testrargs="$testrargs $1"; noseargs+=" $1" ;;
@@ -123,6 +126,10 @@
exit
fi
+if [$coverage -eq 1] ; then
+ $testrargs = "--coverage $testrargs"
+fi
+
run_tests
retval=$?
diff --git a/tempest/api/compute/v3/admin/test_simple_tenant_usage.py b/tempest/api/compute/v3/admin/test_simple_tenant_usage.py
index 99f2c52..e08f16a 100644
--- a/tempest/api/compute/v3/admin/test_simple_tenant_usage.py
+++ b/tempest/api/compute/v3/admin/test_simple_tenant_usage.py
@@ -18,6 +18,7 @@
import datetime
from tempest.api.compute import base
+from tempest import test
from tempest.test import attr
import time
@@ -50,6 +51,7 @@
# Returns formatted datetime
return at.strftime('%Y-%m-%dT%H:%M:%S.%f')
+ @test.skip_because(bug='1265416')
@attr(type='gate')
def test_list_usage_all_tenants(self):
# Get usage for all tenants
@@ -60,6 +62,7 @@
self.assertEqual(200, resp.status)
self.assertEqual(len(tenant_usage), 8)
+ @test.skip_because(bug='1265416')
@attr(type='gate')
def test_get_usage_tenant(self):
# Get usage for a specific tenant
@@ -71,6 +74,7 @@
self.assertEqual(200, resp.status)
self.assertEqual(len(tenant_usage), 8)
+ @test.skip_because(bug='1265416')
@attr(type='gate')
def test_get_usage_tenant_with_non_admin_user(self):
# Get usage for a specific tenant with non admin user
diff --git a/tempest/api/compute/v3/admin/test_simple_tenant_usage_negative.py b/tempest/api/compute/v3/admin/test_simple_tenant_usage_negative.py
index ef49ed7..f9dbe86 100644
--- a/tempest/api/compute/v3/admin/test_simple_tenant_usage_negative.py
+++ b/tempest/api/compute/v3/admin/test_simple_tenant_usage_negative.py
@@ -19,6 +19,7 @@
from tempest.api.compute import base
from tempest import exceptions
+from tempest import test
from tempest.test import attr
@@ -50,6 +51,7 @@
self.adm_client.get_tenant_usage,
'', params)
+ @test.skip_because(bug='1265416')
@attr(type=['negative', 'gate'])
def test_get_usage_tenant_with_invalid_date(self):
# Get usage for tenant with invalid date
@@ -62,6 +64,7 @@
self.adm_client.get_tenant_usage,
tenant_id, params)
+ @test.skip_because(bug='1265416')
@attr(type=['negative', 'gate'])
def test_list_usage_all_tenants_with_non_admin_user(self):
# Get usage for all tenants with non admin user
diff --git a/tempest/api/object_storage/test_container_sync.py b/tempest/api/object_storage/test_container_sync.py
index dcfe219..ec78774 100644
--- a/tempest/api/object_storage/test_container_sync.py
+++ b/tempest/api/object_storage/test_container_sync.py
@@ -16,25 +16,38 @@
# under the License.
import time
+import urlparse
from tempest.api.object_storage import base
from tempest.common.utils import data_utils
from tempest.test import attr
-from tempest.test import skip_because
+from tempest.test import HTTP_SUCCESS
+
+# This test can be quite long to run due to its
+# dependency on container-sync process running interval.
+# You can obviously reduce the container-sync interval in the
+# container-server configuration.
class ContainerSyncTest(base.BaseObjectTest):
+
@classmethod
def setUpClass(cls):
super(ContainerSyncTest, cls).setUpClass()
cls.containers = []
cls.objects = []
+
+ # Default container-server config only allows localhost
+ cls.local_ip = '127.0.0.1'
+
+ # Must be configure according to container-sync interval
container_sync_timeout = \
int(cls.config.object_storage.container_sync_timeout)
cls.container_sync_interval = \
int(cls.config.object_storage.container_sync_interval)
cls.attempts = \
int(container_sync_timeout / cls.container_sync_interval)
+
# define container and object clients
cls.clients = {}
cls.clients[data_utils.rand_name(name='TestContainerSync')] = \
@@ -51,8 +64,7 @@
cls.delete_containers(cls.containers, client[0], client[1])
super(ContainerSyncTest, cls).tearDownClass()
- @skip_because(bug="1093743")
- @attr(type='gate')
+ @attr(type='slow')
def test_container_synchronization(self):
# container to container synchronization
# to allow/accept sync requests to/from other accounts
@@ -62,51 +74,53 @@
cont_client = [self.clients[c][0] for c in cont]
obj_client = [self.clients[c][1] for c in cont]
# tell first container to synchronize to a second
+ client_proxy_ip = \
+ urlparse.urlparse(cont_client[1].base_url).netloc.split(':')[0]
+ client_base_url = \
+ cont_client[1].base_url.replace(client_proxy_ip,
+ self.local_ip)
headers = {'X-Container-Sync-Key': 'sync_key',
'X-Container-Sync-To': "%s/%s" %
- (cont_client[1].base_url, str(cont[1]))}
+ (client_base_url, str(cont[1]))}
resp, body = \
cont_client[0].put(str(cont[0]), body=None, headers=headers)
- self.assertIn(resp['status'], ('202', '201'),
- 'Error installing X-Container-Sync-To '
- 'for the container "%s"' % (cont[0]))
+ self.assertIn(int(resp['status']), HTTP_SUCCESS)
# create object in container
object_name = data_utils.rand_name(name='TestSyncObject')
data = object_name[::-1] # data_utils.arbitrary_string()
resp, _ = obj_client[0].create_object(cont[0], object_name, data)
- self.assertEqual(resp['status'], '201',
- 'Error creating the object "%s" in'
- 'the container "%s"'
- % (object_name, cont[0]))
+ self.assertIn(int(resp['status']), HTTP_SUCCESS)
self.objects.append(object_name)
# wait until container contents list is not empty
cont_client = [self.clients[c][0] for c in self.containers]
params = {'format': 'json'}
while self.attempts > 0:
- # get first container content
- resp, object_list_0 = \
- cont_client[0].\
- list_container_contents(self.containers[0], params=params)
- self.assertEqual(resp['status'], '200',
- 'Error listing the destination container`s'
- ' "%s" contents' % (self.containers[0]))
- object_list_0 = dict((obj['name'], obj) for obj in object_list_0)
- # get second container content
- resp, object_list_1 = \
- cont_client[1].\
- list_container_contents(self.containers[1], params=params)
- self.assertEqual(resp['status'], '200',
- 'Error listing the destination container`s'
- ' "%s" contents' % (self.containers[1]))
- object_list_1 = dict((obj['name'], obj) for obj in object_list_1)
+ object_lists = []
+ for client_index in (0, 1):
+ resp, object_list = \
+ cont_client[client_index].\
+ list_container_contents(self.containers[client_index],
+ params=params)
+ self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ object_lists.append(dict(
+ (obj['name'], obj) for obj in object_list))
# check that containers are not empty and have equal keys()
# or wait for next attempt
- if not object_list_0 or not object_list_1 or \
- set(object_list_0.keys()) != set(object_list_1.keys()):
+ if not object_lists[0] or not object_lists[1] or \
+ set(object_lists[0].keys()) != set(object_lists[1].keys()):
time.sleep(self.container_sync_interval)
self.attempts -= 1
else:
break
- self.assertEqual(object_list_0, object_list_1,
+
+ self.assertEqual(object_lists[0], object_lists[1],
'Different object lists in containers.')
+
+ # Verify object content
+ obj_clients = [(self.clients[c][1], c) for c in self.containers]
+ for obj_client, cont in obj_clients:
+ for obj_name in object_lists[0]:
+ resp, object_content = obj_client.get_object(cont, obj_name)
+ self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertEqual(object_content, obj_name[::-1])
diff --git a/tempest/cli/simple_read_only/test_ceilometer.py b/tempest/cli/simple_read_only/test_ceilometer.py
index b762b47..f14b35b 100644
--- a/tempest/cli/simple_read_only/test_ceilometer.py
+++ b/tempest/cli/simple_read_only/test_ceilometer.py
@@ -35,7 +35,7 @@
@classmethod
def setUpClass(cls):
if (not CONF.service_available.ceilometer):
- msg = ("Skiping all Ceilometer cli tests because it is"
+ msg = ("Skipping all Ceilometer cli tests because it is "
"not available")
raise cls.skipException(msg)
super(SimpleReadOnlyCeilometerClientTest, cls).setUpClass()
diff --git a/tempest/cli/simple_read_only/test_neutron.py b/tempest/cli/simple_read_only/test_neutron.py
index 34c6fd9..7aa57c0 100644
--- a/tempest/cli/simple_read_only/test_neutron.py
+++ b/tempest/cli/simple_read_only/test_neutron.py
@@ -39,7 +39,7 @@
@classmethod
def setUpClass(cls):
if (not CONF.service_available.neutron):
- msg = "Skiping all Neutron cli tests because it is not available"
+ msg = "Skipping all Neutron cli tests because it is not available"
raise cls.skipException(msg)
super(SimpleReadOnlyNeutronClientTest, cls).setUpClass()
diff --git a/tempest/config.py b/tempest/config.py
index aed99ef..0ea39ab 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -398,11 +398,11 @@
"one is used."),
cfg.IntOpt('container_sync_timeout',
default=120,
- help="Number of seconds to time on waiting for a container"
+ help="Number of seconds to time on waiting for a container "
"to container synchronization complete."),
cfg.IntOpt('container_sync_interval',
default=5,
- help="Number of seconds to wait while looping to check the"
+ help="Number of seconds to wait while looping to check the "
"status of a container to container synchronization"),
cfg.StrOpt('operator_role',
default='Member',