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 secret = repository.local_secret
if secret is not None: if secret is not None:
LocalBackupSecret.set(secret) LocalBackupSecret.set(secret)
Backups.force_snapshot_cache_reload()
else: else:
Backups.init_repo() Backups.init_repo()
return GenericBackupConfigReturn( return GenericBackupConfigReturn(

View file

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