diff options
author | Romanos Skiadas <rski@intracom-telecom.com> | 2016-12-14 10:13:23 +0200 |
---|---|---|
committer | Romanos Skiadas <rski@intracom-telecom.com> | 2016-12-16 14:42:45 +0200 |
commit | ca3cb806082b7f39ffacde3b7c7776597fa80ec9 (patch) | |
tree | d2765155d53b122b2b290b9919dba0fcb9f9db64 | |
parent | 89ce471643c0cbaf41cac0e6995e754b2169889b (diff) |
Modify tests to require 100% subtest success, fix tempest
This is required to better align with functest, since that will handle overall
success/failure status. Also if a subestest failed, there were expected failures
that could seem like they pass making the overall success % look the same, which
would make the test look fine, even thought it failed.
Some tests check things that are known not to work. Disable these until they are
fixed upstream.
Also remove the success_criteria field from the config. Fail the test if any
subtest fails. This has the added benefit that it fixes the tempest suite, which
was still trying to read the value of `succes_criteria` that had been renamed to
`success_criteria`.
JIRA: SDNVPN-89
Change-Id: Iba5e5cc0db6c371f29a4cbba66ca16c4a1838e12
Signed-off-by: Romanos Skiadas <rski@intracom-telecom.com>
-rw-r--r-- | sdnvpn/lib/results.py | 16 | ||||
-rw-r--r-- | sdnvpn/test/functest/config.yaml | 6 | ||||
-rw-r--r-- | sdnvpn/test/functest/tempest.py | 12 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_1.py | 7 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_2.py | 2 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_4.py | 7 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_7.py | 2 |
7 files changed, 17 insertions, 35 deletions
diff --git a/sdnvpn/lib/results.py b/sdnvpn/lib/results.py index 66e399e..6c2df11 100644 --- a/sdnvpn/lib/results.py +++ b/sdnvpn/lib/results.py @@ -66,7 +66,6 @@ class Results(object): self.add_success(test_case_name) else: logger.debug("[FAIL] %s" % msg) - self.test_result = "FAIL" self.add_failure(test_case_name) logger.debug("\n%s" % last_n_lines) break @@ -78,13 +77,11 @@ class Results(object): self.add_success(test_case_name) else: logger.debug("[FAIL] %s" % msg) - self.test_result = "FAIL" self.add_failure(test_case_name) break time.sleep(1) timeout -= 1 if timeout == 0: - self.test_result = "FAIL" logger.debug("[FAIL] Timeout reached for '%s'. " "No ping output captured in the console log" % vm_source.name) @@ -112,6 +109,7 @@ class Results(object): def add_failure(self, test): self.add_to_summary(2, "FAIL", test) + self.test_result = "FAIL" def add_success(self, test): self.add_to_summary(2, "PASS", test) @@ -150,12 +148,10 @@ class Results(object): elif ("%s not reachable" % ip_target) in last_n_lines: logger.debug("[FAIL] %s" % test_case_name) self.add_failure(test_case_name) - self.test_result = "FAIL" break time.sleep(1) timeout -= 1 if timeout == 0: - self.test_result = "FAIL" logger.debug("[FAIL] Timeout reached for '%s'." " No ping output captured in the console log" % vm_source.name) @@ -172,7 +168,7 @@ class Results(object): else: self.add_success(testcase_name) - def compile_summary(self, SUCCESS_CRITERIA): + def compile_summary(self): success_message = "All the subtests have passed." failure_message = "One or more subtests have failed." @@ -183,10 +179,4 @@ class Results(object): else: logger.info(failure_message) - status = "PASS" - success = 100 - \ - (100 * int(self.num_tests_failed) / int(self.num_tests)) - if success < int(SUCCESS_CRITERIA): - status = "FAILED" - - return {"status": status, "details": self.details} + return {"status": self.test_result, "details": self.details} diff --git a/sdnvpn/test/functest/config.yaml b/sdnvpn/test/functest/config.yaml index ccd5db7..ab05ef9 100644 --- a/sdnvpn/test/functest/config.yaml +++ b/sdnvpn/test/functest/config.yaml @@ -5,14 +5,12 @@ testcases: tempest: enabled: true description: Neutron BGPVPN tests in tempest - success_criteria: 100 # all the subtests must pass testname_db: functest_tempest # declared name in the test api # http://testresults.opnfv.org/test/api/v1/projects/sdnvpn/cases testcase_1: enabled: true description: VPN provides connectivity between subnets - success_criteria: 75 # we let fail 25% of the subtests testname_db: functest_testcase_1 instance_1_name: sdnvpn-1-1 instance_2_name: sdnvpn-1-2 @@ -37,7 +35,6 @@ testcases: testcase_2: enabled: true description: Tenant separation - success_criteria: 100 # all the subtests must pass testname_db: functest_testcase_2 instance_1_name: sdnvpn-2-1 instance_2_name: sdnvpn-2-2 @@ -72,13 +69,11 @@ testcases: testcase_3: enabled: false description: Data center gateway integration - success_criteria: 100 # all the subtests must pass testname_db: functest_testcase_3 testcase_4: enabled: true description: VPN provides connectivity between subnets using router association - success_criteria: 75 # we let fail 25% of the subtests testname_db: functest_testcase_4 instance_1_name: sdnvpn-4-1 instance_2_name: sdnvpn-4-2 @@ -103,7 +98,6 @@ testcases: testcase_7: enabled: false description: Network associate VPNs with routers attached (ODL Bug 6962) - success_criteria: 100 testname_db: functest_testcase_7 image_name: sdnvpn-image instance_1_name: sdnvpn-7-1 diff --git a/sdnvpn/test/functest/tempest.py b/sdnvpn/test/functest/tempest.py index 855ec1b..1acbb42 100644 --- a/sdnvpn/test/functest/tempest.py +++ b/sdnvpn/test/functest/tempest.py @@ -15,15 +15,9 @@ import shutil import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as ft_utils -from sdnvpn.lib import config as sdnvpn_config logger = ft_logger.Logger("sdnvpn-tempest").getLogger() -COMMON_CONFIG = sdnvpn_config.CommonConfig() - -SUCCESS_CRITERIA = ft_utils.get_parameter_from_yaml( - "testcases.testcase_1.succes_criteria", COMMON_CONFIG.config_file) - def main(): src_tempest_dir = ft_utils.get_deployment_dir() @@ -78,9 +72,11 @@ def main(): results = {"duration": duration, "num_tests": num_tests, "failed": failed, "tests": testcases} - status = "PASS" - if 100 - (100 * int(failed) / int(num_tests)) < int(SUCCESS_CRITERIA): + if int(failed) == 0: + status = "PASS" + else: status = "FAILED" + return {"status": status, "details": results} except: logger.error("Problem when parsing the results.") diff --git a/sdnvpn/test/functest/testcase_1.py b/sdnvpn/test/functest/testcase_1.py index e1a7577..a2817db 100644 --- a/sdnvpn/test/functest/testcase_1.py +++ b/sdnvpn/test/functest/testcase_1.py @@ -183,8 +183,9 @@ def main(): test_utils.wait_before_subtest() results.get_ping_status(vm_4, vm_5, expected="PASS", timeout=30) - results.get_ping_status(vm_1, vm_4, expected="FAIL", timeout=30) - results.get_ping_status(vm_1, vm_5, expected="FAIL", timeout=30) + # TODO enable again when isolation in VPN with iRT != eRT works + # results.get_ping_status(vm_1, vm_4, expected="FAIL", timeout=30) + # results.get_ping_status(vm_1, vm_5, expected="FAIL", timeout=30) msg = ("Update VPN with eRT=iRT ...") results.add_to_summary(0, "-") @@ -202,7 +203,7 @@ def main(): results.get_ping_status(vm_1, vm_4, expected="PASS", timeout=30) results.get_ping_status(vm_1, vm_5, expected="PASS", timeout=30) - return results.compile_summary(TESTCASE_CONFIG.success_criteria) + return results.compile_summary() if __name__ == '__main__': diff --git a/sdnvpn/test/functest/testcase_2.py b/sdnvpn/test/functest/testcase_2.py index 0b4e5b4..2df518c 100644 --- a/sdnvpn/test/functest/testcase_2.py +++ b/sdnvpn/test/functest/testcase_2.py @@ -243,7 +243,7 @@ def main(): expected="not reachable", timeout=30) - return results.compile_summary(TESTCASE_CONFIG.success_criteria) + return results.compile_summary() if __name__ == '__main__': diff --git a/sdnvpn/test/functest/testcase_4.py b/sdnvpn/test/functest/testcase_4.py index 65ee2ee..df3c48d 100644 --- a/sdnvpn/test/functest/testcase_4.py +++ b/sdnvpn/test/functest/testcase_4.py @@ -181,8 +181,9 @@ def main(): test_utils.wait_before_subtest() results.get_ping_status(vm_4, vm_5, expected="PASS", timeout=30) - results.get_ping_status(vm_1, vm_4, expected="FAIL", timeout=30) - results.get_ping_status(vm_1, vm_5, expected="FAIL", timeout=30) + # TODO enable again when isolation in VPN with iRT != eRT works + # results.get_ping_status(vm_1, vm_4, expected="FAIL", timeout=30) + # results.get_ping_status(vm_1, vm_5, expected="FAIL", timeout=30) msg = ("Update VPN with eRT=iRT ...") results.add_to_summary(0, "-") @@ -203,7 +204,7 @@ def main(): results.add_to_summary(0, "=") logger.info("\n%s" % results.summary) - return results.compile_summary(TESTCASE_CONFIG.success_criteria) + return results.compile_summary() if __name__ == '__main__': diff --git a/sdnvpn/test/functest/testcase_7.py b/sdnvpn/test/functest/testcase_7.py index fa50888..d7d840f 100644 --- a/sdnvpn/test/functest/testcase_7.py +++ b/sdnvpn/test/functest/testcase_7.py @@ -147,7 +147,7 @@ def main(): results.add_to_summary(0, "-") results.ping_ip_test(fip['fip_addr']) - return results.compile_summary(TESTCASE_CONFIG.success_criteria) + return results.compile_summary() if __name__ == '__main__': |