tests: fix flaky reckless tests by waiting for the canned github server#9306
Open
ksedgwic wants to merge 1 commit into
Open
tests: fix flaky reckless tests by waiting for the canned github server#9306ksedgwic wants to merge 1 commit into
ksedgwic wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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