Test pnf_macro fix 11/133811/3
authorMichal Jagiello <michal.jagiello@t-mobile.pl>
Fri, 24 Mar 2023 15:38:53 +0000 (15:38 +0000)
committerMichal Jagiello <michal.jagiello@t-mobile.pl>
Wed, 29 Mar 2023 07:01:44 +0000 (07:01 +0000)
Configure and check service distribuiton for 30 minutes

Issue-ID: INT-2193
Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Change-Id: I316a3e5c179530ba92c87c43795643e9faf30048

src/onaptests/configuration/pnf_macro_settings.py
src/onaptests/configuration/settings.py
src/onaptests/steps/instantiate/service_macro.py
src/onaptests/steps/onboard/service.py
tox.ini

index a315525..da4e25c 100644 (file)
@@ -48,3 +48,4 @@ PNF_REGISTRATION_NUMBER_OF_TRIES = 20
 
 # Disable YAML SDC model definition which means all SDC config reside in SERVICE_YAML_TEMPLATE
 MODEL_YAML_TEMPLATE = None
+SDC_CLEANUP = True
index 482be9e..3ca9af9 100644 (file)
@@ -41,7 +41,7 @@ CLEANUP_FLAG = False
 # Additional flag to enable SDC resources cleanup
 # Added as SDC's VSP deletion is broken and most tests fail due to that
 # Should be removed as soon as SDC resource deletion is fixed
-SDC_CLEANUP = False
+SDC_CLEANUP = True
 
 REPORTING_FILE_PATH = "/tmp/reporting.html"
 K8S_REGION_TYPE = "k8s"
@@ -52,3 +52,5 @@ K8S_ADDITIONAL_RESOURCES_NAMESPACE = K8S_ONAP_NAMESPACE  # Resources created on
 #SOCK_HTTP = "socks5h://127.0.0.1:8091"
 
 ORCHESTRATION_REQUEST_TIMEOUT = 60.0 * 15  # 15 minutes in seconds
+SERVICE_DISTRIBUTION_NUMBER_OF_TRIES = 30
+SERVICE_DISTRIBUTION_SLEEP_TIME = 60
index dc2ce89..b32d936 100644 (file)
@@ -166,8 +166,8 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep):
         self._logger.info("******** Check Service Distribution *******")
         distribution_completed = False
         nb_try = 0
-        nb_try_max = 10
-        while distribution_completed is False and nb_try < nb_try_max:
+        while distribution_completed is False and \
+                nb_try < settings.SERVICE_DISTRIBUTION_NUMBER_OF_TRIES:
             distribution_completed = service.distributed
             if distribution_completed is True:
                 self._logger.info(
@@ -175,9 +175,9 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep):
                 service.name)
                 break
             self._logger.info(
-                "Service Distribution for %s ongoing, Wait for 60 s",
-                service.name)
-            time.sleep(60)
+                "Service Distribution for %s ongoing, Wait for %d s",
+                service.name,settings.SERVICE_DISTRIBUTION_SLEEP_TIME)
+            time.sleep(settings.SERVICE_DISTRIBUTION_SLEEP_TIME)
             nb_try += 1
 
         if distribution_completed is False:
index d176697..b1e7d4d 100644 (file)
@@ -266,8 +266,9 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep):
     @YamlTemplateBaseStep.store_state(cleanup=True)
     def cleanup(self) -> None:
         """Cleanup service onboard step."""
-        service: Service = Service(name=self.service_name)
-        if service.exists():
-            service.archive()
-            service.delete()
-        super().cleanup()
+        if settings.SDC_CLEANUP:
+            service: Service = Service(name=self.service_name)
+            if service.exists():
+                service.archive()
+                service.delete()
+            super().cleanup()
diff --git a/tox.ini b/tox.ini
index 50e841e..906fb46 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -42,8 +42,8 @@ commands_pre =
     /bin/sh -c "git --no-pager diff HEAD HEAD^ --name-only '*.rst' > /tmp/.coalist_rst"
 deps = -r ./docs/requirements-docs.txt
 commands =
-  /bin/sh -c "sphinx-build -n -b html docs docs/build/html $(</tmp/.coalist_rst)"
-  /bin/sh -c "sphinx-build -n -b linkcheck docs docs/build/linkcheck $(</tmp/.coalist_rst)"
+  /bin/sh -c "sphinx-build -n -W -b html docs docs/build/html $(</tmp/.coalist_rst)"
+  /bin/sh -c "sphinx-build -n -W -b linkcheck docs docs/build/linkcheck $(</tmp/.coalist_rst)"
 
 [testenv:md]
 commands_pre =