Flaky unit tests: stabilize task register, TLS, and memory limit tuner
Open
component/br
severity/minor
type/bug
type/bugfix
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
### Summary
Some unit tests are flaky due to timing assumptions and shared global state.
### Symptoms
- `br/pkg/utils`: `TestTaskRegisterFailedGrant` / `TestTaskRegisterFailedReput` rely on fixed sleeps while etcd lease keepalive/retry is asynchronous.
- `pkg/util/gctuner`: `TestIssue48741` assumes `debug.SetMemoryLimit` updates are immediate.
- `pkg/util`: `TestVerifyCommonNameAndRotate` depends on unstable client-side TLS error strings and uses the global `http.DefaultServeMux`.
### Expected
Make these tests stable without changing production behavior.
Contributor guide
Assessment
This issue has not been assessed yet.