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

pd-ctl: set exit code for invalid command #3337

Merged
merged 2 commits into from
Jan 6, 2021

Conversation

mashenjun
Copy link
Contributor

Signed-off-by: Shenjun Ma mashenjun0902@gmail.com

What problem does this PR solve?

Issue Number: close #3333
Problem Summary: When under non-interactive mode, pd-ctl should exits with a non-zero code for invalid commands.

What is changed and how it works?

modify func startCmd to return error.
modify func MainStart to check the returned error and set exit code correspondingly.

Check List

Tests

  • Manual test (add detailed scripts or steps below)
  1. build pd-ctl
  2. check the exist code as follow:
./pd-ctl unknown command 
unknown command "unknown" for "pd-ctl" 
echo $? 
1

Release note

pd-ctl exits with a non-zero code for invalid commands under non-interactive mode.

Signed-off-by: Shenjun Ma <mashenjun0902@gmail.com>
@codecov
Copy link

codecov bot commented Jan 5, 2021

Codecov Report

Merging #3337 (8d1306f) into master (e23285f) will increase coverage by 0.00%.
The diff coverage is 50.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3337   +/-   ##
=======================================
  Coverage   74.75%   74.76%           
=======================================
  Files         243      243           
  Lines       23140    23134    -6     
=======================================
- Hits        17299    17296    -3     
+ Misses       4269     4266    -3     
  Partials     1572     1572           
Flag Coverage Δ
unittests 74.76% <50.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
tools/pd-ctl/pdctl/ctl.go 50.96% <50.00%> (-0.53%) ⬇️
pkg/tsoutil/tso.go 87.50% <0.00%> (-12.50%) ⬇️
server/tso/local_allocator.go 78.78% <0.00%> (-3.04%) ⬇️
server/tso/tso.go 78.61% <0.00%> (-2.52%) ⬇️
server/schedule/operator/step.go 67.44% <0.00%> (-1.67%) ⬇️
server/schedulers/utils.go 93.10% <0.00%> (-1.38%) ⬇️
server/tso/allocator_manager.go 75.45% <0.00%> (-1.21%) ⬇️
server/grpc_service.go 55.83% <0.00%> (-0.17%) ⬇️
server/server.go 72.46% <0.00%> (ø)
server/cluster/cluster.go 83.56% <0.00%> (+0.25%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e23285f...8d1306f. Read the comment docs.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 6, 2021
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jan 6, 2021
@disksing
Copy link
Contributor

disksing commented Jan 6, 2021

/merge

@ti-chi-bot
Copy link
Member

@disksing: 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/ti-community-prow repository.

@ti-chi-bot
Copy link
Member

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

Commit hash: 8d1306f

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 6, 2021
@ti-chi-bot
Copy link
Member

@mashenjun: Your PR has out-of-dated, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pd-ctl exit with 0 when it fails
5 participants