diff options
author | Michal Jagiello <michal.jagiello@t-mobile.pl> | 2022-04-07 07:26:58 +0000 |
---|---|---|
committer | Michal Jagiello <michal.jagiello@t-mobile.pl> | 2022-04-12 09:37:39 +0000 |
commit | 81584955687e053d0697a63131b026fa0eda47c7 (patch) | |
tree | fac92faedda8016eeef7b5112e0a193a73dad51d /src/onaptests | |
parent | 4d1467f9290af4d64d329bc103893eaadd00e02c (diff) |
Log exception stack trace on test failure
If test fails and exception is raised most of the test scenarios don't print a stack trace so debugging consume more time.
Additionally double check on the SDC service distribution status due to an error on Python ONAP SDK
Issue-ID: SDC-3949
Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Change-Id: Ifc51dbe287a45d5fbbee788f205d1dbe936516e4
Diffstat (limited to 'src/onaptests')
-rw-r--r-- | src/onaptests/scenario/basic_clamp.py | 4 | ||||
-rw-r--r-- | src/onaptests/scenario/basic_cnf.py | 4 | ||||
-rw-r--r-- | src/onaptests/scenario/basic_cnf_macro.py | 4 | ||||
-rw-r--r-- | src/onaptests/scenario/basic_network.py | 4 | ||||
-rw-r--r-- | src/onaptests/scenario/basic_onboard.py | 4 | ||||
-rw-r--r-- | src/onaptests/scenario/basic_vm.py | 4 | ||||
-rw-r--r-- | src/onaptests/scenario/basic_vm_macro.py | 4 | ||||
-rw-r--r-- | src/onaptests/scenario/basic_vm_macro_stability.py | 4 | ||||
-rw-r--r-- | src/onaptests/scenario/cds_resource_resolution.py | 4 | ||||
-rw-r--r-- | src/onaptests/scenario/pnf_macro.py | 4 | ||||
-rw-r--r-- | src/onaptests/steps/onboard/service.py | 7 |
11 files changed, 25 insertions, 22 deletions
diff --git a/src/onaptests/scenario/basic_clamp.py b/src/onaptests/scenario/basic_clamp.py index 3669ab1..fcaa265 100644 --- a/src/onaptests/scenario/basic_clamp.py +++ b/src/onaptests/scenario/basic_clamp.py @@ -38,10 +38,10 @@ class BasicClamp(testcase.TestCase): self.result = 100 except OnapTestException as exc: self.result = 0 - self.__logger.error(exc.error_message) + self.__logger.exception(exc.error_message) except (SDKException, APIError): self.result = 0 - self.__logger.error("SDK exception") + self.__logger.exception("SDK exception") finally: self.stop_time = time.time() def clean(self): diff --git a/src/onaptests/scenario/basic_cnf.py b/src/onaptests/scenario/basic_cnf.py index 77884bc..fb9a879 100644 --- a/src/onaptests/scenario/basic_cnf.py +++ b/src/onaptests/scenario/basic_cnf.py @@ -45,10 +45,10 @@ class BasicCnf(testcase.TestCase): self.result = 100 except OnapTestException as exc: self.result = 0 - self.__logger.error(exc.error_message) + self.__logger.exception(exc.error_message) except SDKException: self.result = 0 - self.__logger.error("SDK exception") + self.__logger.exception("SDK exception") finally: self.stop_time = time.time() diff --git a/src/onaptests/scenario/basic_cnf_macro.py b/src/onaptests/scenario/basic_cnf_macro.py index 2784782..ddc8802 100644 --- a/src/onaptests/scenario/basic_cnf_macro.py +++ b/src/onaptests/scenario/basic_cnf_macro.py @@ -120,10 +120,10 @@ class BasicCnfMacro(testcase.TestCase): self.result = 100 except OnapTestException as exc: self.result = 0 - self.__logger.error(exc.error_message) + self.__logger.exception(exc.error_message) except SDKException: self.result = 0 - self.__logger.error("SDK Exception") + self.__logger.exception("SDK Exception") finally: self.stop_time = time.time() diff --git a/src/onaptests/scenario/basic_network.py b/src/onaptests/scenario/basic_network.py index 6238ee1..a40dc06 100644 --- a/src/onaptests/scenario/basic_network.py +++ b/src/onaptests/scenario/basic_network.py @@ -49,10 +49,10 @@ class BasicNetwork(testcase.TestCase): self.result = 100 except OnapTestException as exc: self.result = 0 - self.__logger.error(exc.error_message) + self.__logger.exception(exc.error_message) except SDKException: self.result = 0 - self.__logger.error("SDK Exception") + self.__logger.exception("SDK Exception") finally: self.stop_time = time.time() diff --git a/src/onaptests/scenario/basic_onboard.py b/src/onaptests/scenario/basic_onboard.py index af689bd..ac4c933 100644 --- a/src/onaptests/scenario/basic_onboard.py +++ b/src/onaptests/scenario/basic_onboard.py @@ -36,10 +36,10 @@ class BasicOnboard(testcase.TestCase): self.result = 100 except OnapTestException as exc: self.result = 0 - self.__logger.error(exc.error_message) + self.__logger.exception(exc.error_message) except SDKException: self.result = 0 - self.__logger.error("SDK Exception") + self.__logger.exception("SDK Exception") finally: self.stop_time = time.time() diff --git a/src/onaptests/scenario/basic_vm.py b/src/onaptests/scenario/basic_vm.py index 3ad6392..897e9d4 100644 --- a/src/onaptests/scenario/basic_vm.py +++ b/src/onaptests/scenario/basic_vm.py @@ -45,10 +45,10 @@ class BasicVm(testcase.TestCase): self.result = 100 except OnapTestException as exc: self.result = 0 - self.__logger.error(exc.error_message) + self.__logger.exception(exc.error_message) except SDKException: self.result = 0 - self.__logger.error("SDK Exception") + self.__logger.exception("SDK Exception") finally: self.stop_time = time.time() diff --git a/src/onaptests/scenario/basic_vm_macro.py b/src/onaptests/scenario/basic_vm_macro.py index b849831..3b10983 100644 --- a/src/onaptests/scenario/basic_vm_macro.py +++ b/src/onaptests/scenario/basic_vm_macro.py @@ -120,10 +120,10 @@ class BasicVmMacro(testcase.TestCase): self.result = 100 except OnapTestException as exc: self.result = 0 - self.__logger.error(exc.error_message) + self.__logger.exception(exc.error_message) except SDKException: self.result = 0 - self.__logger.error("SDK Exception") + self.__logger.exception("SDK Exception") finally: self.stop_time = time.time() diff --git a/src/onaptests/scenario/basic_vm_macro_stability.py b/src/onaptests/scenario/basic_vm_macro_stability.py index 552a331..06c17ca 100644 --- a/src/onaptests/scenario/basic_vm_macro_stability.py +++ b/src/onaptests/scenario/basic_vm_macro_stability.py @@ -32,10 +32,10 @@ class BasicVmMacroStability(testcase.TestCase): self.result = 100 except OnapTestException as exc: self.result = 0 - self.__logger.error(exc.error_message) + self.__logger.exception(exc.error_message) except SDKException: self.result = 0 - self.__logger.error("SDK Exception") + self.__logger.exception("SDK Exception") finally: self.stop_time = time.time() diff --git a/src/onaptests/scenario/cds_resource_resolution.py b/src/onaptests/scenario/cds_resource_resolution.py index 8c40916..cff04d8 100644 --- a/src/onaptests/scenario/cds_resource_resolution.py +++ b/src/onaptests/scenario/cds_resource_resolution.py @@ -84,9 +84,9 @@ class CDSResourceResolution(testcase.TestCase): test_phase() self.result += 50 except OnapTestException as exc: - self.__logger.error(exc.error_message) + self.__logger.exception(exc.error_message) except SDKException: - self.__logger.error("SDK Exception") + self.__logger.exception("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 b3c7d3e..24f9a1e 100644 --- a/src/onaptests/scenario/pnf_macro.py +++ b/src/onaptests/scenario/pnf_macro.py @@ -124,9 +124,9 @@ class PnfMacro(testcase.TestCase): test_phase() self.result += 50 except OnapTestException as exc: - self.__logger.error(exc.error_message) + self.__logger.exception(exc.error_message) except SDKException: - self.__logger.error("SDK Exception") + self.__logger.exception("SDK Exception") finally: self.stop_time = time.time() diff --git a/src/onaptests/steps/onboard/service.py b/src/onaptests/steps/onboard/service.py index 6f1e69f..f95cc14 100644 --- a/src/onaptests/steps/onboard/service.py +++ b/src/onaptests/steps/onboard/service.py @@ -2,6 +2,7 @@ import time from typing import Any, Dict from yaml import load, SafeLoader +import onapsdk.constants as onapsdk_const from onapsdk.configuration import settings from onapsdk.exceptions import APIError, ResourceNotFound from onapsdk.sdc.component import Component @@ -69,7 +70,8 @@ class ServiceOnboardStep(BaseStep): # If the service is already distributed, do not try to checkin/onboard (replay of tests) # checkin is done if needed # If service is replayed, no need to try to re-onboard the model - if not service.distributed: + # Double check because of: https://gitlab.com/Orange-OpenSource/lfn/onap/python-onapsdk/-/issues/176 + if not service.distributed and service.status != onapsdk_const.DISTRIBUTED: time.sleep(10) service.checkin() service.onboard() @@ -169,7 +171,8 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep): # If the service is already distributed, do not try to checkin/onboard (replay of tests) # checkin is done if needed # If service is replayed, no need to try to re-onboard the model - if not service.distributed: + # Double check because of: https://gitlab.com/Orange-OpenSource/lfn/onap/python-onapsdk/-/issues/176 + if not service.distributed and service.status != onapsdk_const.DISTRIBUTED: try: service.checkin() except (APIError, ResourceNotFound): |