feature(backups): stop services before restores

This commit is contained in:
Houkime 2023-07-12 16:53:49 +00:00 committed by Inex Code
parent 40ad1b5ce4
commit b001e198bf
2 changed files with 15 additions and 10 deletions

View file

@ -258,7 +258,8 @@ class Backups:
try:
Backups._assert_restorable(snapshot)
with StoppedService(service):
Backups.assert_dead(service)
if strategy == RestoreStrategy.INPLACE:
Backups._inplace_restore(service, snapshot, job)
else: # verify_before_download is our default

View file

@ -379,7 +379,11 @@ def restore_strategy(request) -> RestoreStrategy:
return RestoreStrategy.INPLACE
def test_restore_snapshot_task(backups, dummy_service, restore_strategy):
def test_restore_snapshot_task(
backups, dummy_service, restore_strategy, simulated_service_stopping_delay
):
dummy_service.set_delay(simulated_service_stopping_delay)
Backups.back_up(dummy_service)
snaps = Backups.get_snapshots(dummy_service)
assert len(snaps) == 1