etcdctl: refactor global flags management and simplify command initialization #21230
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: <a href="https://github.com/etcd-io/etcd/pull/21230#" title="Author self-approved">hwdef</a>
Once this PR has been reviewed and has the lgtm label, please assign ahrtr for approval. For more information see the Code Review Process.
The full list of commands accepted by this bot can be found here.
<details open>
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
</details>
<!-- META={"approvers":["ahrtr"]} -->
Codecov Report
:x: Patch coverage is
0% with 52 lines in your changes missing coverage. Please review.:white_check_mark: Project coverage is 68.39%. Comparing base (
36972d6) to head (fc8bef4).:warning: Report is 721 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| etcdctl/ctlv3/command/global.go | 0.00% | 46 Missing :warning: |
| etcdctl/ctlv3/command/util.go | 0.00% | 2 Missing :warning: |
| etcdctl/ctlv3/ctl.go | 0.00% | 2 Missing :warning: |
| etcdctl/ctlv3/command/diagnosis\_command.go | 0.00% | 1 Missing :warning: |
| etcdctl/ctlv3/command/ep\_command.go | 0.00% | 1 Missing :warning: |
<details><summary>Additional details and impacted files</summary>
| Files with missing lines | Coverage Δ | |
|---|---|---|
| etcdctl/ctlv3/command/diagnosis\_command.go | 0.00% <0.00%> (ø) | |
| etcdctl/ctlv3/command/ep\_command.go | 0.00% <0.00%> (ø) | |
| etcdctl/ctlv3/command/util.go | 7.29% <0.00%> (+7.29%) | :arrow_up: |
| etcdctl/ctlv3/ctl.go | 0.00% <0.00%> (ø) | |
| etcdctl/ctlv3/command/global.go | 0.00% <0.00%> (ø) | |
... and 53 files with indirect coverage changes
@@ Coverage Diff @@
## main #21230 +/- ##
==========================================
- Coverage 68.45% 68.39% -0.06%
==========================================
Files 429 428 -1
Lines 35288 35292 +4
==========================================
- Hits 24156 24139 -17
- Misses 9746 9754 +8
- Partials 1386 1399 +13
------
Continue to review full report in Codecov by Harness.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered by Codecov. Last update 36972d6...fc8bef4. Read the comment docs.
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
</details>
cc @siyuanfoundation
Is this needed for the refactor? I think it is only related to the fake client testing. Let's focus on the refactor only in this PR.
Is this needed for the refactor? I think it is only related to the fake client testing. Let's focus on the refactor only in this PR.
@siyuanfoundation Thanks for your replay. I have deleted the unnecessary code.
Overall I think the PR looks good. And not using GlobalFlags is beneficial for future changes of adding a cmd based on fake client.
@hwdef Can you squash the commits?
Thank you for your reply. I have already squashed the commits.
PR needs rebase.
<details>
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-sigs/prow repository.
</details>
Hi @siyuanfoundation , I wanted to work on this issue: https://github.com/etcd-io/etcd/issues/20171 and came across this PR while exploring it. I can see that this PR is ready to be merged but went stale (not sure of the reason). Can we merge this PR and I can start working on rest of the pieces?
If we need to continue with this PR, I can rebase the master to resolve the conflicts.
@hwdef if you want I can cherry-pick your commits and use them (if you don't plan to work on it)? This way I won't be taking credit for your commits
I suggest waiting for the reviewer's response; otherwise, submitting a pull request will be pointless.
What would be our stance on exported structs in the CLI? Should we consider deprecation rather than removal?
I don't see a reason to hold this up or reassign. We only need a rebase, and I would like to clear up the question I left.
I believe it should go via the deprecation path, but I would rely on @hwdef @siyuanfoundation for a decision here
siyuanfoundation
hwdef
This PR is a part of: https://github.com/etcd-io/etcd/pull/20270
It prepares for subsequent unit testing.