Skip to content

tests: fix flaky reckless tests by waiting for the canned github server#9306

Open
ksedgwic wants to merge 1 commit into
ElementsProject:masterfrom
ksedgwic:fix-flaky-reckless-server-race
Open

tests: fix flaky reckless tests by waiting for the canned github server#9306
ksedgwic wants to merge 1 commit into
ElementsProject:masterfrom
ksedgwic:fix-flaky-reckless-server-race

Conversation

@ksedgwic

Copy link
Copy Markdown
Collaborator

Observed on a CI run for #9286 (Valgrind Test CLN 1/12, test_search):
https://github.com/ElementsProject/lightning/actions/runs/29122024616/job/86461830290

The canned_github_server fixture starts a Flask server with Popen and
never waits for it to listen; the git repository setup between the
Popen and the yield usually gives it enough time. Under CI load it
can lose that race: in the failure above, test_search's first
reckless invocation got connection refused within a second of the
test starting, and Flask's "Running on http://127.0.0.1:39495"
banner only appears in the log after the test had already failed
(so the server did come up and bind its port -- just too late).

The fix waits for the port to accept connections before yielding, and
fails loudly if the server process dies instead of coming up.

Changelog-None

The canned_github_server fixture Popens a Flask server and never
waits for it to start listening; the git repository setup between the
Popen and the yield usually gives it enough time.  Under CI load it
can lose that race: a valgrind-shard failure shows test_search's
first reckless invocation getting connection refused within a second
of the test starting, while Flask's "Running on http://127.0.0.1:..."
banner only appears in the log after the test had already failed.

Wait for the port to accept connections before yielding, and fail
loudly if the server process dies instead of coming up.

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