backup: restore default filename lightningd.sqlite3

This commit is contained in:
Michael Schmoock
2020-11-30 15:45:15 +01:00
committed by Christian Decker
parent 9591c1b31e
commit be523aa54f
2 changed files with 26 additions and 1 deletions

View File

@@ -192,6 +192,27 @@ def test_restore(node_factory, directory):
subprocess.check_call([cli_path, "restore", bdest, rdest])
def test_restore_dir(node_factory, directory):
bpath = os.path.join(directory, 'lightning-1', 'regtest')
bdest = 'file://' + os.path.join(bpath, 'backup.dbak')
os.makedirs(bpath)
subprocess.check_call([cli_path, "init", bpath, bdest])
opts = {
'plugin': plugin_path,
'allow-deprecated-apis': deprecated_apis,
}
l1 = node_factory.get_node(options=opts, cleandir=False)
l1.stop()
# should raise error without remove_existing
with pytest.raises(Exception):
subprocess.check_call([cli_path, "restore", bdest, bpath])
# but succeed when we remove the sqlite3 dbfile before
os.remove(os.path.join(bpath, "lightningd.sqlite3"))
subprocess.check_call([cli_path, "restore", bdest, bpath])
def test_warning(directory, node_factory):
bpath = os.path.join(directory, 'lightning-1', 'regtest')
bdest = 'file://' + os.path.join(bpath, 'backup.dbak')