diff options
Diffstat (limited to 'functest')
-rw-r--r-- | functest/ci/config_functest.yaml | 1 | ||||
-rw-r--r-- | functest/ci/testcases.yaml | 39 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/refstack_client/refstack_client.py | 6 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/conf_utils.py | 2 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/tempest.py | 6 | ||||
-rw-r--r-- | functest/tests/unit/openstack/refstack_client/test_refstack_client.py | 6 | ||||
-rw-r--r-- | functest/tests/unit/openstack/tempest/test_conf_utils.py | 5 | ||||
-rw-r--r-- | functest/tests/unit/utils/test_functest_utils.py | 42 | ||||
-rw-r--r-- | functest/utils/functest_utils.py | 19 |
9 files changed, 29 insertions, 97 deletions
diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml index 31ce4b90..679140fe 100644 --- a/functest/ci/config_functest.yaml +++ b/functest/ci/config_functest.yaml @@ -7,7 +7,6 @@ general: dir_repo_releng: /home/opnfv/repos/releng repo_vims_test: /home/opnfv/repos/vnfs/vims-test repo_onos: /home/opnfv/repos/onos - repo_netready: /home/opnfv/repos/netready repo_barometer: /home/opnfv/repos/barometer repo_doctor: /home/opnfv/repos/doctor repo_odl_test: /src/odl_test diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml index 99c0cc20..86914481 100644 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -149,7 +149,7 @@ tiers: case_name: odl project_name: functest criteria: 100 - blocking: true + blocking: false description: >- Test Suite for the OpenDaylight SDN Controller. It integrates some test suites from upstream using @@ -265,7 +265,7 @@ tiers: module: 'functest.core.feature' class: 'BashFeature' args: - cmd: 'cd /home/opnfv/repos/promise/promise/test/functest && python ./run_tests.py' + cmd: 'run_promise_tests.py' - case_name: doctor-notification @@ -317,23 +317,6 @@ tiers: cmd: '. /home/opnfv/functest/conf/stackrc && security_scan --config /usr/local/etc/securityscanning/config.ini' - - case_name: copper - enabled: false - project_name: copper - criteria: 100 - blocking: false - description: >- - Test suite for policy management based on OpenStack Congress - dependencies: - installer: 'apex' - scenario: '^((?!fdio).)*$' - run: - module: 'functest.core.feature' - class: 'BashFeature' - args: - cmd: 'cd /src/copper/tests && bash run.sh && cd -' - - - case_name: multisite enabled: false project_name: multisite @@ -382,6 +365,7 @@ tiers: - case_name: parser-basics + enabled: false project_name: parser criteria: 100 blocking: false @@ -414,23 +398,6 @@ tiers: cmd: 'cd /src/domino && ./tests/run_multinode.sh' - - case_name: gluon_vping - enabled: false - project_name: netready - criteria: 100 - blocking: false - description: >- - Test suite from Netready project. - dependencies: - installer: 'apex' - scenario: 'gluon' - run: - module: 'functest.core.feature' - class: 'BashFeature' - args: - cmd: 'cd /home/opnfv/repos/netready/test/functest && python ./gluon-test-suite.py' - - - case_name: barometercollectd enabled: false project_name: barometer diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py index 921d69b4..86053ccf 100644 --- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py +++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py @@ -107,13 +107,13 @@ class RefstackClient(testcase.OSGCTestCase): num_failures = match[1] LOGGER.info("".join(match)) success_testcases = [] - for match in re.findall(r"\{0\}(.*?)[. ]*ok", output): + for match in re.findall(r"\{0\} (.*?)[. ]*ok", output): success_testcases.append(match) failed_testcases = [] - for match in re.findall(r"\{0\}(.*?)[. ]*FAILED", output): + for match in re.findall(r"\{0\} (.*?)[. ]*FAILED", output): failed_testcases.append(match) skipped_testcases = [] - for match in re.findall(r"\{0\}(.*?)[. ]*SKIPPED:", output): + for match in re.findall(r"\{0\} (.*?)[. ]*SKIPPED:", output): skipped_testcases.append(match) num_executed = int(num_tests) - int(num_skipped) diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py index 2313ec04..7c88fc5d 100644 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py @@ -336,7 +336,7 @@ def configure_tempest_update_params(tempest_conf_file, 'into tempest.conf file') with open(TEMPEST_CONF_YAML) as f: conf_yaml = yaml.safe_load(f) - if not conf_yaml: + if conf_yaml: sections = config.sections() for section in conf_yaml: if section not in sections: diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index 4993c74a..b00bc6af 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -196,13 +196,13 @@ class TempestCommon(testcase.OSGCTestCase): output = logfile.read() success_testcases = [] - for match in re.findall('(.*?)[. ]*success ', output): + for match in re.findall('.*\{0\} (.*?)[. ]*success ', output): success_testcases.append(match) failed_testcases = [] - for match in re.findall('(.*?)[. ]*fail ', output): + for match in re.findall('.*\{0\} (.*?)[. ]*fail ', output): failed_testcases.append(match) skipped_testcases = [] - for match in re.findall('(.*?)[. ]*skip:', output): + for match in re.findall('.*\{0\} (.*?)[. ]*skip:', output): skipped_testcases.append(match) self.details = {"tests": int(num_tests), diff --git a/functest/tests/unit/openstack/refstack_client/test_refstack_client.py b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py index e4e3364d..c5601075 100644 --- a/functest/tests/unit/openstack/refstack_client/test_refstack_client.py +++ b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py @@ -79,9 +79,9 @@ class OSRefstackClientTesting(unittest.TestCase): ''') self.details = {"tests": 3, "failures": 1, - "success": [' tempest.api.compute [18.464988s]'], - "errors": [' tempest.api.volume [0.230334s]'], - "skipped": [' tempest.api.network [1.265828s]']} + "success": ['tempest.api.compute [18.464988s]'], + "errors": ['tempest.api.volume [0.230334s]'], + "skipped": ['tempest.api.network [1.265828s]']} with mock.patch('__builtin__.open', mock.mock_open(read_data=log_file)): self.refstackclient.parse_refstack_result() diff --git a/functest/tests/unit/openstack/tempest/test_conf_utils.py b/functest/tests/unit/openstack/tempest/test_conf_utils.py index 79ef9915..a807ae46 100644 --- a/functest/tests/unit/openstack/tempest/test_conf_utils.py +++ b/functest/tests/unit/openstack/tempest/test_conf_utils.py @@ -262,10 +262,9 @@ class OSTempestConfUtilsTesting(unittest.TestCase): mock.patch('__builtin__.open', mock.mock_open()), \ mock.patch('functest.opnfv_tests.openstack.tempest.' 'conf_utils.backup_tempest_config'), \ - mock.patch('functest.utils.functest_utils.yaml.safe_load') \ - as mock_yaml: + mock.patch('functest.utils.functest_utils.yaml.safe_load', + return_value={'validation': {'ssh_timeout': 300}}): CONST.__setattr__('OS_ENDPOINT_TYPE', None) - mock_yaml.return_value = mock.Mock() conf_utils.\ configure_tempest_update_params('test_conf_file', IMAGE_ID=image_id, diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py index 98c7d6e9..b4cc5b73 100644 --- a/functest/tests/unit/utils/test_functest_utils.py +++ b/functest/tests/unit/utils/test_functest_utils.py @@ -133,24 +133,20 @@ class FunctestUtilsTesting(unittest.TestCase): self.assertEqual(functest_utils.get_scenario(), self.scenario) - @mock.patch('functest.utils.functest_utils.get_build_tag') - def test_get_version_daily_job(self, mock_get_build_tag): - mock_get_build_tag.return_value = self.build_tag + def test_get_version_daily_job(self): + CONST.__setattr__('BUILD_TAG', self.build_tag) self.assertEqual(functest_utils.get_version(), self.version) - @mock.patch('functest.utils.functest_utils.get_build_tag') - def test_get_version_weekly_job(self, mock_get_build_tag): - mock_get_build_tag.return_value = self.build_tag_week + def test_get_version_weekly_job(self): + CONST.__setattr__('BUILD_TAG', self.build_tag_week) self.assertEqual(functest_utils.get_version(), self.version) - @mock.patch('functest.utils.functest_utils.get_build_tag') - def test_get_version_with_dummy_build_tag(self, mock_get_build_tag): - mock_get_build_tag.return_value = 'whatever' + def test_get_version_with_dummy_build_tag(self): + CONST.__setattr__('BUILD_TAG', 'whatever') self.assertEqual(functest_utils.get_version(), 'unknown') - @mock.patch('functest.utils.functest_utils.get_build_tag') - def test_get_version_unknown(self, mock_get_build_tag): - mock_get_build_tag.return_value = "unknown_build_tag" + def test_get_version_unknown(self): + CONST.__setattr__('BUILD_TAG', 'unknown_build_tag') self.assertEqual(functest_utils.get_version(), "unknown") @mock.patch('functest.utils.functest_utils.logger.info') @@ -173,33 +169,15 @@ class FunctestUtilsTesting(unittest.TestCase): self.node_name) @mock.patch('functest.utils.functest_utils.logger.info') - def test_get_build_tag_failed(self, mock_logger_info): - with mock.patch.dict(os.environ, - {}, - clear=True): - self.assertEqual(functest_utils.get_build_tag(), - "none") - mock_logger_info.assert_called_once_with("Impossible to retrieve" - " the build tag") - - def test_get_build_tag_default(self): - with mock.patch.dict(os.environ, - {'BUILD_TAG': self.build_tag}, - clear=True): - self.assertEqual(functest_utils.get_build_tag(), - self.build_tag) - - @mock.patch('functest.utils.functest_utils.logger.info') def test_logger_test_results(self, mock_logger_info): CONST.__setattr__('results_test_db_url', self.db_url) + CONST.__setattr__('BUILD_TAG', self.build_tag) with mock.patch('functest.utils.functest_utils.get_pod_name', return_value=self.node_name), \ mock.patch('functest.utils.functest_utils.get_scenario', return_value=self.scenario), \ mock.patch('functest.utils.functest_utils.get_version', - return_value=self.version), \ - mock.patch('functest.utils.functest_utils.get_build_tag', - return_value=self.build_tag): + return_value=self.version): functest_utils.logger_test_results(self.project, self.case_name, self.status, self.details) mock_logger_info.assert_called_once_with( diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py index 91781bd2..bf68e43a 100644 --- a/functest/utils/functest_utils.py +++ b/functest/utils/functest_utils.py @@ -107,7 +107,9 @@ def get_version(): # jenkins-functest-fuel-baremetal-weekly-master-8 # use regex to match branch info rule = "(dai|week)ly-(.+?)-[0-9]*" - build_tag = get_build_tag() + build_tag = CONST.__getattribute__('BUILD_TAG') + if not build_tag: + build_tag = 'none' m = re.search(rule, build_tag) if m: return m.group(2) @@ -128,19 +130,6 @@ def get_pod_name(): return "unknown-pod" -def get_build_tag(): - """ - Get build tag of jenkins jobs - """ - try: - build_tag = os.environ['BUILD_TAG'] - except KeyError: - logger.info("Impossible to retrieve the build tag") - build_tag = "none" - - return build_tag - - def logger_test_results(project, case_name, status, details): """ Format test case results for the logger @@ -148,7 +137,7 @@ def logger_test_results(project, case_name, status, details): pod_name = get_pod_name() scenario = get_scenario() version = get_version() - build_tag = get_build_tag() + build_tag = CONST.__getattribute__('BUILD_TAG') db_url = CONST.__getattribute__("results_test_db_url") logger.info( |