aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/instantiate/service_ala_carte.py
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2021-03-19 15:01:26 +0000
committerMichal Jagiello <michal.jagiello@t-mobile.pl>2021-03-19 15:46:43 +0000
commit11eaf0bf2df74664ab9812d817e1d34e89112c0b (patch)
treea8b7854c5332ec4fe1e65cd469881feba814919f /src/onaptests/steps/instantiate/service_ala_carte.py
parentfb89da9e663ae759fc245b9273e55d06bc57f6a8 (diff)
Timeout on orchestration requests
Use wait_for_finish method to raise an exception if orchestration requests took more than 10 minutes Issue-ID: TEST-316 Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl> Change-Id: I0d82d91b0f7104caf32e5905d5950047d7551a7b
Diffstat (limited to 'src/onaptests/steps/instantiate/service_ala_carte.py')
-rw-r--r--src/onaptests/steps/instantiate/service_ala_carte.py29
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: