diff --git a/backup/backup.py b/backup/backup.py index 555fa8a..34d82a3 100755 --- a/backup/backup.py +++ b/backup/backup.py @@ -10,6 +10,7 @@ import os import struct import sys import sqlite3 +import time plugin = Plugin() @@ -252,6 +253,7 @@ def get_backend(destination, create=False, require_init=False): def abort(reason: str) -> None: plugin.log(reason) + time.sleep(1) plugin.rpc.stop() raise ValueError() diff --git a/backup/test_backup.py b/backup/test_backup.py index 4a490f9..2846a8a 100644 --- a/backup/test_backup.py +++ b/backup/test_backup.py @@ -177,16 +177,24 @@ def test_failing_restore(nf, directory): 'plugin': plugin_path, 'backup-destination': bdest, } + + def section(comment): + print("="*25, comment, "="*25) + + section("Starting node for the first time") l1 = nf.get_node(options=opts, cleandir=False) l1.stop() # Now fudge the data_version: + section("Simulating a restore of an old version") l1.db.execute("UPDATE vars SET intval = intval - 2 WHERE name = 'data_version'") + section("Restarting node, should fail") with pytest.raises(Exception): l1.start() l1.daemon.proc.wait() + section("Verifying the node died with an error") assert(l1.daemon.is_in_log(r'lost some state') is not None)