Skip to content

Commit 2050f9a

Browse files
committed
pytest: fix flake in test_setconfig_access.
We play with directory permissions, but sqlites needs that, and sometimes (due to a timer, perhaps?) it gets really upset about it: ``` lightningd-1 2025-03-16T23:29:58.506Z INFO lightningd: Server started with public key 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518, alias JUNIORBEAM-f91eb11-modded (color #0266e4) and lightningd f91eb11-modded lightningd-1 2025-03-16T23:29:58.617Z DEBUG lightningd: Adding block 101: 55af171ade598f8c4f9a494eaaffe6b9f5ea64c7b0f3b273694148adf7ad7385 lightningd-1 2025-03-16T23:29:58.752Z TRACE lightningd: Calling rpc_command hook of plugin cln-xpay lightningd-1 2025-03-16T23:29:58.764Z TRACE lightningd: Plugin cln-xpay returned from rpc_command hook call lightningd-1 2025-03-16T23:29:58.784Z TRACE lightningd: Calling rpc_command hook of plugin cln-xpay lightningd-1 2025-03-16T23:29:58.840Z TRACE lightningd: Plugin cln-xpay returned from rpc_command hook call lightningd-1 2025-03-16T23:29:58.854Z TRACE lightningd: Calling rpc_command hook of plugin cln-xpay lightningd-1 2025-03-16T23:29:58.865Z DEBUG gossipd: REPLY WIRE_GOSSIPD_NEW_BLOCKHEIGHT_REPLY with 0 fds lightningd-1 2025-03-16T23:29:58.901Z **BROKEN** lightningd: Error executing statement: db/exec.c:108: UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?: attempt to write a readonly database lightningd-1 2025-03-16T23:29:58.916Z **BROKEN** lightningd: Error executing statement: db/exec.c:108: UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?: attempt to write a readonly database lightningd-1 2025-03-16T23:29:58.941Z **BROKEN** lightningd: FATAL SIGNAL 6 (version f91eb11-modded) {'github_repository': 'ElementsProject/lightning', 'github_sha': 'f91eb118388dc1455c67d16079168fd0267ba248', 'github_ref': 'refs/pull/8112/merge', 'github_ref_name': 'HEAD', 'github_run_id': 13888173501, 'github_head_ref': 'flake-memleak', 'github_run_number': 12573, 'github_base_ref': 'master', 'github_run_attempt': '1', 'testname': 'test_setconfig_access', 'start_time': 1742167762, 'end_time': 1742167800, 'outcome': 'fail'} ----------------------------- Captured stderr call ----------------------------- Error executing statement: db/exec.c:108: UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?: attempt to write a readonly database lightningd: FATAL SIGNAL 6 (version f91eb11-modded) Log dumped in /tmp/lightning-crash.log.20250316232958 Lost connection to the RPC socket.Lost connection to the RPC socket. =========================== short test summary info ============================ FAILED tests/test_misc.py::test_setconfig_access - AssertionError: Regex pattern did not match. Regex: 'Cannot write to config file /tmp/ltests-22a5dz1j/test_setconfig_access_1/lightning-1/regtest/config' Input: "RPC call failed: method: check, payload: {'command_to_check': 'setconfig', 'config': 'min-capacity-sat', 'val': 1000000}, error: Connection to RPC server lost." ERROR tests/test_misc.py::test_setconfig_access - ValueError: Node errors: - lightningd-1: had BROKEN messages - lightningd-1: Node exited with return code -6 ``` So we move the db file for sqlite. Signed-off-by: Rusty Russell <[email protected]>
1 parent 248677d commit 2050f9a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/test_misc.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4178,11 +4178,16 @@ def test_setconfig(node_factory, bitcoind):
41784178
assert lines == ["# Created and update by setconfig, but you can edit this manually when node is stopped.", "min-capacity-sat=400000"]
41794179

41804180

4181-
def test_setconfig_access(node_factory, bitcoind):
4181+
def test_setconfig_access(node_factory, bitcoind, db_provider):
41824182
"""Test that we correctly fail (not crash) if config file/dir not writable"""
41834183

41844184
# Disable bookkeeper, with its separate db which gets upset under CI.
4185-
l1 = node_factory.get_node(options={'disable-plugin': 'bookkeeper'})
4185+
options = {'disable-plugin': 'bookkeeper'}
4186+
4187+
# sqlite3 gets upset if the directory is non-writable when it tries to commit.
4188+
if db_provider == 'sqlite3':
4189+
options['wallet'] = os.path.join(node_factory.directory, 'l1.sqlite3')
4190+
l1 = node_factory.get_node(options=options)
41864191

41874192
netconfigfile = os.path.join(l1.daemon.opts.get("lightning-dir"), TEST_NETWORK, 'config')
41884193

0 commit comments

Comments
 (0)