diff options
author | morganrol <morgan.richomme@orange.com> | 2021-04-06 19:18:42 +0200 |
---|---|---|
committer | mrichomme <morgan.richomme@orange.com> | 2021-04-07 19:19:55 +0200 |
commit | 7f14630e5f8b613bf0ce984f21beade5a8085dd7 (patch) | |
tree | 9e99a9f2584c5e987a4b14a650d2485731552a59 | |
parent | 2f224001177afb13b5de22d2d97d0ea63c5781b8 (diff) |
[CLAMP] raise exception in case of Policy or DCAE errors
remove the exit(1) to be sure we got a nice reporting
Issue-ID: INT-1819
Signed-off-by: morganrol <morgan.richomme@orange.com>
Change-Id: Ie652d382fd649e3537209d6891881db5ee219207
-rw-r--r-- | src/onaptests/steps/loop/instantiate_loop.py | 5 | ||||
-rw-r--r-- | src/onaptests/utils/exceptions.py | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/onaptests/steps/loop/instantiate_loop.py b/src/onaptests/steps/loop/instantiate_loop.py index b6f4ffa..01eada5 100644 --- a/src/onaptests/steps/loop/instantiate_loop.py +++ b/src/onaptests/steps/loop/instantiate_loop.py @@ -6,6 +6,7 @@ import logging.config from onapsdk.clamp.loop_instance import LoopInstance from onapsdk.configuration import settings +from onaptests.utils.exceptions import OnapTestException class InstantiateLoop(): @@ -57,14 +58,14 @@ class InstantiateLoop(): else: self._logger.error("An error occured while submitting the loop instance") - exit(1) + raise OnapTestException.PolicyException self._logger.info("******** DEPLOY LOOP INSTANCE *******") deploy = loop.deploy_microservice_to_dcae() if deploy: self._logger.info("Loop instance %s successfully deployed on DCAE !!", self.loop_name) else: self._logger.error("An error occured while deploying the loop instance") - exit(1) + raise OnapTestException.DcaeException def instantiate_loop(self): """Instantiate the control loop.""" diff --git a/src/onaptests/utils/exceptions.py b/src/onaptests/utils/exceptions.py index c12ee2f..34f7637 100644 --- a/src/onaptests/utils/exceptions.py +++ b/src/onaptests/utils/exceptions.py @@ -78,3 +78,11 @@ class SubstepExecutionException(OnapTestException): class EnvironmentCleanupException(OnapTestException): """Test environment cleanup exception.""" error_message="Test couldn't finish a cleanup" + +class PolicyException(OnapTestException): + """Policy exception.""" + error_message="Problem with policy module" + +class DcaeException(OnapTestException): + """DCAE exception.""" + error_message="Problem with DCAE module" |