mirror of
https://github.com/containers/podman.git
synced 2025-06-03 20:33:20 +08:00
Merge pull request #9214 from rhatdan/wait
Fix invalid wait condition on kill
This commit is contained in:
@ -233,8 +233,8 @@ func KillContainer(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
if sig == 0 || syscall.Signal(sig) == syscall.SIGKILL {
|
||||
var opts entities.WaitOptions
|
||||
if _, err := containerEngine.ContainerWait(r.Context(), []string{name}, opts); err != nil {
|
||||
if _, err := utils.WaitContainer(w, r); err != nil {
|
||||
|
||||
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
|
@ -95,6 +95,15 @@ class TestContainers(unittest.TestCase):
|
||||
top.reload()
|
||||
self.assertIn(top.status, ("stopped", "exited"))
|
||||
|
||||
def test_kill_container(self):
|
||||
top = self.client.containers.get(TestContainers.topContainerId)
|
||||
self.assertEqual(top.status, "running")
|
||||
|
||||
# Kill a running container and validate the state
|
||||
top.kill()
|
||||
top.reload()
|
||||
self.assertIn(top.status, ("stopped", "exited"))
|
||||
|
||||
def test_restart_container(self):
|
||||
# Validate the container state
|
||||
top = self.client.containers.get(TestContainers.topContainerId)
|
||||
|
Reference in New Issue
Block a user