Repository navigation
pkg/server: restore stats lease in TestInitStatsSessionBlockGC - #67206
ti-chi-bot[bot] merged 1 commit into
Conversation
|
Review Complete Findings: 0 issues ℹ️ Learn more details on Pantheon AI. |
|
Hi @jiong-nba. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
📝 WalkthroughWalkthroughThe test Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Pull request overview
This PR makes pkg/server’s TestInitStatsSessionBlockGC self-contained by preventing it from inheriting a process-global “stats lease disabled” setting left behind by earlier tests (notably via testkit.CreateMockStoreAndDomain() / session.DisableStats4Test()).
Changes:
- Save the current global stats lease at the start of
TestInitStatsSessionBlockGC. - Force the stats lease to
3sfor the duration of the test to ensure the expected init-stats behavior. - Restore the original stats lease via
deferafter the test completes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
YangKeao
left a comment
There was a problem hiding this comment.
It might be better to modify DisableStats4Test or bootstrap to restore the stats lease for tests.
But this solution is also acceptable, as most of the tests are using bootstrap.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #67206 +/- ##
================================================
+ Coverage 77.7649% 77.8202% +0.0553%
================================================
Files 2019 1942 -77
Lines 553441 545394 -8047
================================================
- Hits 430383 424427 -5956
+ Misses 121316 120955 -361
+ Partials 1742 12 -1730
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
0xPoe
left a comment
There was a problem hiding this comment.
Thanks! ![]()
/hold
Please resolve all CI failures.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 0xPoe, YangKeao The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
@jiong-nba: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
@jiong-nba: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
|
/retest |
1 similar comment
|
/retest |
|
/unhold |
…independent The new TestStmtSendLongDataMemQuotaQuery uses testkit.CreateMockStoreAndDomain, which calls session.DisableStats4Test and leaves the process-global stats lease at -1. TestInitStatsSessionBlockGC then no longer blocks GC as expected when the two tests share a test shard. Reset the lease explicitly (adapted from pingcap#67206, which fixed this on master).
…independent The new TestStmtSendLongDataMemQuotaQuery uses testkit.CreateMockStoreAndDomain, which calls session.DisableStats4Test and leaves the process-global stats lease at -1. TestInitStatsSessionBlockGC then no longer blocks GC as expected when the two tests share a test shard. Reset the lease explicitly (adapted from pingcap#67206, which fixed this on master).
Reset the stats lease required by TestInitStatsSessionBlockGC after earlier tests disable it globally. Adapted from upstream pingcap#67206 (64ac12f) using this release branch session.SetStatsLease API. Signed-off-by: bb7133 <bb7133@gmail.com>
What problem does this PR solve?
Issue Number: close #67228
Problem Summary:
TestInitStatsSessionBlockGCcan fail when a previous test in the samepkg/servertest binary has calledtestkit.CreateMockStoreAndDomain(). That helper disables stats globally by setting the process-wide stats lease to-1, so the init-stats code path no longer blocks GC as this test expects.What changed and how does it work?
This PR makes
TestInitStatsSessionBlockGCsave the current stats lease, set it to3sfor the duration of the test, and restore the original value afterward. That keeps the test self-contained even when earlier tests leave the global stats lease disabled.Check List
Tests
Unit test commands:
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
Summary by CodeRabbit