Repository navigation
test(mecatui): make template clock refresh test deterministic - #2518
Merged
Merged
Conversation
TestStatusLine_Scenario4_DebounceTemplateRefreshAndClock relied on a real 1s ticker and a 1.5s deadline. Unchanged renders are not published, so when the first tick rendered the same HH:MM:SS as the submit-time render, the refresh was dropped and the next tick missed the deadline. This flaked under -race on loaded CI runners. Split newTemplateSourceWithTicks out of newTemplateSource so the test can drive interval ticks and the submit-time clock by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
TestStatusLine_Scenario4_DebounceTemplateRefreshAndClockflaked under-racein CI (for example on the catalog-refresh PR #2517, which changed only a JSON file).The template half of the test used a real 1-second ticker with a 1.5-second deadline. The status-line source does not publish a render whose text is unchanged. When the first tick rendered the same
HH:MM:SSas the submit-time render, that refresh was dropped, and the next tick arrived after the deadline.This change splits
newTemplateSourceWithTicksout ofnewTemplateSourceso the test can send interval ticks and set the submit-time clock by hand. It now asserts exact clock values (12:00:00after submit,12:00:01after a tick) instead of "changed within 1.5s". Production behavior is unchanged.Testing
go test -race -count=50 -run TestStatusLine_Scenario4 ./cmd/mecatui/customization/: passedgo test -race ./cmd/mecatui/customization/: passedgolangci-linton the package: 0 issues🤖 Generated with Claude Code