From e39466fadd289f279509e460f6222d9c08f53c56 Mon Sep 17 00:00:00 2001 From: mrichomme Date: Thu, 15 Oct 2020 14:57:37 +0200 Subject: Fix bad path of the logs in the reporting page Issue-ID: TEST-270 Signed-off-by: mrichomme Change-Id: Ief03cf6916b417fb0c80c5086ffe8e73f3865329 Signed-off-by: mrichomme --- README.md | 4 +++- run_basicvm_nomulticloud.py | 26 ++++++++++++++++++++------ src/onaptests/configuration/settings.py | 2 +- src/onaptests/steps/reports_collection.py | 5 ++--- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 097967d..dc833e0 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,9 @@ See ubuntu16test as example - Set global settings configuration files with all required input datas including the dynamic forwarding port for ssh tunnel in - src/onaptests/configuration/settings.py + src/onaptests/configuration/settings.py. You can customize the path for your + logs and reporting the page. Note that the reporting page assumes that the + logs are put in the same directory than the html page (relative path). - Set OpenStack configuration: there are 2 ways to provide the cloud information If you got the clouds.yaml, you need to reference your cloud with the env diff --git a/run_basicvm_nomulticloud.py b/run_basicvm_nomulticloud.py index 9ebefb8..a2e9cfd 100644 --- a/run_basicvm_nomulticloud.py +++ b/run_basicvm_nomulticloud.py @@ -1,5 +1,6 @@ import logging.config import time +import onaptests.utils.exceptions as onap_test_exceptions from onapsdk.configuration import settings from onaptests.steps.instantiate.vf_module_ala_carte import YamlTemplateVfModuleAlaCarteInstantiateStep @@ -13,11 +14,24 @@ if __name__ == "__main__": basic_vm_instantiate = YamlTemplateVfModuleAlaCarteInstantiateStep( cleanup=settings.CLEANUP_FLAG) - basic_vm_instantiate.execute() - if settings.CLEANUP_FLAG: - time.sleep(settings.CLEANUP_ACTIVITY_TIMER) - try: + try: + basic_vm_instantiate.execute() + if settings.CLEANUP_FLAG: + time.sleep(settings.CLEANUP_ACTIVITY_TIMER) basic_vm_instantiate.cleanup() - except ValueError as error: - logger.info("service instance deleted as expected {0}".format(error)) + except onap_test_exceptions.TestConfigurationException: + logger.error("Basic VM configuration error") + except onap_test_exceptions.ServiceInstantiateException: + logger.error("Basic VM instantiation error") + except onap_test_exceptions.ServiceCleanupException: + logger.error("Basic VM instance cleanup error") + except onap_test_exceptions.VnfInstantiateException: + logger.error("Basic VM Vnf instantiation error") + except onap_test_exceptions.VnfCleanupException: + logger.error("Basic VM Vnf instance cleanup error") + except onap_test_exceptions.VfModuleInstantiateException: + logger.error("Basic VM Module instantiation error") + except onap_test_exceptions.VfModuleCleanupException: + logger.error("Basic VM Module cleanup error") + basic_vm_instantiate.reports_collection.generate_report() diff --git a/src/onaptests/configuration/settings.py b/src/onaptests/configuration/settings.py index 3339082..745dc08 100644 --- a/src/onaptests/configuration/settings.py +++ b/src/onaptests/configuration/settings.py @@ -28,7 +28,7 @@ LOG_CONFIG = { "level": "DEBUG", "class": "logging.FileHandler", "formatter": "default", - "filename": "./pythonsdk.debug.log", + "filename": "/tmp/pythonsdk.debug.log", "mode": "w" } }, diff --git a/src/onaptests/steps/reports_collection.py b/src/onaptests/steps/reports_collection.py index bcb199f..3c1dfb6 100644 --- a/src/onaptests/steps/reports_collection.py +++ b/src/onaptests/steps/reports_collection.py @@ -36,7 +36,7 @@ class ReportsCollection: def generate_report(self) -> None: step_list = self.report - failing_steps = [] + failing_steps = {} for step,status in step_list.items(): if 'FAIL' in status: failing_steps[step] = status @@ -51,7 +51,6 @@ class ReportsCollection: except NameError: components = "" - log_path = settings.LOG_CONFIG['handlers']['file']['filename'] jinja_env = Environment( autoescape=select_autoescape(['html']), loader=FileSystemLoader(sys.path[-1] + '/onaptests/templates/reporting')) @@ -62,5 +61,5 @@ class ReportsCollection: usecase=usecase, details=details, components=components, - log_path=log_path).dump( + log_path="./pythonsdk.debug.log").dump( settings.REPORTING_FILE_PATH) -- cgit 1.2.3-korg