-
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
feature: add pouch kill functionality #1485
feature: add pouch kill functionality #1485
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1485 +/- ##
==========================================
+ Coverage 40.83% 40.85% +0.02%
==========================================
Files 254 256 +2
Lines 16601 16714 +113
==========================================
+ Hits 6779 6829 +50
- Misses 8954 9007 +53
- Partials 868 878 +10
|
apis/server/container_bridge.go
Outdated
if sigStr := req.FormValue("signal"); sigStr != "" { | ||
var err error | ||
if sig, err = signal.ParseSignal(sigStr); err != nil { | ||
return err |
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.
I think here we need to return a status code of 400 bad request. WDYT? @xiechengsheng
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.
ok, will add http 400 err here.
@@ -0,0 +1,20 @@ | |||
package client |
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 add a mock test for this API?
client/container_kill.go
Outdated
} | ||
ensureCloseReader(resp) | ||
|
||
return err |
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.
Here, please explicitly return nil
rather than return err
.
daemon/mgr/container.go
Outdated
} | ||
|
||
if sig != 0 && !signal.ValidSignalForPlatform(syscall.Signal(sig)) { | ||
return fmt.Errorf("signal: %d is not suppoerted", sig) |
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.
fmt.Errorf("signal %d is not supported", sig)
daemon/mgr/container.go
Outdated
} | ||
|
||
if !c.IsRunning() { | ||
return fmt.Errorf("container: %s is not running, can not execute kill command", c.ID) |
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.
please remove :
in the error message.
1d99e08
to
b50b084
Compare
@xiechengsheng
|
default: "SIGKILL" | ||
responses: | ||
204: | ||
description: "no 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.
You add status code 400 in code, then here we need to add 400 as well in swagger. @xiechengsheng
Signed-off-by: xiechengsheng <XIE1995@whut.edu.cn>
OK, I will fix this ASAP. |
LGTM, thank you very much for this excellent work. @xiechengsheng |
Wow, merged so quickly. 😄 |
Could we continue to push this feature? @fuweid @xiechengsheng |
Signed-off-by: xiechengsheng XIE1995@whut.edu.cn
Ⅰ. Describe what this PR did
add pouch kill functionality
Ⅱ. Does this pull request fix one issue?
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews
NONE