From 9d39bd46356b8a82d5819e82644eb03bf95e7ee5 Mon Sep 17 00:00:00 2001 From: Ken Sedgwick Date: Thu, 9 Jul 2026 14:53:15 -0700 Subject: [PATCH] tests: fix broken race handler in test_funding_external_wallet_corners d09d0112f ("pytest: handle v fast disconnect during test_funding_external_wallet_corners()") wrapped the reconnect in try/except to tolerate the "disconnected during connection" race, but the assert checks the substring against err.error, which is the whole error dict ({'code': 402, 'message': ...}). `in` on a dict tests its keys, so the assert fails exactly when the race it is meant to tolerate occurs. Seen in CI, where connect raised code 402 and the handler itself then asserted: E assert 'disconnected during connection' in {'code': 402, 'message': 'disconnected during connection'} Match against err.error['message'] instead, as the equivalent handlers in test_plugin.py and test_misc.py already do. Changelog-None --- tests/test_connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_connection.py b/tests/test_connection.py index 4ea408c06e67..4fc965e4c502 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -1378,7 +1378,7 @@ def test_funding_external_wallet_corners(node_factory, bitcoind): try: l1.rpc.connect(l2.info['id'], 'localhost', l2.port) except RpcError as err: - assert "disconnected during connection" in err.error + assert "disconnected during connection" in err.error['message'] l1.daemon.wait_for_log('Responded to reestablish for long-closed channel') wait_for(lambda: len(l1.rpc.listpeers()['peers']) == 0)