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

backup, simulator: Add Unit Tests For pd-backup And pd-simulator #5571

Merged
merged 1 commit into from Oct 8, 2022

Conversation

ihcsim
Copy link
Contributor

@ihcsim ihcsim commented Oct 7, 2022

What problem does this PR solve?

This PR adds unit tests to the tools/pd-backup/pdbackup and tools/pd-simulator/simulator packages, to improve their test coverage:

$ go test -cover ./tools/pd-backup/pdbackup/...                                                                                          
ok      github.com/tikv/pd/tools/pd-backup/pdbackup     0.257s  coverage: 77.8% of statements

$ go test -cover ./tools/pd-simulator/simulator/...                                                                                    
?       github.com/tikv/pd/tools/pd-simulator/simulator [no test files]
?       github.com/tikv/pd/tools/pd-simulator/simulator/cases   [no test files]
?       github.com/tikv/pd/tools/pd-simulator/simulator/info    [no test files]
ok      github.com/tikv/pd/tools/pd-simulator/simulator/simutil 0.030s  coverage: 85.5% of statements

Issue Number: ref #2290

Note:

  • I am not sure if the new tests for TestGenerateSplitKey() are sufficient. Appreciate some feedback there.
  • For ease of review, tests for tools/pd-ctl will be included in a separate PR because it will touch more files.

What is changed and how does it work?

Check List

Tests

  • Unit test

Code changes

  • Introduced unit tests

Release note

None

Signed-off-by: Ivan Sim <ihcsim@gmail.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Oct 7, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • nolouch

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@codecov
Copy link

codecov bot commented Oct 8, 2022

Codecov Report

Base: 75.48% // Head: 75.80% // Increases project coverage by +0.31% 🎉

Coverage data is based on head (6b2099a) compared to base (57dc015).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5571      +/-   ##
==========================================
+ Coverage   75.48%   75.80%   +0.31%     
==========================================
  Files         326      326              
  Lines       32259    32263       +4     
==========================================
+ Hits        24352    24456     +104     
+ Misses       5788     5714      -74     
+ Partials     2119     2093      -26     
Flag Coverage Δ
unittests 75.80% <100.00%> (+0.31%) ⬆️

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

Impacted Files Coverage Δ
server/schedule/placement/fit.go 88.50% <100.00%> (+0.27%) ⬆️
pkg/tempurl/tempurl.go 45.00% <0.00%> (-15.00%) ⬇️
server/schedulers/hot_region_v2.go 73.09% <0.00%> (-7.02%) ⬇️
server/region_syncer/server.go 82.41% <0.00%> (-4.95%) ⬇️
server/id/id.go 83.05% <0.00%> (-3.39%) ⬇️
pkg/dashboard/adapter/manager.go 79.31% <0.00%> (-2.30%) ⬇️
server/schedule/operator_controller.go 86.19% <0.00%> (-0.91%) ⬇️
server/cluster/cluster.go 83.66% <0.00%> (ø)
server/grpc_service.go 49.36% <0.00%> (+0.16%) ⬆️
server/server.go 75.44% <0.00%> (+0.37%) ⬆️
... and 14 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

LGTM! thanks for your contribution.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 8, 2022
@nolouch nolouch added the require-LGT1 Indicates that the PR requires an LGTM. label Oct 8, 2022
@nolouch
Copy link
Contributor

nolouch commented Oct 8, 2022

/merge

@ti-chi-bot
Copy link
Member

@nolouch: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

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 ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 6b2099a

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Oct 8, 2022
@ti-chi-bot ti-chi-bot merged commit c2b32e0 into tikv:master Oct 8, 2022
@ihcsim
Copy link
Contributor Author

ihcsim commented Oct 8, 2022

@nolouch Thanks for the merge. Can you label this PR with hacktoberfest-accepted so that it gets included in the ongoing Hacktoberfest event? UPDATE: the labeling is not necessary.

@ihcsim ihcsim deleted the coverage-pkg-tools branch October 8, 2022 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none require-LGT1 Indicates that the PR requires an LGTM. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants