From 83f4c9865ee8ce496251d47a967229503f798791 Mon Sep 17 00:00:00 2001 From: Payal Jindal Date: Tue, 23 Jan 2024 23:53:12 +0530 Subject: [PATCH] fix: removed csv headers from read rows --- tools/target-server-validator/apigee_utils.py | 2 +- tools/target-server-validator/main.py | 5 ++++- tools/target-server-validator/utilities.py | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/target-server-validator/apigee_utils.py b/tools/target-server-validator/apigee_utils.py index 0fdb2e31..133cf5c8 100644 --- a/tools/target-server-validator/apigee_utils.py +++ b/tools/target-server-validator/apigee_utils.py @@ -313,7 +313,7 @@ def call_validator_proxy_parallel(self, arg_tuple): ) return report else: - logger.error(f"Error while calling the validator proxy - {response.get('error','unknown error')}") # noqa + return {"error": f"Error while calling the validator proxy - {response.get('error','unknown error')} with payload {arg_tuple[3]}"} # noqa def write_proxy_bundle(self, export_dir, file_name, data): file_path = f"./{export_dir}/{file_name}.zip" diff --git a/tools/target-server-validator/main.py b/tools/target-server-validator/main.py index ba1f40aa..ccc6eb47 100644 --- a/tools/target-server-validator/main.py +++ b/tools/target-server-validator/main.py @@ -233,7 +233,10 @@ def main(): output_reports = run_parallel(source_apigee.call_validator_proxy_parallel, args) # noqa for output in output_reports: - final_report.extend(output) + if isinstance(output, list): + final_report.extend(output) + else: + logger.error(output.get("error", "Unknown Error occured while calling proxy")) # noqa # Write CSV Report # TODO: support relative report path diff --git a/tools/target-server-validator/utilities.py b/tools/target-server-validator/utilities.py index 37f9aabc..f0bf56bc 100644 --- a/tools/target-server-validator/utilities.py +++ b/tools/target-server-validator/utilities.py @@ -104,6 +104,8 @@ def read_csv(file_name): rows = csv.reader(file) for each_row in rows: read_rows.append(each_row) + if len(read_rows) != 0: + read_rows.pop(0) except FileNotFoundError: logger.warning(f"File {file_name} not found ! ") return read_rows