test: stabilize flaky TestTTLStatusCache/last_job_finish_time#69635
test: stabilize flaky TestTTLStatusCache/last_job_finish_time#69635flaky-claw wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
📝 WalkthroughWalkthroughModified TestTTLStatusCache in pkg/ttl/cache/ttlstatus_test.go to delete existing rows from mysql.tidb_ttl_table_status before each subtest's insert, fixed the expected cache count to 1 per subtest, and added a nil guard before asserting the retrieved table's fields. ChangesTTL status cache test fix
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #69635 +/- ##
================================================
- Coverage 76.3268% 74.1105% -2.2164%
================================================
Files 2041 2050 +9
Lines 560589 576524 +15935
================================================
- Hits 427880 427265 -615
- Misses 131808 149053 +17245
+ Partials 901 206 -695
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
What problem does this PR solve?
Issue Number: close #69619
Problem Summary:
Flaky test
TestTTLStatusCache/last_job_finish_timeinpkg/ttl/cacheintermittently fails, so this PR stabilizes that path.What changed and how does it work?
Root Cause
TestTTLStatusCacheusedCreateMockStoreAndDomain, which starts the background TTL job manager in the test environment. After the TTL manager becomes leader, it may immediately runDoGC().The subtests in
TestTTLStatusCacheinsert temporary rows intomysql.tidb_ttl_table_statusand previously relied on rows from earlier subtests remaining in the table. However, those rows havecurrent_job_status IS NULL, so they can be removed by the background TTL table-status GC during the test.As a result, later subtests may observe fewer rows than expected, making the original cumulative assertion (
len(isc.Tables) == index+1) flaky.Fix
Clearing the TTL status table inside each field subtest makes each field extraction case self-contained.
Verification
Spec:
pkg/ttl/cache :: TestTTLStatusCache/last_job_finish_timetidb.issue_scoped.v2BASELINE_ONLYGO_TEST_WITH_TAGSintest, deadlockbaseline_onlyObserved result:
Required flaky case was not skipped.
target_flaky_validation passed.
package_validation passed.
Gate checklist:
Commands:
go test -json -tags=intest,deadlock ./pkg/ttl/cache -run '^TestTTLStatusCache/last_job_finish_time$' -count=1go test -json -tags=intest,deadlock ./pkg/ttl/cache -count=1Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
Fixes #69619
Summary by CodeRabbit