server/join: add unit and integration test coverage#10977
Conversation
Add server/join/join_test.go with white-box unit tests for the two previously untested code paths: - TestIsDataExist: covers all three branches of the isDataExist helper (non-existent directory, empty directory, directory with content). - TestPrepareJoinClusterEmptyJoin: verifies the no-op path when Join is empty (new initial leader). - TestPrepareJoinClusterJoinSelf: verifies the 'join self is forbidden' guard. - TestPrepareJoinClusterWithExistingDataDir: verifies that when the member data directory already has content the function sets InitialCluster to "" and InitialClusterState to "existing" without dialling the join address. Also add TestJoinWithAbnormalExistingMember to the existing integration test suite (tests/server/join/join_test.go). It exercises the error path where the member list contains an entry with an empty Name (a node that completed MemberAdd but never started) whose peer URLs differ from those of the new PD attempting to join. Issue Number: ref tikv#2288 Co-Authored-By: Oz <oz-agent@warp.dev> Signed-off-by: Jiale Lin <ljluestc@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Hi @ljluestc. Thanks for your PR. I'm waiting for a tikv member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
Add server/join/join_test.go with white-box unit tests for the two previously untested code paths:
Also add TestJoinWithAbnormalExistingMember to the existing integration test suite (tests/server/join/join_test.go). It exercises the error path where the member list contains an entry with an empty Name (a node that completed MemberAdd but never started) whose peer URLs differ from those of the new PD attempting to join.
Issue Number: ref #2288
What problem does this PR solve?
Issue Number: Close #xxx
What is changed and how does it work?
Check List
Tests
Code changes
Side effects
Related changes
pingcap/docs/pingcap/docs-cn:pingcap/tiup:Release note