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

Function test_sqlite_strict_mode

tests/test_db.py:664–677  ·  view source on GitHub ↗

Test that STRICT is appended to CREATE TABLE in developer mode.

(node_factory)

Source from the content-addressed store, hash-verified

662
663@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "STRICT tables are SQLite3 specific")
664def test_sqlite_strict_mode(node_factory):
665 """Test that STRICT is appended to CREATE TABLE in developer mode."""
666 l1 = node_factory.get_node(options={'developer': None})
667
668 tables = l1.db_query("SELECT name, sql FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'")
669
670 strict_tables = [t for t in tables if t['sql'] and 'STRICT' in t['sql']]
671 assert len(strict_tables) > 0, f"Expected at least one STRICT table in developer mode, found none out of {len(tables)}"
672
673 known_strict_tables = ['version', 'forwards', 'payments', 'local_anchors', 'addresses']
674 for table_name in known_strict_tables:
675 table_sql = next((t['sql'] for t in tables if t['name'] == table_name), None)
676 if table_sql:
677 assert 'STRICT' in table_sql, f"Expected table '{table_name}' to be STRICT in developer mode"
678
679
680@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "SQLite3-specific test")

Callers

nothing calls this directly

Calls 3

nextFunction · 0.85
db_queryMethod · 0.80
get_nodeMethod · 0.45

Tested by

no test coverage detected