From 36488399932818e2e77c8b32340b2edd041df892 Mon Sep 17 00:00:00 2001 From: Mathieu Leplatre Date: Thu, 26 Nov 2020 22:59:20 +0100 Subject: [PATCH] Distinguish collection timestamps in blocked pages check (#665) --- checks/remotesettings/blocked_pages.py | 18 +++++++++--------- .../remotesettings/test_blocked_pages.py | 8 ++++++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/checks/remotesettings/blocked_pages.py b/checks/remotesettings/blocked_pages.py index 13f04ebd..7eedfc89 100644 --- a/checks/remotesettings/blocked_pages.py +++ b/checks/remotesettings/blocked_pages.py @@ -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") ) """ @@ -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), diff --git a/tests/checks/remotesettings/test_blocked_pages.py b/tests/checks/remotesettings/test_blocked_pages.py index 864affa4..30e6ef04 100644 --- a/tests/checks/remotesettings/test_blocked_pages.py +++ b/tests/checks/remotesettings/test_blocked_pages.py @@ -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": [], @@ -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"],