diff --git a/homeassistant/components/backup/util.py b/homeassistant/components/backup/util.py index 2cb423b07b48..f803b7854c06 100644 --- a/homeassistant/components/backup/util.py +++ b/homeassistant/components/backup/util.py @@ -213,7 +213,8 @@ def validate_password_stream( def _get_expected_archives(backup: AgentBackup) -> set[str]: """Get the expected archives in the backup.""" - expected_archives = set() + # Supervisor specific config, not in the metadata (since Supervisor 2026.03.3) + expected_archives = {"supervisor"} if backup.homeassistant_included: expected_archives.add("homeassistant") for addon in backup.addons: diff --git a/tests/components/backup/fixtures/test_backups/c0cb53bd_supervisor.tar.decrypted b/tests/components/backup/fixtures/test_backups/c0cb53bd_supervisor.tar.decrypted new file mode 100644 index 000000000000..05dec3d9b0e0 Binary files /dev/null and b/tests/components/backup/fixtures/test_backups/c0cb53bd_supervisor.tar.decrypted differ diff --git a/tests/components/backup/fixtures/test_backups/c0cb53bd_supervisor.tar.encrypted_v3 b/tests/components/backup/fixtures/test_backups/c0cb53bd_supervisor.tar.encrypted_v3 new file mode 100644 index 000000000000..56f29a3d994a Binary files /dev/null and b/tests/components/backup/fixtures/test_backups/c0cb53bd_supervisor.tar.encrypted_v3 differ diff --git a/tests/components/backup/test_util.py b/tests/components/backup/test_util.py index aca3c937b9e6..7dad63b2f48e 100644 --- a/tests/components/backup/test_util.py +++ b/tests/components/backup/test_util.py @@ -307,7 +307,7 @@ def test_validate_password_no_homeassistant(caplog: pytest.LogCaptureFixture) -> @pytest.mark.parametrize( - ("addons", "padding_size", "decrypted_backup"), + ("addons", "padding_size", "encrypted_backup", "decrypted_backup"), [ ( [ @@ -315,6 +315,7 @@ def test_validate_password_no_homeassistant(caplog: pytest.LogCaptureFixture) -> AddonInfo(name="Core 2", slug="core2", version="1.0.0"), ], 51200, # 5 x 10240 byte of padding + "test_backups/c0cb53bd.tar", "test_backups/c0cb53bd.tar.decrypted", ), ( @@ -322,19 +323,31 @@ def test_validate_password_no_homeassistant(caplog: pytest.LogCaptureFixture) -> AddonInfo(name="Core 1", slug="core1", version="1.0.0"), ], 40960, # 4 x 10240 byte of padding + "test_backups/c0cb53bd.tar", "test_backups/c0cb53bd.tar.decrypted_skip_core2", ), + # supervisor.tar.gz is not in the backup metadata but must be decrypted + ( + [ + AddonInfo(name="Core 1", slug="core1", version="1.0.0"), + AddonInfo(name="Core 2", slug="core2", version="1.0.0"), + ], + 51200, # 5 x 10240 byte of padding + "test_backups/c0cb53bd_supervisor.tar.encrypted_v3", + "test_backups/c0cb53bd_supervisor.tar.decrypted", + ), ], ) async def test_decrypted_backup_streamer( hass: HomeAssistant, addons: list[AddonInfo], padding_size: int, + encrypted_backup: str, decrypted_backup: str, ) -> None: """Test the decrypted backup streamer.""" decrypted_backup_path = get_fixture_path(decrypted_backup, DOMAIN) - encrypted_backup_path = get_fixture_path("test_backups/c0cb53bd.tar", DOMAIN) + encrypted_backup_path = get_fixture_path(encrypted_backup, DOMAIN) backup = AgentBackup( addons=addons, backup_id="1234", @@ -485,7 +498,7 @@ async def test_decrypted_backup_streamer_wrong_password(hass: HomeAssistant) -> @pytest.mark.parametrize( - ("addons", "padding_size", "encrypted_backup"), + ("addons", "padding_size", "decrypted_backup", "encrypted_backup"), [ ( [ @@ -493,6 +506,7 @@ async def test_decrypted_backup_streamer_wrong_password(hass: HomeAssistant) -> AddonInfo(name="Core 2", slug="core2", version="1.0.0"), ], 51200, # 5 x 10240 byte of padding + "test_backups/c0cb53bd.tar.decrypted", "test_backups/c0cb53bd.tar.encrypted_v3", ), ( @@ -500,20 +514,30 @@ async def test_decrypted_backup_streamer_wrong_password(hass: HomeAssistant) -> AddonInfo(name="Core 1", slug="core1", version="1.0.0"), ], 40960, # 4 x 10240 byte of padding + "test_backups/c0cb53bd.tar.decrypted", "test_backups/c0cb53bd.tar.encrypted_v3_skip_core2", ), + # supervisor.tar.gz is not in the backup metadata but must be encrypted + ( + [ + AddonInfo(name="Core 1", slug="core1", version="1.0.0"), + AddonInfo(name="Core 2", slug="core2", version="1.0.0"), + ], + 51200, # 5 x 10240 byte of padding + "test_backups/c0cb53bd_supervisor.tar.decrypted", + "test_backups/c0cb53bd_supervisor.tar.encrypted_v3", + ), ], ) async def test_encrypted_backup_streamer( hass: HomeAssistant, addons: list[AddonInfo], padding_size: int, + decrypted_backup: str, encrypted_backup: str, ) -> None: """Test the encrypted backup streamer.""" - decrypted_backup_path = get_fixture_path( - "test_backups/c0cb53bd.tar.decrypted", DOMAIN - ) + decrypted_backup_path = get_fixture_path(decrypted_backup, DOMAIN) encrypted_backup_path = get_fixture_path(encrypted_backup, DOMAIN) backup = AgentBackup( addons=addons,