mirror of
https://github.com/containers/podman.git
synced 2025-06-26 04:46:57 +08:00
V2 verify JSON output is consistent and doesn't drift
$ cd test/apiv2 $ python -m unittest -v test_rest_v1_0_0.TestApi Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
package compat
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/containers/libpod/libpod"
|
||||
"github.com/containers/libpod/libpod/define"
|
||||
"github.com/containers/libpod/pkg/api/handlers/utils"
|
||||
"github.com/gorilla/schema"
|
||||
"github.com/pkg/errors"
|
||||
@ -43,6 +45,14 @@ func ResizeTTY(w http.ResponseWriter, r *http.Request) {
|
||||
utils.ContainerNotFound(w, name, err)
|
||||
return
|
||||
}
|
||||
if state, err := ctnr.State(); err != nil {
|
||||
utils.InternalServerError(w, errors.Wrapf(err, "cannot obtain container state"))
|
||||
return
|
||||
} else if state != define.ContainerStateRunning {
|
||||
utils.Error(w, "Container not running", http.StatusConflict,
|
||||
fmt.Errorf("container %q in wrong state %q", name, state.String()))
|
||||
return
|
||||
}
|
||||
if err := ctnr.AttachResize(sz); err != nil {
|
||||
utils.InternalServerError(w, errors.Wrapf(err, "cannot resize container"))
|
||||
return
|
||||
@ -56,6 +66,14 @@ func ResizeTTY(w http.ResponseWriter, r *http.Request) {
|
||||
utils.SessionNotFound(w, name, err)
|
||||
return
|
||||
}
|
||||
if state, err := ctnr.State(); err != nil {
|
||||
utils.InternalServerError(w, errors.Wrapf(err, "cannot obtain session container state"))
|
||||
return
|
||||
} else if state != define.ContainerStateRunning {
|
||||
utils.Error(w, "Container not running", http.StatusConflict,
|
||||
fmt.Errorf("container %q in wrong state %q", name, state.String()))
|
||||
return
|
||||
}
|
||||
if err := ctnr.ExecResize(name, sz); err != nil {
|
||||
utils.InternalServerError(w, errors.Wrapf(err, "cannot resize session"))
|
||||
return
|
||||
|
Reference in New Issue
Block a user