Skip to content

tests: fix broken race handler in test_funding_external_wallet_corners#9300

Open
ksedgwic wants to merge 1 commit into
ElementsProject:masterfrom
ksedgwic:fix-flaky-external-wallet-connect-assert
Open

tests: fix broken race handler in test_funding_external_wallet_corners#9300
ksedgwic wants to merge 1 commit into
ElementsProject:masterfrom
ksedgwic:fix-flaky-external-wallet-connect-assert

Conversation

@ksedgwic

@ksedgwic ksedgwic commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Observed on a CI run for #9299 (First Integration Tests 2/6):
https://github.com/ElementsProject/lightning/actions/runs/29044319311

The test anticipates the "disconnected during connection" reconnect
race (there is a FIXME comment about it) and wraps the connect in
try/except, added in d09d011. But the handler asserts the substring
against err.error, which is the whole error dict -- in on a dict
tests its keys -- so the assert fails exactly when the race it is
meant to tolerate occurs:

E  assert 'disconnected during connection' in {'code': 402,
   'message': 'disconnected during connection'}

The handler has never worked since it was introduced in 2023; the fix
matches against err.error['message'] instead, the same form the
equivalent handlers in test_plugin.py and test_misc.py already use.

d09d011 ("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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant