Repository navigation
test: run logmq tests on a fake clock - #1168
Merged
Merged
Conversation
leggetter
approved these changes
Oct 27, 2026
|
|
||
| // Wait until the delivery is actually blocked inside the sink. | ||
| synctest.Wait() | ||
| require.True(t, h.sink.inflightSends() >= 1) |
Collaborator
There was a problem hiding this comment.
Nit: the old Eventually here had the message "the slow delivery should reach the sink". require.GreaterOrEqual(t, h.sink.inflightSends(), 1, "...") would keep it and print the actual count on failure. Same for :88 and characterization_postprocess_test.go:39, which also lost their messages, and the other require.True(... >= n) checks would get the count too.
Collaborator
Author
There was a problem hiding this comment.
Thanks, updated. All six now use GreaterOrEqual, with the old messages restored where they had one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alexluong
force-pushed
the
test/fake-clock-logmq
branch
from
October 29, 2026 12:23
98d21e2 to
bc80c58
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.
Run the logmq tests on a fake clock. Based on #1162.
The logmq tests waited real time for batch delays and emit timeouts: fixed 200 ms sleeps for a batch to flush, and
require.Eventuallypolls for sends, evaluations and acks to land. Now they run inside asynctestbubble, with Redis fromtestutil.NewSynctestRediswhere they need it, so those waits cost nothing and the checks no longer depend on CPU load.The package now runs in under 1 s.
batchprocessor_test.go: the tests run in a bubble, exceptTestMessageHandler_NacksAfterShutdown, which has no waits. The 200 ms sleeps that waited for a flush becomesynctest.Wait().require.Eventuallypolls becomesynctest.Wait()plus a direct assert.waitTerminalsteps the fake clock 1 ms at a time until every message is acked or nacked, so batch delays and emit timeouts elapse without real waiting.waitBlockedreturns once a send is parked on the blocking sink, with no poll.Assertions are kept; some are stricter. A flush asserted after
synctest.Wait()has to happen without the clock moving, where the 200 ms sleep allowed up to 200 ms.TestRedisSuppressionWindow_InFlightCallerSkipsWithoutWaitingasserts zero elapsed time instead of under 100 ms.The package was stress-tested with repeated runs, plain, with
-race, and with-cpu=1,2and-shuffle=on.🤖 Generated with Claude Code