Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maskarb committed Oct 31, 2023
1 parent 47c7dd7 commit 2b9894d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
5 changes: 2 additions & 3 deletions nise/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 3 additions & 7 deletions tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2b9894d

Please sign in to comment.