aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/ci
diff options
context:
space:
mode:
Diffstat (limited to 'xtesting/ci')
-rw-r--r--xtesting/ci/run_tests.py4
-rw-r--r--xtesting/ci/testcases.yaml16
-rw-r--r--xtesting/ci/tier_builder.py25
-rw-r--r--xtesting/ci/tier_handler.py12
4 files changed, 21 insertions, 36 deletions
diff --git a/xtesting/ci/run_tests.py b/xtesting/ci/run_tests.py
index ff100334..d77041d2 100644
--- a/xtesting/ci/run_tests.py
+++ b/xtesting/ci/run_tests.py
@@ -22,9 +22,9 @@ import os
import re
import sys
import textwrap
-import pkg_resources
import enum
+import pkg_resources
import prettytable
import six
import yaml
@@ -92,8 +92,6 @@ class Runner(object):
self.clean_flag = True
self.report_flag = False
self.tiers = tier_builder.TierBuilder(
- env.get('INSTALLER_TYPE'),
- env.get('DEPLOY_SCENARIO'),
pkg_resources.resource_filename('xtesting', 'ci/testcases.yaml'))
@staticmethod
diff --git a/xtesting/ci/testcases.yaml b/xtesting/ci/testcases.yaml
index 42e71936..d9ff36c6 100644
--- a/xtesting/ci/testcases.yaml
+++ b/xtesting/ci/testcases.yaml
@@ -13,9 +13,6 @@ tiers:
blocking: true
clean_flag: false
description: ''
- dependencies:
- installer: ''
- scenario: ''
run:
module: 'xtesting.samples.first'
class: 'Test'
@@ -27,9 +24,6 @@ tiers:
blocking: true
clean_flag: false
description: ''
- dependencies:
- installer: ''
- scenario: ''
run:
module: 'xtesting.samples.second'
class: 'Test'
@@ -41,9 +35,6 @@ tiers:
blocking: true
clean_flag: false
description: ''
- dependencies:
- installer: ''
- scenario: ''
run:
module: 'xtesting.core.feature'
class: 'BashFeature'
@@ -57,9 +48,6 @@ tiers:
blocking: true
clean_flag: false
description: ''
- dependencies:
- installer: ''
- scenario: ''
run:
module: 'xtesting.core.unit'
class: 'Suite'
@@ -72,10 +60,8 @@ tiers:
enabled: false
criteria: 100
blocking: false
+ clean_flag: false
description: ''
- dependencies:
- installer: ''
- scenario: ''
run:
module: 'xtesting.core.robotframework'
class: 'RobotFramework'
diff --git a/xtesting/ci/tier_builder.py b/xtesting/ci/tier_builder.py
index 2c7b0cab..a4169099 100644
--- a/xtesting/ci/tier_builder.py
+++ b/xtesting/ci/tier_builder.py
@@ -11,15 +11,16 @@
import yaml
-import xtesting.ci.tier_handler as th
+from xtesting.ci import tier_handler
+from xtesting.utils import env
class TierBuilder(object):
# pylint: disable=missing-docstring
- def __init__(self, ci_installer, ci_scenario, testcases_file):
- self.ci_installer = ci_installer
- self.ci_scenario = ci_scenario
+ def __init__(self, testcases_file):
+ self.ci_installer = env.get('INSTALLER_TYPE')
+ self.ci_scenario = env.get('DEPLOY_SCENARIO')
self.testcases_file = testcases_file
self.dic_tier_array = None
self.tier_objects = []
@@ -40,17 +41,23 @@ class TierBuilder(object):
del self.tier_objects[:]
for dic_tier in self.dic_tier_array:
- tier = th.Tier(
+ 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']:
- installer = dic_testcase['dependencies']['installer']
- scenario = dic_testcase['dependencies']['scenario']
- dep = th.Dependency(installer, scenario)
+ 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 = th.TestCase(
+ testcase = tier_handler.TestCase(
name=dic_testcase['case_name'],
enabled=dic_testcase.get('enabled', True),
dependency=dep, criteria=dic_testcase['criteria'],
diff --git a/xtesting/ci/tier_handler.py b/xtesting/ci/tier_handler.py
index 915985f5..0adc9b81 100644
--- a/xtesting/ci/tier_handler.py
+++ b/xtesting/ci/tier_handler.py
@@ -115,15 +115,9 @@ class TestCase(object):
def is_compatible(self, ci_installer, ci_scenario):
try:
- if not ci_installer:
- if self.dependency.get_installer():
- return False
- elif not re.search(self.dependency.get_installer(), ci_installer):
+ if not re.search(self.dependency.get_installer(), ci_installer):
return False
- if not ci_scenario:
- if self.dependency.get_scenario():
- return False
- elif not re.search(self.dependency.get_scenario(), ci_scenario):
+ if not re.search(self.dependency.get_scenario(), ci_scenario):
return False
return True
except TypeError:
@@ -155,7 +149,7 @@ class TestCase(object):
class Dependency(object):
- def __init__(self, installer, scenario):
+ def __init__(self, installer='.*', scenario='.*'):
self.installer = installer
self.scenario = scenario