From f0a5bdf622433361b5a86da4aa216d542d2a8aa4 Mon Sep 17 00:00:00 2001 From: Michal Jagiello Date: Fri, 25 Feb 2022 07:08:27 +0000 Subject: [TEST] PNF macro nad CDS resource resoulution tests are failing on retry If any of these two tests fail on the first try retry will always fail as well. It's because of that test's cleanup phase was executed only if an execution phase passed (all substeps). Because of that simulators was never deleted and second instantiation try fails every time. That change split test into two phases: execution and cleanup - if execution fails cleanup will be executed despite of that. Issue-ID: TEST-354 Signed-off-by: Michal Jagiello Change-Id: Icf4abb1d82c64d1168e6200e94f9e05b54223d9c --- src/onaptests/scenario/cds_resource_resolution.py | 17 ++++++++--------- src/onaptests/scenario/pnf_macro.py | 17 ++++++++--------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/onaptests/scenario/cds_resource_resolution.py b/src/onaptests/scenario/cds_resource_resolution.py index 608734b..8c40916 100644 --- a/src/onaptests/scenario/cds_resource_resolution.py +++ b/src/onaptests/scenario/cds_resource_resolution.py @@ -79,15 +79,14 @@ class CDSResourceResolution(testcase.TestCase): self.__logger.debug("CDS resource resolution run") self.start_time = time.time() try: - self.test.execute() - self.test.cleanup() - self.result = 100 - except OnapTestException as exc: - self.result = 0 - self.__logger.error(exc.error_message) - except SDKException: - self.result = 0 - self.__logger.error("SDK Exception") + for test_phase in (self.test.execute, self.test.cleanup): + try: + test_phase() + self.result += 50 + except OnapTestException as exc: + self.__logger.error(exc.error_message) + except SDKException: + self.__logger.error("SDK Exception") finally: self.stop_time = time.time() diff --git a/src/onaptests/scenario/pnf_macro.py b/src/onaptests/scenario/pnf_macro.py index 931a332..b3c7d3e 100644 --- a/src/onaptests/scenario/pnf_macro.py +++ b/src/onaptests/scenario/pnf_macro.py @@ -119,15 +119,14 @@ class PnfMacro(testcase.TestCase): """Run PNF macro test.""" self.start_time = time.time() try: - self.test.execute() - self.test.cleanup() - self.result = 100 - except OnapTestException as exc: - self.result = 0 - self.__logger.error(exc.error_message) - except SDKException: - self.result = 0 - self.__logger.error("SDK Exception") + for test_phase in (self.test.execute, self.test.cleanup): + try: + test_phase() + self.result += 50 + except OnapTestException as exc: + self.__logger.error(exc.error_message) + except SDKException: + self.__logger.error("SDK Exception") finally: self.stop_time = time.time() -- cgit 1.2.3-korg