summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuha Kosonen <juha.kosonen@nokia.com>2019-01-26 12:53:26 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2019-01-27 00:35:51 +0100
commit44abad897356a3d35530e70927fa09e8aaadd540 (patch)
tree932f9ebe5cd03a780c0e524c87c21deb7db0d898
parent1f77be12e779d508498c50d8c42cfe293e16f1bb (diff)
Set Gnocchi scenario as optional in rally tests
The execution of an optional scenario is skipped if the corresponding openstack service does not exist. Change-Id: I8721f26ebc253ce02138b85d6c88e659c5afae80 Signed-off-by: Juha Kosonen <juha.kosonen@nokia.com> (cherry picked from commit 3b7b393ca643bcf7db0361bcc4414b74fff953be)
-rw-r--r--docker/components/testcases.yaml3
-rw-r--r--docker/smoke/testcases.yaml6
-rw-r--r--functest/opnfv_tests/openstack/rally/rally.py16
3 files changed, 19 insertions, 6 deletions
diff --git a/docker/components/testcases.yaml b/docker/components/testcases.yaml
index 73a88aeb7..d0bfa0afe 100644
--- a/docker/components/testcases.yaml
+++ b/docker/components/testcases.yaml
@@ -50,3 +50,6 @@ tiers:
OpenStack Rally suite using several threads and iterations.
run:
name: rally_full
+ args:
+ optional:
+ - 'gnocchi'
diff --git a/docker/smoke/testcases.yaml b/docker/smoke/testcases.yaml
index 381791ac6..feaa383b7 100644
--- a/docker/smoke/testcases.yaml
+++ b/docker/smoke/testcases.yaml
@@ -51,6 +51,9 @@ tiers:
Rally suite in smoke mode.
run:
name: rally_sanity
+ args:
+ optional:
+ - 'gnocchi'
-
case_name: rally_jobs
@@ -62,6 +65,9 @@ tiers:
OpenStack gating
run:
name: rally_jobs
+ args:
+ optional:
+ - 'gnocchi'
-
case_name: refstack_defcore
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py
index 594905b26..52a5223f7 100644
--- a/functest/opnfv_tests/openstack/rally/rally.py
+++ b/functest/opnfv_tests/openstack/rally/rally.py
@@ -25,7 +25,6 @@ import prettytable
from ruamel.yaml import YAML
from six.moves import configparser
from xtesting.core import testcase
-from xtesting.energy import energy
import yaml
from functest.core import singlevm
@@ -93,6 +92,7 @@ class RallyBase(singlevm.VmReady2):
self.tests = []
self.run_cmd = ''
self.network_extensions = []
+ self.services = []
def _build_task_args(self, test_file_name):
"""Build arguments for the Rally task."""
@@ -446,6 +446,9 @@ class RallyBase(singlevm.VmReady2):
self.compute_cnt = len(self.cloud.list_hypervisors())
self.network_extensions = self.cloud.get_network_extensions()
self.flavor_alt = self.create_flavor_alt()
+ self.services = [service.name for service in
+ self.cloud.list_services()]
+
LOGGER.debug("flavor: %s", self.flavor_alt)
def prepare_task(self, test_name):
@@ -459,11 +462,13 @@ class RallyBase(singlevm.VmReady2):
str(self._build_task_args(test_name))])
return True
- def run_tests(self):
+ def run_tests(self, **kwargs):
"""Execute tests."""
+ optional = kwargs.get('optional', [])
for test in self.tests:
- if self.prepare_task(test):
- self.run_task(test)
+ if test in self.services or test not in optional:
+ if self.prepare_task(test):
+ self.run_task(test)
def _generate_report(self):
"""Generate test execution summary report."""
@@ -537,7 +542,6 @@ class RallyBase(singlevm.VmReady2):
return super(RallyBase, self).is_successful()
- @energy.enable_recording
def run(self, **kwargs):
"""Run testcase."""
self.start_time = time.time()
@@ -557,7 +561,7 @@ class RallyBase(singlevm.VmReady2):
pass
conf_utils.create_rally_deployment(environ=environ)
self.prepare_run()
- self.run_tests()
+ self.run_tests(**kwargs)
self._generate_report()
res = testcase.TestCase.EX_OK
except Exception as exc: # pylint: disable=broad-except