Skip to content

Commit

Permalink
Fix #1148: detect missing data on max age percentage (#1350)
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem authored Nov 27, 2023
1 parent 3affb0b commit 4453d18
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions checks/remotesettings/uptake_max_age.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ async def run(

age_percentiles = rows[0]["age_percentiles"]

if len(set(age_percentiles)) < 2:
return True, {"percentiles": "Not enough data during this period."}

percentiles = {}
for percentile, max_value in max_percentiles.items():
value = age_percentiles[int(percentile)]
Expand Down
18 changes: 18 additions & 0 deletions tests/checks/remotesettings/test_uptake_max_age.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@ async def test_positive_no_data():
assert data["percentiles"] == "No broadcast data during this period."


async def test_positive_single_row():
with patch_async(
f"{MODULE}.fetch_bigquery",
return_value=[
{
"channel": "release",
"age_percentiles": [23 for i in range(100)],
"min_timestamp": datetime.fromisoformat("2019-09-16T02:36:12.348"),
"max_timestamp": datetime.fromisoformat("2019-09-16T06:24:58.741"),
},
],
):
status, data = await run(max_percentiles={"50": 42}, channels=["aurora"])

assert status is True
assert data["percentiles"] == "Not enough data during this period."


async def test_negative():
with patch_async(f"{MODULE}.fetch_bigquery", return_value=FAKE_ROWS):
status, data = await run(max_percentiles={"10": 99})
Expand Down

0 comments on commit 4453d18

Please sign in to comment.