mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-26 14:01:30 +00:00
feature(backups): stop services before restores
This commit is contained in:
parent
40ad1b5ce4
commit
b001e198bf
|
@ -258,7 +258,8 @@ class Backups:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
Backups._assert_restorable(snapshot)
|
Backups._assert_restorable(snapshot)
|
||||||
|
with StoppedService(service):
|
||||||
|
Backups.assert_dead(service)
|
||||||
if strategy == RestoreStrategy.INPLACE:
|
if strategy == RestoreStrategy.INPLACE:
|
||||||
Backups._inplace_restore(service, snapshot, job)
|
Backups._inplace_restore(service, snapshot, job)
|
||||||
else: # verify_before_download is our default
|
else: # verify_before_download is our default
|
||||||
|
|
|
@ -379,7 +379,11 @@ def restore_strategy(request) -> RestoreStrategy:
|
||||||
return RestoreStrategy.INPLACE
|
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)
|
Backups.back_up(dummy_service)
|
||||||
snaps = Backups.get_snapshots(dummy_service)
|
snaps = Backups.get_snapshots(dummy_service)
|
||||||
assert len(snaps) == 1
|
assert len(snaps) == 1
|
||||||
|
|
Loading…
Reference in a new issue