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

test: add test for clone unmarshal #8308

Merged
merged 2 commits into from
Jun 19, 2024
Merged

Conversation

HuSharp
Copy link
Member

@HuSharp HuSharp commented Jun 19, 2024

What problem does this PR solve?

Issue Number: Ref #4399

What is changed and how does it work?

issue relies on
76b4932#diff-5cf563058fdae91ee59093d5721fde21b45888669570a5fdfd54bbe502ce3e03L93-L95

We have this logic for clone

pd/client/http/types.go

Lines 366 to 373 in 13174b5

// Clone returns a copy of Rule.
func (r *Rule) Clone() *Rule {
var clone Rule
_ = json.Unmarshal([]byte(r.String()), &clone)
clone.StartKey = append(r.StartKey[:0:0], r.StartKey...)
clone.EndKey = append(r.EndKey[:0:0], r.EndKey...)
return &clone
}

This is because startKey is json:"-" which means cannot be Unmarshal from json, We need to take care of Clone method.

pd/client/http/types.go

Lines 346 to 349 in 13174b5

StartKey []byte `json:"-"` // range start key
StartKeyHex string `json:"start_key"` // hex format start key, for marshal/unmarshal
EndKey []byte `json:"-"` // range end key
EndKeyHex string `json:"end_key"` // hex format end key, for marshal/unmarshal

Check List

Tests

  • Unit test

Release note

None.

Signed-off-by: husharp <[email protected]>
@HuSharp HuSharp requested review from JmPotato and rleungx June 19, 2024 04:45
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. labels Jun 19, 2024
@HuSharp
Copy link
Member Author

HuSharp commented Jun 19, 2024

@okJiang PTAL, thx!

@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 19, 2024
Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.28%. Comparing base (cb28ca8) to head (9f8de24).

Current head 9f8de24 differs from pull request most recent head 6f56dbc

Please upload reports for the commit 6f56dbc to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8308      +/-   ##
==========================================
- Coverage   77.41%   77.28%   -0.14%     
==========================================
  Files         470      470              
  Lines       61324    61392      +68     
==========================================
- Hits        47473    47445      -28     
- Misses      10287    10387     +100     
+ Partials     3564     3560       -4     
Flag Coverage Δ
unittests 77.28% <ø> (-0.14%) ⬇️

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

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jun 19, 2024
@ti-chi-bot ti-chi-bot bot added the lgtm label Jun 19, 2024
Copy link
Contributor

ti-chi-bot bot commented Jun 19, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JmPotato, rleungx

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

The pull request process is described 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 removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jun 19, 2024
Copy link
Contributor

ti-chi-bot bot commented Jun 19, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-06-19 05:37:18.928141822 +0000 UTC m=+179565.413630650: ☑️ agreed by rleungx.
  • 2024-06-19 05:42:38.974927818 +0000 UTC m=+179885.460416650: ☑️ agreed by JmPotato.

Copy link
Contributor

ti-chi-bot bot commented Jun 19, 2024

@HuSharp: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-integration-realcluster-test 6f56dbc link false /test pull-integration-realcluster-test

Full PR test history. Your PR dashboard.

Instructions 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/test-infra repository. I understand the commands that are listed here.

@ti-chi-bot ti-chi-bot bot merged commit fbd6bd2 into tikv:master Jun 19, 2024
16 of 17 checks passed
@HuSharp HuSharp deleted the add_rukle_key_test branch June 19, 2024 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants