Skip to content

ttl: harden running-job iteration test session usage#67653

Merged
ti-chi-bot[bot] merged 5 commits intopingcap:masterfrom
zanmato1984:codex/ttl-running-job-iteration-durable-upstream
Apr 15, 2026
Merged

ttl: harden running-job iteration test session usage#67653
ti-chi-bot[bot] merged 5 commits intopingcap:masterfrom
zanmato1984:codex/ttl-running-job-iteration-durable-upstream

Conversation

@zanmato1984
Copy link
Copy Markdown
Contributor

@zanmato1984 zanmato1984 commented Apr 9, 2026

What problem does this PR solve?

Issue Number: ref #67177

Problem Summary:

TestIterationOfRunningJob can keep one test session alive across the full table loop. Under slower execution, that session may expire and cause flaky failures that are unrelated to the ownership-check behavior under test.

What changed and how does it work?

  • Extracted testIterationOfRunningJobWithTimeout(...) to centralize setup and assertions.
  • Switched from one long-lived session for the whole loop to short-lived per-iteration sessions.
  • Added a timeout-pressure subtest under TestIterationOfRunningJob to cover this path.

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

Summary by CodeRabbit

  • Tests
    • Enhanced integration test coverage with parameterized session timeout scenarios and improved test isolation.

@ti-chi-bot ti-chi-bot Bot added the release-note-none Denotes a PR that doesn't merit a release note. label Apr 9, 2026
@pantheon-ai
Copy link
Copy Markdown

pantheon-ai Bot commented Apr 9, 2026

Review Complete

Findings: 0 issues
Posted: 0
Duplicates/Skipped: 0

ℹ️ Learn more details on Pantheon AI.

@ti-chi-bot ti-chi-bot Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 9, 2026
@tiprow
Copy link
Copy Markdown

tiprow Bot commented Apr 9, 2026

Hi @zanmato1984. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Details

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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

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: 329ef957-a2ba-45db-8bf1-7658abb76f33

📥 Commits

Reviewing files that changed from the base of the PR and between de09871 and c24f182.

📒 Files selected for processing (1)
  • pkg/ttl/ttlworker/job_manager_integration_test.go

📝 Walkthrough

Walkthrough

This change refactors a TTL worker integration test by extracting TestIterationOfRunningJob into a parameterized helper function testIterationOfRunningJobWithTimeout. The test now accepts configurable session timeouts, table counts, and per-table delays while restructuring session lifecycle management within table iteration loops.

Changes

Cohort / File(s) Summary
TTL Job Manager Integration Test Refactoring
pkg/ttl/ttlworker/job_manager_integration_test.go
Extracted core test logic into parameterized helper testIterationOfRunningJobWithTimeout accepting sessionTimeout, tableCount, and sleepPerTable parameters. Reorganized session creation to occur per-table iteration and separated TableStatusCache updates into independent session calls. Updated main test to run two subtests with different timeout configurations (1 minute normal, 1 second timeout scenarios).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

size/M, ok-to-test, approved, lgtm

Suggested reviewers

  • lcwangchao
  • wjhuang2016
  • YangKeao

Poem

🐰 A test takes shape with gentle care,
Parameterized sessions everywhere,
Timeouts and tables dance in time,
Each iteration now more fine,
The TTL worker's test refine!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: hardening session usage in the running-job iteration test, which aligns with the code refactoring from single long-lived to multiple short-lived sessions.
Description check ✅ Passed The description includes the required Issue Number (ref #67177), a clear Problem Summary explaining the flaky failure issue, a concise 'What changed and how it works' section detailing the refactoring, and all relevant checklist items properly marked.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.8925%. Comparing base (e0b4e44) to head (c24f182).
⚠️ Report is 27 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #67653        +/-   ##
================================================
+ Coverage   77.5935%   77.8925%   +0.2989%     
================================================
  Files          1981       1965        -16     
  Lines        547950     552559      +4609     
================================================
+ Hits         425174     430402      +5228     
- Misses       121966     122145       +179     
+ Partials        810         12       -798     
Flag Coverage Δ
integration 41.1275% <ø> (+6.7877%) ⬆️
unit 77.1494% <ø> (+0.8061%) ⬆️

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

Components Coverage Δ
dumpling 61.5065% <ø> (ø)
parser ∅ <ø> (∅)
br 49.9172% <ø> (-10.5212%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@pantheon-ai pantheon-ai Bot left a comment

Choose a reason for hiding this comment

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

✅ Code looks good. No issues found.

@ti-chi-bot ti-chi-bot Bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 13, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Apr 14, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wjhuang2016, YangKeao

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [YangKeao,wjhuang2016]

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

@ti-chi-bot ti-chi-bot Bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 14, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Apr 14, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-04-13 06:44:32.269712865 +0000 UTC m=+1370677.475072921: ☑️ agreed by wjhuang2016.
  • 2026-04-14 02:19:54.427746518 +0000 UTC m=+1441199.633106565: ☑️ agreed by YangKeao.

@zanmato1984
Copy link
Copy Markdown
Contributor Author

/retest

@tiprow
Copy link
Copy Markdown

tiprow Bot commented Apr 14, 2026

@zanmato1984: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

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.

@zanmato1984
Copy link
Copy Markdown
Contributor Author

/retest

@tiprow
Copy link
Copy Markdown

tiprow Bot commented Apr 15, 2026

@zanmato1984: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

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.

@ti-chi-bot ti-chi-bot Bot merged commit f1434df into pingcap:master Apr 15, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants