diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2021-03-19 16:20:59 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-03-19 16:20:59 +0000 |
commit | 2939e020dd9a7a34dd14b6b3c776f4d1e55d1328 (patch) | |
tree | 8d7247d650ba76b7b288e55f49e7fc267d5f831e /src/onaptests/steps/instantiate/service_ala_carte.py | |
parent | 5e3ded022f3aa6de7594c1dcd8708d70bfc12fec (diff) | |
parent | 11eaf0bf2df74664ab9812d817e1d34e89112c0b (diff) |
Merge "Timeout on orchestration requests"
Diffstat (limited to 'src/onaptests/steps/instantiate/service_ala_carte.py')
-rw-r--r-- | src/onaptests/steps/instantiate/service_ala_carte.py | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/onaptests/steps/instantiate/service_ala_carte.py b/src/onaptests/steps/instantiate/service_ala_carte.py index eb3c882..858db2d 100644 --- a/src/onaptests/steps/instantiate/service_ala_carte.py +++ b/src/onaptests/steps/instantiate/service_ala_carte.py @@ -81,8 +81,14 @@ class ServiceAlaCarteInstantiateStep(BaseStep): vid_project, service_instance_name=settings.SERVICE_INSTANCE_NAME ) - while not service_instantiation.finished: - time.sleep(10) + try: + service_instantiation.wait_for_finish(settings.ORCHESTRATION_REQUEST_TIMEOUT) + except TimeoutError: + self._logger.error("Service instantiation %s timed out", self.service_instance_name) + raise onap_test_exceptions.ServiceInstantiateException + if service_instantiation.failed: + self._logger.error("Service instantiation %s failed", self.service_instance_name) + raise onap_test_exceptions.ServiceInstantiateException class YamlTemplateServiceAlaCarteInstantiateStep(YamlTemplateBaseStep): @@ -225,9 +231,13 @@ class YamlTemplateServiceAlaCarteInstantiateStep(YamlTemplateBaseStep): vid_project, service_instance_name=self.service_instance_name ) - while not service_instantiation.finished: - time.sleep(10) + try: + service_instantiation.wait_for_finish(settings.ORCHESTRATION_REQUEST_TIMEOUT) + except TimeoutError: + self._logger.error("Service instantiation %s timed out", self.service_instance_name) + raise onap_test_exceptions.ServiceCleanupException if service_instantiation.failed: + self._logger.error("Service instantiation %s failed", self.service_instance_name) raise onap_test_exceptions.ServiceInstantiateException else: service_subscription: ServiceSubscription = customer.get_service_subscription_by_service_type(self.service_name) @@ -242,12 +252,11 @@ class YamlTemplateServiceAlaCarteInstantiateStep(YamlTemplateBaseStep): """ service_deletion = self._service_instance.delete() - nb_try = 0 - nb_try_max = 30 - while not service_deletion.finished and nb_try < nb_try_max: - self._logger.info("Wait for Service deletion") - nb_try += 1 - time.sleep(15) + try: + service_deletion.wait_for_finish(settings.ORCHESTRATION_REQUEST_TIMEOUT) + except TimeoutError: + self._logger.error("Service deletion %s timed out", self._service_instance_name) + raise onap_test_exceptions.ServiceCleanupException if service_deletion.finished: self._logger.info("Service %s deleted", self._service_instance_name) else: |