Skip to content

Fix flaky tests in result caches#7366

Merged
yeya24 merged 1 commit intocortexproject:masterfrom
SungJin1212:Fix-flaky-result-cache
Mar 23, 2026
Merged

Fix flaky tests in result caches#7366
yeya24 merged 1 commit intocortexproject:masterfrom
SungJin1212:Fix-flaky-result-cache

Conversation

@SungJin1212
Copy link
Member

@SungJin1212 SungJin1212 commented Mar 23, 2026

This PR fixes the flakiness of the TestResultsCachePutTTLSelection and TestExtentsOverlapOutOfOrderWindow by injecting the now function.

Related Test Fail Log

--- FAIL: TestExtentsOverlapOutOfOrderWindow (0.00s)
    --- FAIL: TestExtentsOverlapOutOfOrderWindow/extent_ends_exactly_at_cutoff_boundary_-_overlaps_(boundary_case) (0.00s)
        results_cache_test.go:1860: 
            	Error Trace:	/__w/cortex/cortex/pkg/querier/tripperware/queryrange/results_cache_test.go:1860
            	Error:      	Not equal: 
            	            	expected: true
            	            	actual  : false
            	Test:       	TestExtentsOverlapOutOfOrderWindow/extent_ends_exactly_at_cutoff_boundary_-_overlaps_(boundary_case)
FAIL
--- FAIL: TestResultsCachePutTTLSelection (0.00s)
    --- FAIL: TestResultsCachePutTTLSelection/recent_data_uses_out_of_order_results_cache_ttl (0.00s)
        results_cache_test.go:1951: 
            	Error Trace:	/__w/cortex/cortex/pkg/querier/tripperware/queryrange/results_cache_test.go:1951
            	Error:      	Not equal: 
            	            	expected: 5m0s
            	            	actual  : 24h0m0s
            	Test:       	TestResultsCachePutTTLSelection/recent_data_uses_out_of_order_results_cache_ttl
FAIL

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks for the fix!

@yeya24 yeya24 merged commit 25e8d7b into cortexproject:master Mar 23, 2026
60 of 65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants