diff options
author | 2020-12-01 17:49:31 +0100 | |
---|---|---|
committer | 2020-12-01 22:16:10 +0000 | |
commit | 7a8cc3ff337cb471d093042345eb68d8888253e6 (patch) | |
tree | a85641a2fa8e95e374655f0f20bd63cf98c9ffe1 /src/onaptests/scenario/clearwater_ims.py | |
parent | 3c2183191fc1a2d01b24c7e91a144dad8467cd20 (diff) |
Better exception handling
Instead of catching all exceptions that can occurs and miss one, let's
create a "parent" exception class for OnapTest and catch only this one.
In order to know what's the error, we also create a class attribute
(`error_message`) that gives us the reason for exception.
Issue-ID: INT-1796
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Change-Id: I798d8c6270c466b1d9be6511f52fd9441401c9c8
(cherry picked from commit 9c71e24adaaedd07d7e2e65922c5a3cee27318c9)
Diffstat (limited to 'src/onaptests/scenario/clearwater_ims.py')
-rw-r--r-- | src/onaptests/scenario/clearwater_ims.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/onaptests/scenario/clearwater_ims.py b/src/onaptests/scenario/clearwater_ims.py index 0177e02..8a68fa9 100644 --- a/src/onaptests/scenario/clearwater_ims.py +++ b/src/onaptests/scenario/clearwater_ims.py @@ -5,6 +5,8 @@ import time from xtesting.core import testcase from onapsdk.configuration import settings + +import onaptests.utils.exceptions as onap_test_exceptions from onaptests.steps.instantiate.vf_module_ala_carte import YamlTemplateVfModuleAlaCarteInstantiateStep class ClearwaterIms(testcase.TestCase): @@ -42,9 +44,10 @@ class ClearwaterIms(testcase.TestCase): self.__logger.info("No cleanup requested. Test completed.") self.result = 100 self.stop_time = time.time() - except: - self.__logger.error("Clearwater IMS test case failed.") + except onap_test_exceptions.OnapTestException as exc: self.result = 0 + self.__logger.error(exc.error_message) + finally: self.stop_time = time.time() def clean(self): |