Skip to content

pkg/resourcegroup/tests: stabilize runaway watch assertion - #68023

Merged
ti-chi-bot[bot] merged 1 commit into
pingcap:masterfrom
zanmato1984:fix/runaway-watch-test-determinism
May 9, 2026
Merged

ti-chi-bot[bot] merged 1 commit into
pingcap:masterfrom
zanmato1984:fix/runaway-watch-test-determinism

Conversation

@zanmato1984

@zanmato1984 zanmato1984 commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #66977

Problem Summary:

TestResourceGroupRunaway asserts rows in mysql.tidb_runaway_watch. The watch records are flushed asynchronously, and on loaded CI workers the expected watch row may not be visible immediately after the runaway query returns, causing occasional empty reads.

What changed and how does it work?

  • Switch the immediate MustQuery(...tidb_runaway_watch).Check(...) to EventuallyMustQueryAndCheck(...) to wait until the watch row becomes visible.
  • Keep the existing "eventually cleaned up" assertion to ensure the watch row is removed in a bounded time.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Release note

None

@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked 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 Apr 24, 2026
@tiprow

tiprow Bot commented Apr 24, 2026

Copy link
Copy Markdown

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

coderabbitai Bot commented Apr 24, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

A test modification converts synchronous to eventual assertion in TestResourceGroupRunaway to handle timing variability where resource group runaway watch rows may not be visible immediately after query execution.

Changes

Cohort / File(s) Summary
Test Timing Fix
pkg/resourcegroup/tests/resource_group_test.go
Changed assertion of mysql.tidb_runaway_watch.watch_text for rg2 from immediate single query to retry-based EventuallyMustQueryAndCheck to accommodate timing variability in watch row visibility.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • pingcap/tidb#67316: Modifies the same test to improve stability by adjusting resource-group setup and ALTER sequence.
  • pingcap/tidb#67691: Addresses timing-related flakiness in the same test by adjusting failpoint timing and GC retention thresholds.

Suggested labels

size/S, approved, lgtm

Suggested reviewers

  • wjhuang2016
  • YangKeao
  • xhebox
  • bb7133

Poem

🐰 A watch that waits, no rush, no haste,
EventuallyMustQueryAndCheck saves the day,
No more timing flakes to chase—
The runaway test can now relax, hooray! ⏱️✨

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: stabilizing a test assertion for the runaway watch feature by using eventual consistency checking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description follows the required template structure with clear issue reference, problem summary, change explanation, and test checklist.

✏️ 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

codecov Bot commented Apr 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.9132%. Comparing base (25fa27a) to head (0423561).
⚠️ Report is 56 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #68023        +/-   ##
================================================
- Coverage   77.7682%   76.9132%   -0.8550%     
================================================
  Files          1990       1973        -17     
  Lines        551467     558563      +7096     
================================================
+ Hits         428866     429609       +743     
- Misses       121681     128560      +6879     
+ Partials        920        394       -526     
Flag Coverage Δ
integration 42.0594% <ø> (+2.2622%) ⬆️

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

Components Coverage Δ
dumpling 60.4888% <ø> (ø)
parser ∅ <ø> (∅)
br 50.0561% <ø> (-13.0316%) ⬇️
🚀 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.

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

@YangKeao YangKeao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot

ti-chi-bot Bot commented May 9, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xhebox, 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:

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 May 9, 2026
@ti-chi-bot

ti-chi-bot Bot commented May 9, 2026

Copy link
Copy Markdown

[LGTM Timeline notifier]

Timeline:

  • 2026-04-28 02:37:54.027480753 +0000 UTC m=+2651879.232840810: ☑️ agreed by xhebox.
  • 2026-05-09 07:03:11.340905173 +0000 UTC m=+510464.214255155: ☑️ agreed by YangKeao.

@tiprow

tiprow Bot commented May 9, 2026

Copy link
Copy Markdown

@zanmato1984: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
fast_test_tiprow 0423561 link true /test fast_test_tiprow

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@zanmato1984

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented May 9, 2026

Copy link
Copy Markdown

@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

/test

@ti-chi-bot

ti-chi-bot Bot commented May 9, 2026

Copy link
Copy Markdown

@zanmato1984: The /test command needs one or more targets.
The following commands are available to trigger required jobs:

/test build
/test check-dev
/test check-dev2
/test mysql-test
/test pull-br-integration-test
/test pull-build-next-gen
/test pull-integration-e2e-test
/test pull-integration-realcluster-test-next-gen
/test pull-lightning-integration-test
/test pull-mysql-client-test
/test pull-mysql-client-test-next-gen
/test pull-unit-test-ddlv1
/test pull-unit-test-next-gen
/test unit-test

The following commands are available to trigger optional jobs:

/test pingcap/tidb/canary_ghpr_unit_test
/test pull-br-integration-test-next-gen
/test pull-check-deps
/test pull-common-test
/test pull-e2e-test
/test pull-error-log-review
/test pull-integration-common-test
/test pull-integration-copr-test
/test pull-integration-ddl-test
/test pull-integration-ddl-test-next-gen
/test pull-integration-e2e-test-next-gen
/test pull-integration-jdbc-test
/test pull-integration-mysql-test
/test pull-integration-nodejs-test
/test pull-integration-python-orm-test
/test pull-mysql-test-next-gen
/test pull-sqllogic-test
/test pull-tiflash-integration-test

Use /test all to run the following jobs that were automatically triggered:

pingcap/tidb/ghpr_build
pingcap/tidb/ghpr_check
pingcap/tidb/ghpr_check2
pingcap/tidb/ghpr_mysql_test
pingcap/tidb/ghpr_unit_test
pingcap/tidb/pull_build_next_gen
pingcap/tidb/pull_integration_e2e_test
pingcap/tidb/pull_integration_realcluster_test_next_gen
pingcap/tidb/pull_mysql_client_test
pingcap/tidb/pull_mysql_client_test_next_gen
pingcap/tidb/pull_unit_test_next_gen
pull-check-deps
pull-error-log-review
Details

In response to this:

/test

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.

@tiprow

tiprow Bot commented May 9, 2026

Copy link
Copy Markdown

@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:

/test

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 f4c94d9 into pingcap:master May 9, 2026
34 of 35 checks passed
yongman pushed a commit to yongman/tidb that referenced this pull request Jun 3, 2026
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/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: TestResourceGroupRunaway in pkg/resourcegroup/tests

3 participants