Skip to content

Commit

Permalink
Merge branch 'main' into cost-5161_drop_azure_v1_reports_support
Browse files Browse the repository at this point in the history
  • Loading branch information
bacciotti authored Jul 10, 2024
2 parents c2aa345 + 2783c62 commit 0a11fdc
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
13 changes: 7 additions & 6 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nise/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "4.5.6"
__version__ = "4.5.7"

VERSION = __version__.split(".")
3 changes: 2 additions & 1 deletion nise/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,8 @@ def gcp_create_report(options): # noqa: C901

local_file_path, output_file_name = write_gcp_file(gen_start_date, gen_end_date, data, options)
output_files.append(output_file_name)
monthly_files.append(local_file_path)
if local_file_path not in monthly_files:
monthly_files.append(local_file_path)

for index, month_file in enumerate(monthly_files):
if gcp_bucket_name:
Expand Down
18 changes: 18 additions & 0 deletions tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -1627,6 +1627,24 @@ def test_gcp_create_report_without_write_monthly(self):

self.assertFalse(os.path.isfile(expected_output_file_path))

def test_gcp_create_report_without_write_monthly_overlapping_month(self):
"""Test that there are no Exceptions when processing overlapping months dates."""
now = datetime.datetime(2024, 7, 1, 0, 0)
yesterday = datetime.datetime(2024, 6, 30, 0, 0)
report_prefix = "test_report"
options = {
"start_date": yesterday,
"end_date": now,
"gcp_report_prefix": report_prefix,
"gcp_bucket_name": "gcp_bucket_name",
}
fix_dates(options, "gcp")
gcp_create_report(options)
output_file_name = "{}-{}.csv".format(report_prefix, yesterday.strftime("%Y-%m-%d"))
expected_output_file_path = "{}/{}".format(os.getcwd(), output_file_name)

self.assertFalse(os.path.isfile(expected_output_file_path))

def test_gcp_create_report_with_dataset_name_static_data(self):
"""Test the gcp report creation method where a dataset name is included and static data used."""
now = datetime.datetime.now().replace(microsecond=0, second=0, minute=0, hour=0)
Expand Down

0 comments on commit 0a11fdc

Please sign in to comment.