From 053bc5f800de4c5543452f0cf27e26d6e5d9d96b Mon Sep 17 00:00:00 2001 From: Martin Kulhavy Date: Fri, 7 Jul 2017 17:39:33 +0300 Subject: 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 --- functest/tests/unit/openstack/rally/test_rally.py | 33 ++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'functest/tests/unit/openstack/rally') 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(), -- cgit 1.2.3-korg