Skip to content

br: use random port to avoid flaky test (#65186)#70012

Open
ti-chi-bot wants to merge 2 commits into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-65186-to-release-8.5
Open

br: use random port to avoid flaky test (#65186)#70012
ti-chi-bot wants to merge 2 commits into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-65186-to-release-8.5

Conversation

@ti-chi-bot

@ti-chi-bot ti-chi-bot commented Jul 24, 2026

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #65186

What problem does this PR solve?

Issue Number: ref #65185

Problem Summary:

What changed and how does it work?

use random port to avoid flaky test

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
    • Improved test reliability by using dynamically assigned network ports.
    • Reduced failures caused by port conflicts during test execution.

Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@ti-chi-bot ti-chi-bot added 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. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Jul 24, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 24, 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 yujuncen 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 24, 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 Plus

Run ID: cb4772f3-ff82-4f42-9654-79e5f3bf798c

📥 Commits

Reviewing files that changed from the base of the PR and between 10431d8 and 3ca33f7.

📒 Files selected for processing (2)
  • br/pkg/restore/import_mode_switcher_test.go
  • br/pkg/restore/internal/import_client/import_client_test.go

📝 Walkthrough

Walkthrough

Changes

Restore test port binding

Layer / File(s) Summary
Ephemeral listener setup and address wiring
br/pkg/restore/import_mode_switcher_test.go, br/pkg/restore/internal/import_client/import_client_test.go
Both tests bind TCP servers to ephemeral ports and pass the resolved listener addresses to the fake PD store or import client. Obsolete fmt imports and fixed-port retry loops are removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a rabbit with a listener bright,
Choosing free ports in the night.
No fixed numbers to defend,
Each test finds its own endpoint.
Hop, hop—clean setups take flight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change—using a random port to reduce flaky tests—and matches the modified tests.
Description check ✅ Passed The description mostly follows the template with issue link, change summary, checklist, and release note, though Problem Summary is left blank.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


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 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release-8.5@10431d8). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-8.5     #70012   +/-   ##
================================================
  Coverage               ?   55.6645%           
================================================
  Files                  ?       1849           
  Lines                  ?     666288           
  Branches               ?          0           
================================================
  Hits                   ?     370886           
  Misses                 ?     267806           
  Partials               ?      27596           
Flag Coverage Δ
integration 39.1478% <ø> (?)
unit 65.1937% <ø> (?)

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

Components Coverage Δ
dumpling 55.3108% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 63.0565% <0.0000%> (?)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ti-chi-bot ti-chi-bot Bot added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick-approved Cherry pick PR approved by release team. 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. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants