server/cluster/cluster.go: some pub functions(tests only) are hard to maintain, make it private and use failpoint instead
Open
good first issue
type/enhancement
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 783
- Avg merge
- 5d 21h
- Merged PRs (30d)
- 36
Description
## Enhancement Task
It seems the function `InitCluster` needn't to be public, with making it public, the caller should care about too many conditions which also makes the lib hard to maintain.
[https://github.com/tikv/pd/blob/56a015c32925022cda9c803830c058916ca02d38/server/cluster/cluster.go#L217-L228](https://github.com/tikv/pd/blob/56a015c32925022cda9c803830c058916ca02d38/server/cluster/cluster.go#L217-L228)
It seems this function need to be public because we want to use it in the tests, maybe we could use `failpoint` instead.
Meanwhile, the function `LoadClusterInfo` have the same problem.
Contributor guide
Assessment
This issue has not been assessed yet.