[TEST] PNF macro nad CDS resource resoulution tests are failing on retry 00/127300/1
authorMichal Jagiello <michal.jagiello@t-mobile.pl>
Fri, 25 Feb 2022 07:08:27 +0000 (07:08 +0000)
committerMichal Jagiello <michal.jagiello@t-mobile.pl>
Fri, 25 Feb 2022 07:08:27 +0000 (07:08 +0000)
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 <michal.jagiello@t-mobile.pl>
Change-Id: Icf4abb1d82c64d1168e6200e94f9e05b54223d9c

src/onaptests/scenario/cds_resource_resolution.py
src/onaptests/scenario/pnf_macro.py

index 608734b..8c40916 100644 (file)
@@ -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()
 
index 931a332..b3c7d3e 100644 (file)
@@ -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()