-
Notifications
You must be signed in to change notification settings - Fork 949
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: refactor the cli stop test #2372
test: refactor the cli stop test #2372
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2372 +/- ##
==========================================
+ Coverage 66.82% 68.27% +1.44%
==========================================
Files 265 265
Lines 18211 18211
==========================================
+ Hits 12169 12433 +264
+ Misses 4637 4355 -282
- Partials 1405 1423 +18
|
0228aac
to
63009bd
Compare
test/utils.go
Outdated
format := fmt.Sprintf("{{%s}}", filter) | ||
result := command.PouchRun("inspect", "-f", format, name) | ||
if result.Error != nil || result.ExitCode != 0 { | ||
return "", fmt.Errorf("failed to inspect %s: %s", name, result.Combined()) |
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.
could you update the error message to insert more info about filter? @ZYecho
like fmt.Errorf("failed to inspect container %s via filter %s: %s", name, filter, result.Combined())
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.
done.
@@ -95,3 +97,12 @@ func IsTLSExist() bool { | |||
} | |||
return true | |||
} | |||
|
|||
func inspectFilter(name, filter string) (string, error) { |
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.
This encapsulated function looks so good to me. 😄 🌹 🍻
How about adding a comment for this function to tell others that, no matter what kind of filter input, the result will be translated into a type of string. This is different from the original way that using unmarshal way will get the real type of construct filed.
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.
done.
This is really what we need in pouchcontainer's test. Thanks a lot for your contribution. @ZYecho |
I search all the test case file, and I found that there are more than 10 times to appear We could replace those codes with |
Thanks for your imformation. |
Signed-off-by: zhangyue <[email protected]>
63009bd
to
799051d
Compare
@allencloud Sometimes the cri test in CI may fail, could you help to check this? |
It is an existing issue of PouchContainer. However it will hardly influence user's experience on PouchContainer. @ZYecho |
LGTM. Thanks again. I am merging this. |
Signed-off-by: zhangyue [email protected]
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
None.
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
None.
Ⅳ. Describe how to verify it
go test -gocheck.f PouchStopSuite
Ⅴ. Special notes for reviews
None.