Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: update cluster_id to a global variable #8615

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

okJiang
Copy link
Member

@okJiang okJiang commented Sep 11, 2024

What problem does this PR solve?

Issue Number: Close #8588

What is changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test

Release note

None.

Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
Copy link
Contributor

ti-chi-bot bot commented Sep 11, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has signed the dco. labels Sep 11, 2024
Copy link
Contributor

ti-chi-bot bot commented Sep 11, 2024

[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 bufferflies for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

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 the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 11, 2024
Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 55.26316% with 204 lines in your changes missing coverage. Please review.

Project coverage is 77.67%. Comparing base (f6ec3f3) to head (eea7162).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8615      +/-   ##
==========================================
+ Coverage   77.55%   77.67%   +0.11%     
==========================================
  Files         474      475       +1     
  Lines       61893    61899       +6     
==========================================
+ Hits        48003    48077      +74     
+ Misses      10342    10281      -61     
+ Partials     3548     3541       -7     
Flag Coverage Δ
unittests 77.67% <55.26%> (+0.11%) ⬆️

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

@okJiang okJiang marked this pull request as ready for review September 12, 2024 03:22
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 12, 2024
Signed-off-by: okJiang <819421878@qq.com>
@@ -156,25 +156,6 @@ func TestEtcdKVPutWithTTL(t *testing.T) {
re.Equal(int64(0), resp.Count)
}

func TestInitClusterID(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to add a similiar test in utils/keypath?

Copy link
Member Author

@okJiang okJiang Sep 13, 2024

Choose a reason for hiding this comment

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

It has been move to pkg/storage/endpoint/cluster_id_test.go. The path can be discussed.

@@ -62,7 +62,6 @@ func TestSimpleJoin(t *testing.T) {
members, err = etcdutil.ListEtcdMembers(ctx, client)
re.NoError(err)
re.Len(members.Members, 2)
re.Equal(pd1.GetClusterID(), pd2.GetClusterID())
Copy link
Contributor

Choose a reason for hiding this comment

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

why not check it?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is difficult to use ut to test two PD instance's clusterID. In fact, we have test it in pkg/storage/endpoint/cluster_id_test.go, InitClusterID twice and check the two clusterID is same. TestClientClusterIDCheck is the same reason. I plan to add a real_cluster_test to test them.

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to pkg/utils/keypath

@@ -156,25 +156,6 @@ func TestEtcdKVPutWithTTL(t *testing.T) {
re.Equal(int64(0), resp.Count)
}

func TestInitClusterID(t *testing.T) {
Copy link
Member Author

@okJiang okJiang Sep 13, 2024

Choose a reason for hiding this comment

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

It has been move to pkg/storage/endpoint/cluster_id_test.go. The path can be discussed.

@@ -62,7 +62,6 @@ func TestSimpleJoin(t *testing.T) {
members, err = etcdutil.ListEtcdMembers(ctx, client)
re.NoError(err)
re.Len(members.Members, 2)
re.Equal(pd1.GetClusterID(), pd2.GetClusterID())
Copy link
Member Author

Choose a reason for hiding this comment

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

It is difficult to use ut to test two PD instance's clusterID. In fact, we have test it in pkg/storage/endpoint/cluster_id_test.go, InitClusterID twice and check the two clusterID is same. TestClientClusterIDCheck is the same reason. I plan to add a real_cluster_test to test them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has signed the dco. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ClusterID has been saved in too many places
2 participants