Wait for polling queries in logging tests instead of sleeping - #775
Open
wintan1418 wants to merge 1 commit into
Open
Wait for polling queries in logging tests instead of sleeping#775wintan1418 wants to merge 1 commit into
wintan1418 wants to merge 1 commit into
Conversation
wintan1418
force-pushed
the
wait-for-polling-queries-in-logging-tests
branch
from
July 30, 2026 11:47
fd082c3 to
9951627
Compare
The "polling queries are logged" tests started a worker/dispatcher and slept for a fixed window before asserting the polling SELECT showed up in the log. On a slow CI runner, process boot (registration, pool startup) can eat the whole window before the first poll runs, failing the test. Poll the captured log for the expected query with a timeout instead: as fast as before in the common case, and robust when the runner is slow. Related to rails#602
wintan1418
force-pushed
the
wait-for-polling-queries-in-logging-tests
branch
from
July 30, 2026 11:59
9951627 to
8b5f383
Compare
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.
Related to #602
Problem
The "polling queries are logged" tests in
WorkerTestandDispatcherTeststart a worker/dispatcher and sleep for a fixed window (0.2s / 0.5s) before asserting that the pollingSELECTshows up in the captured log. On a slow CI runner, process boot (DB registration, pool startup) can eat the whole window before the first poll executes, so the log only contains the processINSERTand the assertion fails.Example failure from a recent CI run (MySQL job):
Fix
Poll the captured log for the expected query with
wait_while_with_timeout(3 seconds) instead of a flat sleep. The tests remain as fast as before in the common case — the wait returns as soon as the query appears — and become robust when the runner is slow. On timeout, the existing assertion still runs and reports the log contents.