-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Description
Context
In PR #9051, we implemented a shared resolver cache with TTL-based expiration. The current unit tests for TTL expiration use time.Sleep() to wait for cache entries to expire, which makes tests slower and potentially flaky.
Task
Replace the timer-based approach in TestCacheTTLExpiration with a fake clock implementation.
Current Implementation
The test currently uses:
time.Sleep(ttl + (100 * time.Millisecond))Proposed Solution
- Use the existing
fakeClocktype that's already in the cache package - Inject the fake clock into the cache instance
- Advance the clock programmatically instead of sleeping
- This will make tests faster, more deterministic, and less flaky
Files to Modify
pkg/remoteresolution/resolver/framework/cache/cache_test.go(TestCacheTTLExpiration)
References
- Original PR: feat: implement shared cache for bundle, git, and cluster resolvers #9051
- Feedback from @twoGiants requesting this improvement
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
In Progress