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 ut to test the input when creating evict-leader scheduler #8768

Merged
merged 3 commits into from
Nov 7, 2024

Conversation

okJiang
Copy link
Member

@okJiang okJiang commented Nov 4, 2024

What problem does this PR solve?

Issue Number: Ref #4399

What is changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test

Release note

None.

Signed-off-by: okJiang <[email protected]>
@ti-chi-bot ti-chi-bot bot added 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/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 4, 2024
Signed-off-by: okJiang <[email protected]>
@okJiang
Copy link
Member Author

okJiang commented Nov 4, 2024

/retest

Copy link

codecov bot commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.64%. Comparing base (b19cec5) to head (fc5d03e).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8768      +/-   ##
==========================================
- Coverage   75.75%   75.64%   -0.12%     
==========================================
  Files         461      461              
  Lines       72293    72298       +5     
==========================================
- Hits        54767    54687      -80     
- Misses      14028    14112      +84     
- Partials     3498     3499       +1     
Flag Coverage Δ
unittests 75.64% <100.00%> (-0.12%) ⬇️

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

@okJiang
Copy link
Member Author

okJiang commented Nov 5, 2024

/retest

@@ -113,11 +113,16 @@ func (h *schedulerHandler) CreateScheduler(w http.ResponseWriter, r *http.Reques
return
}
case types.GrantLeaderScheduler, types.EvictLeaderScheduler:
storeID, ok := input["store_id"].(float64)
_, ok := input["store_id"]
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Member Author

@okJiang okJiang Nov 5, 2024

Choose a reason for hiding this comment

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

_, ok := input["store_id"] represents the input("store_id") doesn't exist.

storeID, ok := input["store_id"].(float64) represents the input("store_id") can not be convert to float.

So I split them to report different error messages.

Copy link
Member

Choose a reason for hiding this comment

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

Is it necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we can put it here. It won't be bad at all.

@okJiang
Copy link
Member Author

okJiang commented Nov 6, 2024

/cc @lhy1024

@ti-chi-bot ti-chi-bot bot requested a review from lhy1024 November 6, 2024 07:09
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Nov 6, 2024
@ti-chi-bot ti-chi-bot bot added the lgtm label Nov 7, 2024
Copy link
Contributor

ti-chi-bot bot commented Nov 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nolouch, 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 Nov 7, 2024
Copy link
Contributor

ti-chi-bot bot commented Nov 7, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-06 08:30:39.712172517 +0000 UTC m=+1029752.551328048: ☑️ agreed by rleungx.
  • 2024-11-07 08:09:13.954589838 +0000 UTC m=+1114866.793745379: ☑️ agreed by nolouch.

@ti-chi-bot ti-chi-bot bot merged commit 39575d2 into tikv:master Nov 7, 2024
25 checks passed
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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants