pytest: test db upgrade.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2019-09-06 16:10:28 +09:30 committed by Christian Decker
parent 91dcd1d55a
commit 714e7fb670
3 changed files with 14 additions and 1 deletions

Binary file not shown.

View File

@ -1,5 +1,7 @@
from fixtures import * # noqa: F401,F403
from utils import wait_for, sync_blockheight
from utils import wait_for, sync_blockheight, COMPAT
import unittest
def test_db_dangling_peer_fix(node_factory):
@ -111,3 +113,13 @@ def test_max_channel_id(node_factory, bitcoind):
# Fundchannel again, should succeed.
l1.rpc.fundchannel(l2.info['id'], 10**5)
@unittest.skipIf(not COMPAT, "needs COMPAT to convert obsolete db")
def test_scid_upgrade(node_factory):
# Created through the power of sed "s/X'\([0-9]*\)78\([0-9]*\)78\([0-9]*\)'/X'\13A\23A\3'/"
l1 = node_factory.get_node(dbfile='oldstyle-scids.sqlite3.xz')
assert l1.db_query('SELECT short_channel_id from channels;') == [{'short_channel_id': '103x1x1'}]
assert l1.db_query('SELECT failchannel from payments;') == [{'failchannel': '103x1x1'}]

View File

@ -42,6 +42,7 @@ EXPERIMENTAL_FEATURES = os.getenv("EXPERIMENTAL_FEATURES", config['EXPERIMENTAL_
TIMEOUT = int(os.getenv("TIMEOUT", "60"))
VALGRIND = os.getenv("VALGRIND", config['VALGRIND']) == "1"
SLOW_MACHINE = os.getenv("SLOW_MACHINE", "0") == "1"
COMPAT = os.getenv("COMPAT", config['COMPAT']) == "1"
def wait_for(success, timeout=TIMEOUT):