pkg/ttl/ttlworker: stabilize flaky TestCancelWhileScan#67885
pkg/ttl/ttlworker: stabilize flaky TestCancelWhileScan#67885flaky-claw wants to merge 1 commit intopingcap:masterfrom
Conversation
|
@flaky-claw I've received your pull request and will start the review. I'll conduct a thorough review covering code quality, potential issues, and implementation details. ⏳ This process typically takes 10-30 minutes depending on the complexity of the changes. ℹ️ Learn more details on Pantheon AI. |
|
[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 |
|
Hi @flaky-claw. 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) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
🧹 Nitpick comments (1)
pkg/ttl/ttlworker/scan_integration_test.go (1)
37-37: Constructor swap looks fine, but note the skipped initialization.
NewTestKitWithSessionbypassesRefreshSession's"select 3"sysvar-cache priming and theMockSessionManagerregistration thatNewTestKitperforms (seepkg/testkit/testkit.golines 79–111 and 131–135). For this test that only issues DDL + inserts and then drivesDoScandirectly viadom.AdvancedSysSessionPool()(not throughtk), skipping those steps appears safe and aligns with the stated intent of minimizing scope. Worth a brief inline comment explaining why the explicit-session constructor is used here whileTestCancelWhileScanAtStatementBoundary(Line 105) keepsNewTestKit, so future readers don't "normalize" the two call sites.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/ttl/ttlworker/scan_integration_test.go` at line 37, Add a brief inline comment next to the call to NewTestKitWithSession (and/or before the tk variable) explaining that this test intentionally uses the explicit-session constructor to avoid RefreshSession's "select 3" sysvar-cache priming and MockSessionManager registration performed by NewTestKit, and that this is safe because the test performs only DDL/inserts and calls DoScan via dom.AdvancedSysSessionPool() rather than tk; mention that TestCancelWhileScanAtStatementBoundary still uses NewTestKit to preserve the full session initialization for that scenario.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@pkg/ttl/ttlworker/scan_integration_test.go`:
- Line 37: Add a brief inline comment next to the call to NewTestKitWithSession
(and/or before the tk variable) explaining that this test intentionally uses the
explicit-session constructor to avoid RefreshSession's "select 3" sysvar-cache
priming and MockSessionManager registration performed by NewTestKit, and that
this is safe because the test performs only DDL/inserts and calls DoScan via
dom.AdvancedSysSessionPool() rather than tk; mention that
TestCancelWhileScanAtStatementBoundary still uses NewTestKit to preserve the
full session initialization for that scenario.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 56f18886-f45a-480d-871c-b767332460d6
📒 Files selected for processing (1)
pkg/ttl/ttlworker/scan_integration_test.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #67885 +/- ##
================================================
- Coverage 77.7969% 77.4536% -0.3434%
================================================
Files 1983 1966 -17
Lines 548948 549947 +999
================================================
- Hits 427065 425954 -1111
- Misses 120962 123991 +3029
+ Partials 921 2 -919
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/retest |
|
@yinsustart: 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. |
| func TestCancelWhileScan(t *testing.T) { | ||
| store, dom := testkit.CreateMockStoreAndDomain(t) | ||
| tk := testkit.NewTestKit(t, store) | ||
| tk := testkit.NewTestKitWithSession(t, store, testkit.NewSession(t, store)) |
There was a problem hiding this comment.
I don't understand how this change will stablize the test. It also doesn't match the PR description.
What problem does this PR solve?
Issue Number: close #66982
Problem Summary:
Flaky test
TestCancelWhileScaninpkg/ttl/ttlworkerintermittently fails, so this PR stabilizes that path.What changed and how does it work?
Root Cause
TestCancelWhileScanwas using the defaulttestkit.NewTestKit(...)constructor, which goes through the standard TestKit session initialization path. For this test, that setup can introduce instability in how the case is initialized.Fix
This PR replaces
testkit.NewTestKit(...)withtestkit.NewTestKitWithSession(t, store, testkit.NewSession(t, store))inTestCancelWhileScan.No other test logic is changed. The fix is limited to the test setup so the case runs with an explicitly created session instead of the default constructor path.
Verification
Spec:
pkg/ttl/ttlworker :: TestCancelWhileScantidb.go_flaky.defaultBASELINE_ONLYObserved result:
Gate checklist:
Commands:
go test -json ./pkg/ttl/ttlworker -run '^TestCancelWhileScan$' -count=1go test -json ./pkg/ttl/ttlworker -count=1make buildCheck List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
Fixes #66982
Summary by CodeRabbit