aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit
diff options
context:
space:
mode:
authorMartin Kulhavy <martin.kulhavy@nokia.com>2017-07-07 17:39:33 +0300
committerMartin Kulhavy <martin.kulhavy@nokia.com>2017-07-10 12:30:00 +0300
commit053bc5f800de4c5543452f0cf27e26d6e5d9d96b (patch)
tree7619b0653d87a516a8995704fa0f03b2940b4d6d /functest/tests/unit
parent26972ddefa2349dcc1ffe96be25a905046be8110 (diff)
Allow regex for blacklist scenarios/installers
Reasoning: Some blacklisted test cases apply to a range of scenarios, e.g. both 'ha' and 'noha' and possibly even to all scenarios for a specific installer -- therefore the list of excluded scenarios can get long and unclear. For consistency with rally test case scenarios also allow regex for installers specification. Additionally, log the excluded test cases (if any) to debug log. Change-Id: Ie0bec35d1a6443203d4719ea5428c437c12e5e12 Signed-off-by: Martin Kulhavy <martin.kulhavy@nokia.com>
Diffstat (limited to 'functest/tests/unit')
-rw-r--r--functest/tests/unit/openstack/rally/test_rally.py33
1 files changed, 32 insertions, 1 deletions
diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py
index 8845f660..def9c93b 100644
--- a/functest/tests/unit/openstack/rally/test_rally.py
+++ b/functest/tests/unit/openstack/rally/test_rally.py
@@ -130,7 +130,10 @@ class OSRallyTesting(unittest.TestCase):
CONST.__setattr__('DEPLOY_SCENARIO', 'test_scenario')
dic = {'scenario': [{'scenarios': ['test_scenario'],
'installers': ['test_installer'],
- 'tests': ['test']}]}
+ 'tests': ['test']},
+ {'scenarios': ['other_scenario'],
+ 'installers': ['test_installer'],
+ 'tests': ['other_test']}]}
with mock.patch('__builtin__.open', mock.mock_open()), \
mock.patch('functest.opnfv_tests.openstack.rally.rally.'
'yaml.safe_load',
@@ -138,6 +141,34 @@ class OSRallyTesting(unittest.TestCase):
self.assertEqual(self.rally_base.excl_scenario(),
['test'])
+ def test_excl_scenario_regex(self):
+ CONST.__setattr__('INSTALLER_TYPE', 'test_installer')
+ CONST.__setattr__('DEPLOY_SCENARIO', 'os-ctrlT-featT-modeT')
+ dic = {'scenario': [{'scenarios': ['^os-[^-]+-featT-modeT$'],
+ 'installers': ['test_installer'],
+ 'tests': ['test1']},
+ {'scenarios': ['^os-ctrlT-[^-]+-modeT$'],
+ 'installers': ['test_installer'],
+ 'tests': ['test2']},
+ {'scenarios': ['^os-ctrlT-featT-[^-]+$'],
+ 'installers': ['test_installer'],
+ 'tests': ['test3']},
+ {'scenarios': ['^os-'],
+ 'installers': ['test_installer'],
+ 'tests': ['test4']},
+ {'scenarios': ['other_scenario'],
+ 'installers': ['test_installer'],
+ 'tests': ['test0a']},
+ {'scenarios': [''], # empty scenario
+ 'installers': ['test_installer'],
+ 'tests': ['test0b']}]}
+ with mock.patch('__builtin__.open', mock.mock_open()), \
+ mock.patch('functest.opnfv_tests.openstack.rally.rally.'
+ 'yaml.safe_load',
+ return_value=dic):
+ self.assertEqual(self.rally_base.excl_scenario(),
+ ['test1', 'test2', 'test3', 'test4'])
+
def test_excl_scenario_exception(self):
with mock.patch('__builtin__.open', side_effect=Exception):
self.assertEqual(self.rally_base.excl_scenario(),