Add skip case for not installed clients into functional tests

Add ability to skip not installed clients for functional testing of
task samples.
  * Add _skip function for more readable usage

Change-Id: I9d6ab133d74939f6152ce2785a4733983f7d5bf6
This commit is contained in:
Roman Vasilets 2015-05-25 18:45:36 +03:00
parent b4417f5e67
commit 9ad3afd571

View File

@ -24,6 +24,22 @@ from tests.functional import utils
class TestTaskSamples(unittest.TestCase):
def _skip(self, validation_output):
"""Help to decide do we want to skip this result or not.
:param validation_output: string representation of the
error that we want to check
:return: True if we want to skip this error
of task sample validation, otherwise False.
"""
skip_lst = ["[Ss]ervice is not available",
"is not installed. To install it run"]
for check_str in skip_lst:
if re.search(check_str, validation_output) is not None:
return True
return False
def test_task_samples_is_valid(self):
rally = utils.Rally()
samples_path = os.path.join(
@ -46,8 +62,7 @@ class TestTaskSamples(unittest.TestCase):
try:
rally("task validate --task %s" % full_path)
except utils.RallyCliError as e:
if re.search(
"[Ss]ervice is not available", e.output) is None:
if not self._skip(e.output):
raise e
except Exception:
print(traceback.format_exc())