aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/ci
diff options
context:
space:
mode:
Diffstat (limited to 'xtesting/ci')
-rw-r--r--xtesting/ci/run_tests.py7
-rw-r--r--xtesting/ci/testcases.yaml1
-rw-r--r--xtesting/ci/tier_builder.py35
-rw-r--r--xtesting/ci/tier_handler.py47
4 files changed, 25 insertions, 65 deletions
diff --git a/xtesting/ci/run_tests.py b/xtesting/ci/run_tests.py
index d77041d2..31451090 100644
--- a/xtesting/ci/run_tests.py
+++ b/xtesting/ci/run_tests.py
@@ -202,15 +202,12 @@ class Runner(object):
tiers_to_run = []
msg = prettytable.PrettyTable(
header_style='upper', padding_width=5,
- field_names=['tiers', 'order', 'CI Loop', 'description',
+ field_names=['tiers', 'order', 'description',
'testcases'])
for tier in self.tiers.get_tiers():
- ci_loop = env.get('CI_LOOP')
- if (tier.get_tests() and
- re.search(ci_loop, tier.get_ci_loop()) is not None):
+ if tier.get_tests():
tiers_to_run.append(tier)
msg.add_row([tier.get_name(), tier.get_order(),
- tier.get_ci_loop(),
textwrap.fill(tier.description, width=40),
textwrap.fill(' '.join([str(x.get_name(
)) for x in tier.get_tests()]), width=40)])
diff --git a/xtesting/ci/testcases.yaml b/xtesting/ci/testcases.yaml
index d9ff36c6..6ab5927f 100644
--- a/xtesting/ci/testcases.yaml
+++ b/xtesting/ci/testcases.yaml
@@ -3,7 +3,6 @@ tiers:
-
name: samples
order: 1
- ci_loop: 'daily'
description: ''
testcases:
-
diff --git a/xtesting/ci/tier_builder.py b/xtesting/ci/tier_builder.py
index a4169099..42909810 100644
--- a/xtesting/ci/tier_builder.py
+++ b/xtesting/ci/tier_builder.py
@@ -9,6 +9,7 @@
"""TierBuilder class to parse testcases config file"""
+import re
import yaml
from xtesting.ci import tier_handler
@@ -43,34 +44,32 @@ class TierBuilder(object):
for dic_tier in self.dic_tier_array:
tier = tier_handler.Tier(
name=dic_tier['name'], order=dic_tier['order'],
- ci_loop=dic_tier['ci_loop'],
description=dic_tier['description'])
for dic_testcase in dic_tier['testcases']:
- if not dic_testcase.get('dependencies'):
- installer = '.*'
- scenario = '.*'
- else:
- installer = dic_testcase['dependencies'].get(
- 'installer', '.*')
- scenario = dic_testcase['dependencies'].get(
- 'scenario', '.*')
- dep = tier_handler.Dependency(installer, scenario)
-
testcase = tier_handler.TestCase(
name=dic_testcase['case_name'],
enabled=dic_testcase.get('enabled', True),
- dependency=dep, criteria=dic_testcase['criteria'],
+ criteria=dic_testcase['criteria'],
blocking=dic_testcase['blocking'],
description=dic_testcase['description'],
project=dic_testcase['project_name'])
- if (testcase.is_compatible(self.ci_installer,
- self.ci_scenario) and
- testcase.is_enabled()):
- tier.add_test(testcase)
+ if not dic_testcase.get('dependencies'):
+ if testcase.is_enabled():
+ tier.add_test(testcase)
+ else:
+ tier.skip_test(testcase)
else:
- tier.skip_test(testcase)
-
+ for dependency in dic_testcase['dependencies']:
+ kenv = dependency.keys()[0]
+ if not re.search(dependency[kenv], env.get(kenv)):
+ tier.skip_test(testcase)
+ break
+ else:
+ if testcase.is_enabled():
+ tier.add_test(testcase)
+ else:
+ tier.skip_test(testcase)
self.tier_objects.append(tier)
def get_tiers(self):
diff --git a/xtesting/ci/tier_handler.py b/xtesting/ci/tier_handler.py
index 0adc9b81..7a77e4cf 100644
--- a/xtesting/ci/tier_handler.py
+++ b/xtesting/ci/tier_handler.py
@@ -10,7 +10,6 @@
"""Tier and TestCase classes to wrap the testcases config file"""
# pylint: disable=missing-docstring
-import re
import textwrap
import prettytable
@@ -36,12 +35,11 @@ def split_text(text, max_len):
class Tier(object):
- def __init__(self, name, order, ci_loop, description=""):
+ def __init__(self, name, order, description=""):
self.tests_array = []
self.skipped_tests_array = []
self.name = name
self.order = order
- self.ci_loop = ci_loop
self.description = description
def add_test(self, testcase):
@@ -84,16 +82,13 @@ class Tier(object):
def get_order(self):
return self.order
- def get_ci_loop(self):
- return self.ci_loop
-
def __str__(self):
msg = prettytable.PrettyTable(
header_style='upper', padding_width=5,
- field_names=['tiers', 'order', 'CI Loop', 'description',
+ field_names=['tiers', 'order', 'description',
'testcases'])
msg.add_row(
- [self.name, self.order, self.ci_loop,
+ [self.name, self.order,
textwrap.fill(self.description, width=40),
textwrap.fill(' '.join([str(x.get_name(
)) for x in self.get_tests()]), width=40)])
@@ -102,27 +97,16 @@ class Tier(object):
class TestCase(object):
- def __init__(self, name, enabled, dependency, criteria, blocking,
+ def __init__(self, name, enabled, criteria, blocking,
description="", project=""):
# pylint: disable=too-many-arguments
self.name = name
self.enabled = enabled
- self.dependency = dependency
self.criteria = criteria
self.blocking = blocking
self.description = description
self.project = project
- def is_compatible(self, ci_installer, ci_scenario):
- try:
- if not re.search(self.dependency.get_installer(), ci_installer):
- return False
- if not re.search(self.dependency.get_scenario(), ci_scenario):
- return False
- return True
- except TypeError:
- return False
-
def get_name(self):
return self.name
@@ -141,26 +125,7 @@ class TestCase(object):
def __str__(self):
msg = prettytable.PrettyTable(
header_style='upper', padding_width=5,
- field_names=['test case', 'description', 'criteria', 'dependency'])
+ field_names=['test case', 'description', 'criteria'])
msg.add_row([self.name, textwrap.fill(self.description, width=40),
- self.criteria, self.dependency])
+ self.criteria])
return msg.get_string()
-
-
-class Dependency(object):
-
- def __init__(self, installer='.*', scenario='.*'):
- self.installer = installer
- self.scenario = scenario
-
- def get_installer(self):
- return self.installer
-
- def get_scenario(self):
- return self.scenario
-
- def __str__(self):
- delimitator = "\n" if self.get_installer(
- ) and self.get_scenario() else ""
- return "{}{}{}".format(self.get_installer(), delimitator,
- self.get_scenario())