aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/scenario
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2022-02-25 07:08:27 +0000
committerMichal Jagiello <michal.jagiello@t-mobile.pl>2022-02-25 07:08:27 +0000
commitf0a5bdf622433361b5a86da4aa216d542d2a8aa4 (patch)
tree43bcbc3e997e009e8d25bab6643633703d0008a1 /src/onaptests/scenario
parentd7b0b373ab7f1e842026e761f0828c01db4183eb (diff)
[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 <michal.jagiello@t-mobile.pl> Change-Id: Icf4abb1d82c64d1168e6200e94f9e05b54223d9c
Diffstat (limited to 'src/onaptests/scenario')
-rw-r--r--src/onaptests/scenario/cds_resource_resolution.py17
-rw-r--r--src/onaptests/scenario/pnf_macro.py17
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()