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
add unit tests for package cli/command/secret #32289
add unit tests for package cli/command/secret #32289
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! this looks good, but there are some missing comments causing CI to fail
4e6c738
to
1771f02
Compare
Thank you for the review. I fixed the comments that were not written correctly and updated the PR. |
Looks like tests are failing @adshmh
|
a45258a
to
7c4770b
Compare
Thank you for the notification. I think it was due to using multiple labels for test objects (Secret) and the order they appeared in the output (interestingly, all unit-tests passed on my test machine all the time). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments but LGTM 👼 🐮
cli/command/secret/create_test.go
Outdated
}{ | ||
{ | ||
args: []string{"too_few"}, | ||
expectedError: "\"create\" requires exactly 2 argument(s)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a nit but I think we could even just use "requires exactly 2 argument(s)"
here 👼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review. The PR is now updated (removed references to the command name from the tests expected errors).
cli/command/secret/create_test.go
Outdated
expectedError: "\"create\" requires exactly 2 argument(s)", | ||
}, | ||
{args: []string{"too", "many", "arguments"}, | ||
expectedError: "\"create\" requires exactly 2 argument(s)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here then 😛
cli/command/secret/remove_test.go
Outdated
}{ | ||
{ | ||
args: []string{}, | ||
expectedError: "\"rm\" requires at least 1 argument(s).", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here 👼
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
7c4770b
to
243a8e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks!
This PR adds unit tests for all commands under cli/command/secret package (create, list, inspect, and remove). Part of the work on #31217
Signed-off-by: Arash Deshmeh adeshmeh@ca.ibm.com
- What I did
Added unit tests for all the commands in package cli/command/secret
- How I did it
Added unit tests and supporting code (builders + test data files in testdata directory) for all the commands in cli/command/secret package (create, ls, inspect, and remove)
- How to verify it
Run the unit tests.
There are no unit tests for the cli/command/secret package in current version (no test files)
With this PR:
$ make test-unit
...
ok github.com/docker/docker/cli/command/secret 0.069s coverage: 93.2% of statements
...
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)