Skip to content

Commit

Permalink
Distinguish collection timestamps in blocked pages check (#665)
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem authored Nov 26, 2020
1 parent 45cdc2f commit 3648839
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
18 changes: 9 additions & 9 deletions checks/remotesettings/blocked_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,10 @@ async def run(remotesettings_server: str, blocked_pages: str) -> CheckResult:
extras_ids = set(blocked_ids) - set(records_ids)
missing_ids = set(records_ids) - set(blocked_ids)

addons_timestamp = await client.get_records_timestamp(collection="addons")
plugins_timestamp = await client.get_records_timestamp(collection="plugins")
certificates_timestamp = await client.get_records_timestamp(
collection="certificates"
)
latest_timestamp = max(
int(addons_timestamp), int(plugins_timestamp), int(certificates_timestamp)
addons_timestamp = int(await client.get_records_timestamp(collection="addons"))
plugins_timestamp = int(await client.get_records_timestamp(collection="plugins"))
certificates_timestamp = int(
await client.get_records_timestamp(collection="certificates")
)

"""
Expand All @@ -79,11 +76,14 @@ async def run(remotesettings_server: str, blocked_pages: str) -> CheckResult:
len(missing) == 0
and len(missing_ids) == 0
and len(extras_ids) == 0
and latest_timestamp == xml_timestamp
and xml_timestamp
in (addons_timestamp, plugins_timestamp, certificates_timestamp)
)
data = {
"xml-update": xml_timestamp,
"timestamp": latest_timestamp,
"addons-timestamp": addons_timestamp,
"plugins-timestamp": plugins_timestamp,
"certificates-timestamp": certificates_timestamp,
"broken-links": missing,
"missing": list(missing_ids),
"extras": list(extras_ids),
Expand Down
8 changes: 6 additions & 2 deletions tests/checks/remotesettings/test_blocked_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ async def test_positive(mock_aioresponses, mock_responses):
assert status is True
assert data == {
"xml-update": 1568816392824,
"timestamp": 1568816392824,
"addons-timestamp": 1568816392824,
"plugins-timestamp": 157556192042,
"certificates-timestamp": 1181628381652,
"broken-links": [],
"missing": [],
"extras": [],
Expand Down Expand Up @@ -98,7 +100,9 @@ async def test_negative(mock_aioresponses, mock_responses):
assert status is False
assert data == {
"xml-update": 1568816392824,
"timestamp": 1568816392824,
"addons-timestamp": 1568816392824,
"plugins-timestamp": 157556192042,
"certificates-timestamp": 1181628381652,
"broken-links": ["7-8-9.html"],
"missing": ["abc"],
"extras": ["extra"],
Expand Down

0 comments on commit 3648839

Please sign in to comment.