MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_db_hook_multiple

Function test_db_hook_multiple

tests/test_plugin.py:641–666  ·  view source on GitHub ↗

This tests the db hook for multiple-plugin case.

(node_factory, executor)

Source from the content-addressed store, hash-verified

639
640@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "Only sqlite3 implements the db_write_hook currently")
641def test_db_hook_multiple(node_factory, executor):
642 """This tests the db hook for multiple-plugin case."""
643 dbfile = os.path.join(node_factory.directory, "dblog.sqlite3")
644 l1 = node_factory.get_node(options={**BWATCH_OPTS,
645 'plugin': os.path.join(os.getcwd(), 'tests/plugins/dblog.py'),
646 'important-plugin': os.path.join(os.getcwd(), 'tests/plugins/dbdummy.py'),
647 'dblog-file': dbfile})
648
649 # It should see the db being created, and sometime later actually get
650 # initted.
651 # This precedes startup, so needle already past
652 assert l1.daemon.is_in_log(r'plugin-dblog.py: deferring \d+ commands')
653 l1.daemon.logsearch_start = 0
654 l1.daemon.wait_for_log('plugin-dblog.py: replaying pre-init data:')
655 l1.daemon.wait_for_log('plugin-dblog.py: CREATE TABLE version \\(version INTEGER\\)')
656 l1.daemon.wait_for_log("plugin-dblog.py: initialized.* 'startup': True")
657
658 wait_bwatch_caught_up(l1)
659
660 l1.stop()
661
662 # Databases should be identical.
663 db1 = sqlite3.connect(os.path.join(l1.daemon.lightning_dir, TEST_NETWORK, 'lightningd.sqlite3'))
664 db2 = sqlite3.connect(dbfile)
665
666 assert [x for x in db1.iterdump()] == [x for x in db2.iterdump()]
667
668
669def test_utf8_passthrough(node_factory, executor):

Callers

nothing calls this directly

Calls 7

wait_bwatch_caught_upFunction · 0.85
joinMethod · 0.80
is_in_logMethod · 0.80
wait_for_logMethod · 0.80
get_nodeMethod · 0.45
stopMethod · 0.45
connectMethod · 0.45

Tested by

no test coverage detected