Rewrite v3 time-dependent tests with testing/synctest#25
Merged
Conversation
Pull Request Test Coverage Report for Build 22014540053Details
💛 - Coveralls |
Member
|
the test rewrite looks clean, but bumping go.mod from 1.20 to 1.25 in all three modules (v1, v2, v3) seems like an oversight - that's a major minimum version jump just for test changes. v1 and v2 especially shouldn't need this since they're legacy and consumers may still be on older Go versions. since synctest is only used in test files, could you keep the go.mod versions unchanged and use a build tag instead? that way the library stays compatible with older Go while tests use synctest on 1.24+. |
eddd0f5 to
e3a0578
Compare
Use build tags to split expiry tests into two variants: - cache_expire_test.go (!go1.25): original time.Sleep-based tests - cache_expire_synctest_test.go (go1.25): deterministic synctest-based tests Bump v3/go.mod to go 1.23 (required for sync timer channels) and CI to Go 1.25 (where synctest is stable). v1 and v2 remain unchanged on go 1.20.
e3a0578 to
d93d0b8
Compare
umputun
approved these changes
Feb 15, 2026
Member
umputun
left a comment
There was a problem hiding this comment.
lgtm, thx. clean split with build tags, addresses the feedback.
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
testing/synctestfake clock in v3 expiry testscache_expire_test.go(!go1.25): originaltime.Sleep-based tests for Go < 1.25cache_expire_synctest_test.go(go1.25): deterministic synctest-based tests for Go 1.25+v3/go.modfromgo 1.20togo 1.23(required for sync timer channels used by synctest)testing/synctestis stable)go 1.20Tests rewritten (v3 only)
TestCacheWithDeleteExpiredTestCacheExpiredTestCache_GetExpirationAddresses #24