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

Function test_db_hook_multiple

tests/test_plugin.py:642–667  ·  view source on GitHub ↗

This tests the db hook for multiple-plugin case.

(node_factory, executor)

Source from the content-addressed store, hash-verified

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