fix(backup): trim auto-snapshots on setting the quotas

This commit is contained in:
Houkime 2023-09-08 16:22:53 +00:00
parent ad9384c850
commit 56be3d9c31
2 changed files with 6 additions and 1 deletions

View file

@ -396,6 +396,9 @@ class Backups:
) )
) )
for service in get_all_services():
Backups._prune_auto_snaps(service)
# Restoring # Restoring
@staticmethod @staticmethod

View file

@ -520,8 +520,10 @@ def test_too_many_auto(backups, dummy_service):
# Retroactivity # Retroactivity
quota.total = 1 quota.total = 1
Backups.set_autobackup_quotas(quota) Backups.set_autobackup_quotas(quota)
snap5 = Backups.back_up(dummy_service, BackupReason.AUTO) snaps = Backups.get_snapshots(dummy_service)
assert len(snaps) == 1
snap5 = Backups.back_up(dummy_service, BackupReason.AUTO)
snaps = Backups.get_snapshots(dummy_service) snaps = Backups.get_snapshots(dummy_service)
assert len(snaps) == 1 assert len(snaps) == 1
assert snap5 in snaps assert snap5 in snaps