diff --git a/supervisor/utils/json.py b/supervisor/utils/json.py index d3a6b43e4..833817c6f 100644 --- a/supervisor/utils/json.py +++ b/supervisor/utils/json.py @@ -55,7 +55,8 @@ def write_json_file(jsonfile: Path, data: Any) -> None: orjson.dumps( # pylint: disable=no-member data, option=orjson.OPT_INDENT_2 # pylint: disable=no-member - | orjson.OPT_NON_STR_KEYS, # pylint: disable=no-member + | orjson.OPT_NON_STR_KEYS # pylint: disable=no-member + | orjson.OPT_SORT_KEYS, # pylint: disable=no-member default=json_encoder_default, ).decode("utf-8") ) diff --git a/tests/api/test_backups.py b/tests/api/test_backups.py index 24aaa0bd5..c7d524b45 100644 --- a/tests/api/test_backups.py +++ b/tests/api/test_backups.py @@ -1035,6 +1035,9 @@ async def test_protected_backup( assert body["data"]["backups"][0]["location"] is None assert body["data"]["backups"][0]["locations"] == [None] assert body["data"]["backups"][0]["protected"] is True + + # NOTE: Maybe it is not safe to compare size here, as random data in the + # backup might change the size (due to gzip). assert body["data"]["backups"][0]["location_attributes"] == { ".local": { "protected": True,