Skip to content

Commit

Permalink
test: fix query measurements after 30 days test (#442)
Browse files Browse the repository at this point in the history
* test: fix query measurements after 30 days test

This test started failing ater 2024-03-10 because
the time at the query was not frozen to a specific
date so it was using the system's actual time and
the measurements were not a part of the last 30 days.

* fix: add comments to clarify test fix

Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
  • Loading branch information
joseph-sentry authored and RulaKhaled committed Mar 13, 2024
1 parent c1301f1 commit 72f40cd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion utils/tests/unit/test_coverage_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_query_monthly_coverage_measurements_after_30_days(self):
self.add_upload_measurements_records(owner=owner, quantity=3)
freezer.stop()

# Now
# Uploads within the last 30 days
freezer = freeze_time("2024-02-10T00:00:00")
freezer.start()
self.add_upload_measurements_records(owner=owner, quantity=5)
Expand All @@ -94,9 +94,13 @@ def test_query_monthly_coverage_measurements_after_30_days(self):
assert len(all_measurements) == 8

plan_service = PlanService(current_org=owner)
# Now
freezer = freeze_time("2024-03-05T00:00:00")
freezer.start()
monthly_measurements = query_monthly_coverage_measurements(
plan_service=plan_service
)
freezer.stop()
assert monthly_measurements == 5

def test_query_monthly_coverage_measurements_excluding_uploads_during_trial(self):
Expand Down

0 comments on commit 72f40cd

Please sign in to comment.