Skip to content

Comments

add unit test for cli#274

Merged
shizhMSFT merged 2 commits intonotaryproject:mainfrom
chloeyin:cobra-cli
Aug 10, 2022
Merged

add unit test for cli#274
shizhMSFT merged 2 commits intonotaryproject:mainfrom
chloeyin:cobra-cli

Conversation

@chloeyin
Copy link
Contributor

Signed-off-by: zaihaoyin zaihaoyin@microsoft.com

This PR adds unit test for some cli commands, only to make sure the flags are parsed correctly.
This is the last PR of the whole series(#255).

Signed-off-by: zaihaoyin <zaihaoyin@microsoft.com>
@codecov-commenter
Copy link

codecov-commenter commented Jul 29, 2022

Codecov Report

Merging #274 (eebbd39) into main (1f858d0) will decrease coverage by 20.62%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             main     #274       +/-   ##
===========================================
- Coverage   50.00%   29.37%   -20.63%     
===========================================
  Files          11       27       +16     
  Lines         344     1685     +1341     
===========================================
+ Hits          172      495      +323     
- Misses        164     1176     +1012     
- Partials        8       14        +6     
Impacted Files Coverage Δ
cmd/notation/plugin.go 0.00% <0.00%> (ø)
cmd/notation/push.go 24.61% <0.00%> (ø)
cmd/notation/manifest.go 0.00% <0.00%> (ø)
cmd/notation/logout.go 54.16% <0.00%> (ø)
cmd/notation/registry.go 0.00% <0.00%> (ø)
cmd/notation/common.go 100.00% <0.00%> (ø)
cmd/notation/verify.go 19.00% <0.00%> (ø)
cmd/notation/main.go 0.00% <0.00%> (ø)
cmd/notation/key.go 23.52% <0.00%> (ø)
cmd/notation/sign.go 29.88% <0.00%> (ø)
... and 6 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@JeyJeyGao
Copy link
Contributor

LGTM

@binbin-li
Copy link
Contributor

Left some tiny comments. Just wanna raise some questions out of scope.

  1. Looks like in this PR we focus on the main use cases, successful case and a common failed case which should cover most of cases. But users can fail a command in a lot ways (a combination of flags or args). It's kind of time-wasting to test all of them, just wanna confirm we would do the same to the new PRs. @shizhMSFT
  2. This PR tests the conversion from command input to the internal Opts object. For the business logics after it, is there a good way to test it? Maybe just run cmd.ParseFlags() like this PR does? Or move the logics to other places for easier testing?

Signed-off-by: zaihaoyin <zaihaoyin@microsoft.com>
@binbin-li
Copy link
Contributor

lgtm overall

@dtzar dtzar requested a review from a team August 3, 2022 00:12
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

LGTM

@shizhMSFT
Copy link
Contributor

Left some tiny comments. Just wanna raise some questions out of scope.

  1. Looks like in this PR we focus on the main use cases, successful case and a common failed case which should cover most of cases. But users can fail a command in a lot ways (a combination of flags or args). It's kind of time-wasting to test all of them, just wanna confirm we would do the same to the new PRs. @shizhMSFT
  2. This PR tests the conversion from command input to the internal Opts object. For the business logics after it, is there a good way to test it? Maybe just run cmd.ParseFlags() like this PR does? Or move the logics to other places for easier testing?

We are still figuring out a better way to test CLI.

@shizhMSFT shizhMSFT merged commit 3ced0c9 into notaryproject:main Aug 10, 2022
7h3-3mp7y-m4n pushed a commit to 7h3-3mp7y-m4n/notation that referenced this pull request Mar 29, 2025
Signed-off-by: zaihaoyin <zaihaoyin@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants