Skip to content

Commit

Permalink
pytest: Verification mode of expanded stmts for the db_write hook
Browse files Browse the repository at this point in the history
This can be used to find instances of unparseable expanded SQL statements like
the one fixed in #4090
  • Loading branch information
cdecker authored and rustyrussell committed Oct 10, 2020
1 parent 011590b commit 7d6892a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ class LightningNode(utils.LightningNode):
def __init__(self, *args, **kwargs):
utils.LightningNode.__init__(self, *args, **kwargs)

# If we opted into checking the DB statements we will attach the dblog
# plugin before starting the node
check_dblog = os.environ.get("TEST_CHECK_DBSTMTS", None) is not None
db = os.environ.get("TEST_DB_PROVIDER", "sqlite3")
if db == 'sqlite3' and check_dblog:
dblog = os.path.join(os.path.dirname(__file__), 'plugins', 'dblog.py')
has_dblog = len([o for o in self.daemon.cmd_line if 'dblog.py' in o]) > 0
if not has_dblog:
# Add as an expanded option so we don't clobber other options.
self.daemon.opts['plugin={}'.format(dblog)] = None

# Yes, we really want to test the local development version, not
# something in out path.
self.daemon.executable = 'lightningd/lightningd'
Expand Down

0 comments on commit 7d6892a

Please sign in to comment.