This tests the db hook for multiple-plugin case.
(node_factory, executor)
| 639 | |
| 640 | @unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "Only sqlite3 implements the db_write_hook currently") |
| 641 | def 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 | |
| 669 | def test_utf8_passthrough(node_factory, executor): |
nothing calls this directly
no test coverage detected