Skip to content

test: stabilize flaky TestSleep#69879

Open
flaky-claw wants to merge 1 commit into
pingcap:masterfrom
flaky-claw:flakyfixer/case_71bd5a0334fe-a1
Open

test: stabilize flaky TestSleep#69879
flaky-claw wants to merge 1 commit into
pingcap:masterfrom
flaky-claw:flakyfixer/case_71bd5a0334fe-a1

Conversation

@flaky-claw

@flaky-claw flaky-claw commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #69825

Problem Summary:
Flaky test TestSleep in pkg/expression intermittently fails, so this PR stabilizes that path.

What changed and how does it work?

Root Cause

SLEEP(0.01) matched doSleep's 10ms polling interval, so the test sometimes observed timer/ticker ordering instead of kill preservation.

Fix

Raising the test sleep argument to 0.1 keeps the same pending-kill semantics while avoiding the equal-deadline race.

Verification

Spec:

  • target: pkg/expression :: TestSleep
  • strategy: tidb.go_flaky.default
  • plan mode: BASELINE_ONLY
  • requirements: required case must execute; no skip; repeat count = 1
  • execution surface: GO_TEST_WITH_TAGS
  • build tags: intest, deadlock
  • baseline gates: required_flaky_gate, build_safety_gate, intent_guard_gate
  • feedback surface source: baseline_only

Observed result:

  • status: passed
  • required case executed: yes
  • submission decision: ALLOWED
  • note: Required flaky case executed during validation.
    Required flaky case was not skipped.
    target-testsleep passed.
    build passed.
    lint passed.

Gate checklist:

  • target-testsleep: PASS
  • repeat-testsleep: SKIPPED
  • package-raw: SKIPPED
  • build: PASS
  • lint: PASS

Commands:

  • go test -json -tags=intest,deadlock ./pkg/expression -run '^TestSleep$' -count=1
  • make build
  • make lint

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Fixes #69825

Summary by CodeRabbit

  • Tests
    • Improved test reliability by adjusting timing in sleep-related evaluation tests.
    • Added clarification around polling intervals and deadline behavior.

@ti-chi-bot ti-chi-bot Bot added release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 16, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign windtalker for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ea45807a-a6aa-42ec-aa0f-a3f1d8082541

📥 Commits

Reviewing files that changed from the base of the PR and between 531e40c and eb61fed.

📒 Files selected for processing (1)
  • pkg/expression/evaluator_test.go

📝 Walkthrough

Walkthrough

TestSleep now uses a 0.1-second strict-model sleep and explains why it remains above the 10ms polling interval while preserving the existing kill-signal assertions.

Changes

TestSleep timing adjustment

Layer / File(s) Summary
Adjust strict-model sleep timing
pkg/expression/evaluator_test.go
The strict-model test changes the sleep duration from 0.01 to 0.1 and adds comments about avoiding polling-interval deadline ties.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested labels: approved, lgtm, ok-to-test, needs-cherry-pick-release-8.5

Poem

I’m a rabbit with timing just right,
No flaky test hops out of sight.
Ten milliseconds below,
Now longer sleeps gently flow,
While the kill signal stays in flight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the main change: stabilizing flaky TestSleep.
Description check ✅ Passed The description includes the issue link, problem summary, fix, verification, and checklist items.
Linked Issues check ✅ Passed The change directly addresses #69825 by fixing the flaky pkg/expression TestSleep case.
Out of Scope Changes check ✅ Passed The PR only changes the targeted test and related comments, with no unrelated code or scope creep.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="Running error: context loading failed: failed to load packages: failed to load packages: failed to load with go/packages: context deadline exceeded"
level=error msg="Timeout exceeded: try increasing it by passing --timeout option"


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.0029%. Comparing base (531e40c) to head (eb61fed).

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #69879        +/-   ##
================================================
- Coverage   76.3207%   74.0029%   -2.3178%     
================================================
  Files          2041       2056        +15     
  Lines        559975     578270     +18295     
================================================
+ Hits         427377     427937       +560     
- Misses       131697     150007     +18310     
+ Partials        901        326       -575     
Flag Coverage Δ
integration 40.7381% <ø> (+1.0328%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 60.4471% <ø> (ø)
parser ∅ <ø> (∅)
br 47.4060% <ø> (-15.3154%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: TestSleep in pkg/expression

1 participant