From 2b9894dfafa1b41a2c77c1d392d902aec647209a Mon Sep 17 00:00:00 2001 From: maskarb Date: Tue, 31 Oct 2023 19:21:54 -0400 Subject: [PATCH] fix tests --- nise/report.py | 5 ++--- tests/test_report.py | 10 +++------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/nise/report.py b/nise/report.py index c7b66422..16ecca17 100644 --- a/nise/report.py +++ b/nise/report.py @@ -826,7 +826,6 @@ def ocp_create_report(options): # noqa: C901 minio_upload = options.get("minio_upload") write_monthly = options.get("write_monthly", False) for month in months: - print(month) data = {OCP_POD_USAGE: [], OCP_STORAGE_USAGE: [], OCP_NODE_LABEL: [], OCP_NAMESPACE_LABEL: []} file_numbers = {OCP_POD_USAGE: 0, OCP_STORAGE_USAGE: 0, OCP_NODE_LABEL: 0, OCP_NAMESPACE_LABEL: 0} if ros_ocp_info: @@ -957,8 +956,8 @@ def ocp_create_report(options): # noqa: C901 if insights_upload: report_files = list(temp_files.values()) + list(temp_ros_files.values()) for temp_usage_file in report_files: - report_files = [temp_usage_file, temp_manifest_name] - temp_usage_zip = _tar_gzip_report_files(report_files) + files_to_zip = [temp_usage_file, temp_manifest_name] + temp_usage_zip = _tar_gzip_report_files(files_to_zip) ocp_route_file(insights_upload, temp_usage_zip) os.remove(temp_usage_zip) os.remove(temp_manifest_name) diff --git a/tests/test_report.py b/tests/test_report.py index 45ada84d..90f4a30a 100644 --- a/tests/test_report.py +++ b/tests/test_report.py @@ -907,10 +907,8 @@ def test_ocp_create_report_with_local_dir(self): fix_dates(options, "ocp") ocp_create_report(options) for report_type in OCP_REPORT_TYPE_TO_COLS.keys(): - month_output_file_name = "{}-{}-{}-{}".format( - calendar.month_name[now.month], now.year, cluster_id, report_type - ) - expected_month_output_file = "{}/{}.csv".format(os.getcwd(), month_output_file_name) + month_output_file_name = f"{calendar.month_name[now.month]}-{now.year}-{cluster_id}-{report_type}" + expected_month_output_file = f"{os.getcwd()}/{month_output_file_name}.csv" self.assertTrue(os.path.isfile(expected_month_output_file)) os.remove(expected_month_output_file) shutil.rmtree(local_insights_upload) @@ -981,9 +979,7 @@ def test_ocp_create_report_with_local_dir_static_generation(self): for report_type in OCP_REPORT_TYPE_TO_COLS.keys(): if "ocp_ros_usage" == report_type: continue - month_output_file_name = "{}-{}-{}-{}".format( - calendar.month_name[now.month], now.year, cluster_id, report_type - ) + month_output_file_name = f"{calendar.month_name[now.month]}-{now.year}-{cluster_id}-{report_type}" expected_month_output_file = "{}/{}.csv".format(os.getcwd(), month_output_file_name) self.assertTrue(os.path.isfile(expected_month_output_file)) os.remove(expected_month_output_file)