feature(backup): reload snapshots when migrating

This commit is contained in:
Houkime 2024-07-29 10:33:46 +00:00
parent a4a70c07d3
commit bb493e6b74
2 changed files with 8 additions and 7 deletions

View file

@ -75,6 +75,7 @@ class BackupMutations:
secret = repository.local_secret
if secret is not None:
LocalBackupSecret.set(secret)
Backups.force_snapshot_cache_reload()
else:
Backups.init_repo()
return GenericBackupConfigReturn(

View file

@ -446,19 +446,19 @@ def test_migrate(authorized_client, dummy_service, tmpdir, backups):
# Reinit
response = api_init(
authorized_client,
configuration["provider"],
"",
"",
configuration["locationName"],
configuration["locationId"],
configuration["encryptionKey"],
kind=configuration["provider"],
login="", # user provides login and password, configuration endpoint does not
password="", # empty for file based repository
location_name=configuration["locationName"],
location_id=configuration["locationId"],
local_secret=configuration["encryptionKey"],
)
data = get_data(response)["backup"]["initializeRepository"]
assert_ok(data)
assert data["configuration"] == configuration
new_configuration = api_settings(authorized_client)
assert new_configuration == configuration
api_reload_snapshots(authorized_client)
snaps = api_snapshots(authorized_client)
assert len(snaps) == 1