diff options
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: |