From e10a5af4bb80d0a9ad4b0bd56959091ba5ff4a9a Mon Sep 17 00:00:00 2001 From: Moshe Date: Tue, 12 Feb 2019 11:30:15 +0200 Subject: fix error logging to include message Issue-ID: VNFSDK-350 Change-Id: Ib04465302a4f1546abd7209765a485c8721c1b1b Signed-off-by: Moshe --- vnftest/common/openstack_utils.py | 2 +- vnftest/core/task.py | 4 ++-- vnftest/runners/iteration.py | 2 +- vnftest/steps/rest_call.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'vnftest') diff --git a/vnftest/common/openstack_utils.py b/vnftest/common/openstack_utils.py index c8842d8..1bbdc43 100644 --- a/vnftest/common/openstack_utils.py +++ b/vnftest/common/openstack_utils.py @@ -800,7 +800,7 @@ def get_stack_resources(heat_stack_id): # pragma: no cover client = get_heat_client() return client.resources.list(heat_stack_id) except Exception as e: - log.exception("Error [get_stack_resources(heat_stack_id)]", e) + log.exception("Error [get_stack_resources(heat_stack_id)]: %s", e) def get_stack_vms(heat_stack_id): # pragma: no cover diff --git a/vnftest/core/task.py b/vnftest/core/task.py index f1d2a4e..da18441 100644 --- a/vnftest/core/task.py +++ b/vnftest/core/task.py @@ -158,7 +158,7 @@ class Task(object): # pragma: no cover LOG.info("Task %s finished in %d secs", task_files[i], one_task_end_time - one_task_start_time) except Exception as e: - LOG.error("Task fatal error", e) + LOG.error("Task fatal error: %s", e) self.task_info.task_fatal() finally: self.task_info.task_end() @@ -275,7 +275,7 @@ class Task(object): # pragma: no cover self.finalize_step(step, runner, result) return result except Exception as e: - LOG.error("Case fatal error", e) + LOG.exception('Case fatal error: %s', e) self.task_info.testcase_fatal(case_name) finally: self.task_info.testcase_end(case_name) diff --git a/vnftest/runners/iteration.py b/vnftest/runners/iteration.py index 9fa5ffc..1d62bca 100644 --- a/vnftest/runners/iteration.py +++ b/vnftest/runners/iteration.py @@ -78,10 +78,10 @@ def _worker_process(result_queue, cls, method_name, step_cfg, # if we do timeout we don't care about dropping individual KPIs output_queue.put(output, True, QUEUE_PUT_TIMEOUT) except AssertionError as assertion: + LOG.exception("Assertion error: %s", assertion) # SLA validation failed in step, determine what to do now if sla_action == "assert": errors.append(assertion) - LOG.info("Assersion error") fatal_error = True elif sla_action == "monitor": LOG.warning("SLA validation failed: %s", assertion.args) diff --git a/vnftest/steps/rest_call.py b/vnftest/steps/rest_call.py index 68631d9..c1a87ed 100644 --- a/vnftest/steps/rest_call.py +++ b/vnftest/steps/rest_call.py @@ -141,7 +141,7 @@ class RestCall(base.Step): value_def = self.sla_cfg['value'] value = utils.format(value_def, output) expected_value = self.sla_cfg['equals'] - assert value == expected_value + assert value == expected_value, "expected: %s, found: %s" % (expected_value, value) def load_file(self, params): operation_template = utils.resource_as_string(self.rest_def_file) -- cgit 1.2.3-korg