mirror of
https://github.com/containers/podman.git
synced 2025-06-17 06:57:43 +08:00
podman-remote stop -time 0 does not work
This patch will allow users to pass in the time 0. Currently the timeout will take 10 seconds if user passes in the 0 flag. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -39,11 +39,11 @@ func StopContainer(w http.ResponseWriter, r *http.Request) {
|
|||||||
Ignore: query.Ignore,
|
Ignore: query.Ignore,
|
||||||
}
|
}
|
||||||
if utils.IsLibpodRequest(r) {
|
if utils.IsLibpodRequest(r) {
|
||||||
if query.LibpodTimeout > 0 {
|
if _, found := r.URL.Query()["timeout"]; found {
|
||||||
options.Timeout = &query.LibpodTimeout
|
options.Timeout = &query.LibpodTimeout
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if query.DockerTimeout > 0 {
|
if _, found := r.URL.Query()["t"]; found {
|
||||||
options.Timeout = &query.DockerTimeout
|
options.Timeout = &query.DockerTimeout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ var _ = Describe("Podman stop", func() {
|
|||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"stop", "--time", "1", "test4"})
|
session = podmanTest.Podman([]string{"stop", "--time", "0", "test4"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
output := session.OutputToString()
|
output := session.OutputToString()
|
||||||
@ -166,7 +166,7 @@ var _ = Describe("Podman stop", func() {
|
|||||||
session := podmanTest.Podman([]string{"run", "-d", "--name", "test5", ALPINE, "sleep", "100"})
|
session := podmanTest.Podman([]string{"run", "-d", "--name", "test5", ALPINE, "sleep", "100"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
session = podmanTest.Podman([]string{"stop", "--timeout", "1", "test5"})
|
session = podmanTest.Podman([]string{"stop", "--timeout", "0", "test5"})
|
||||||
// Without timeout container stops in 10 seconds
|
// Without timeout container stops in 10 seconds
|
||||||
// If not stopped in 5 seconds, then --timeout did not work
|
// If not stopped in 5 seconds, then --timeout did not work
|
||||||
session.Wait(5)
|
session.Wait(5)
|
||||||
|
Reference in New Issue
Block a user