diff --git a/checks/remotesettings/push_timestamp.py b/checks/remotesettings/push_timestamp.py index 0cf20de7..f7e78cb9 100644 --- a/checks/remotesettings/push_timestamp.py +++ b/checks/remotesettings/push_timestamp.py @@ -43,6 +43,10 @@ async def get_push_timestamp(uri) -> str: async def get_remotesettings_timestamp(uri) -> str: client = KintoClient(server_url=uri) entries = await client.get_monitor_changes(bust_cache=True) + + # sort by timestamp desc as the records are returned by bucket/collection + entries.sort(key=lambda e: e["last_modified"], reverse=True) + # Some collections are excluded (eg. preview) # https://github.com/mozilla-services/cloudops-deployment/blob/master/projects/kinto/puppet/modules/kinto/templates/kinto.ini.erb matched = [e for e in entries if "preview" not in e["bucket"]] diff --git a/tests/checks/remotesettings/test_push_timestamp.py b/tests/checks/remotesettings/test_push_timestamp.py index df361a8f..98d6ca88 100644 --- a/tests/checks/remotesettings/test_push_timestamp.py +++ b/tests/checks/remotesettings/test_push_timestamp.py @@ -18,7 +18,8 @@ async def test_positive(mock_responses): payload={ "changes": [ {"id": "a", "bucket": "main-preview", "last_modified": 2000000000000}, - {"id": "b", "bucket": "main", "last_modified": 1573086234731}, + {"id": "b", "bucket": "main", "last_modified": 1273086234731}, + {"id": "c", "bucket": "main", "last_modified": 1573086234731}, ] }, )