summaryrefslogtreecommitdiff
path: root/pkg/bindings/pods/pods.go
diff options
context:
space:
mode:
authorSujil02 <sushah@redhat.com>2020-02-14 16:35:08 -0500
committerSujil02 <sushah@redhat.com>2020-02-19 16:05:27 -0500
commit3db43dcce3479b73b023dee1798a69bc78b15fb8 (patch)
treefcac2f31d99a3f8c95dc10a343c3d5e994015c39 /pkg/bindings/pods/pods.go
parent931eb1b58314d3385ab48601cb2cc3bd0c371196 (diff)
downloadpodman-3db43dcce3479b73b023dee1798a69bc78b15fb8.tar.gz
podman-3db43dcce3479b73b023dee1798a69bc78b15fb8.tar.bz2
podman-3db43dcce3479b73b023dee1798a69bc78b15fb8.zip
Add test to validate the pod bindings api
Include test to validate pod create, start, stop, restart, pause, unpause, list, and inspect api bindings. Also includes bug fixes that resulted in invalid api responses. Signed-off-by: Sujil02 <sushah@redhat.com>
Diffstat (limited to 'pkg/bindings/pods/pods.go')
-rw-r--r--pkg/bindings/pods/pods.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/pkg/bindings/pods/pods.go b/pkg/bindings/pods/pods.go
index d079f01c2..69d7f21bc 100644
--- a/pkg/bindings/pods/pods.go
+++ b/pkg/bindings/pods/pods.go
@@ -87,9 +87,9 @@ func Prune(ctx context.Context) error {
// List returns all pods in local storage. The optional filters parameter can
// be used to refine which pods should be listed.
-func List(ctx context.Context, filters map[string][]string) (*[]libpod.PodInspect, error) {
+func List(ctx context.Context, filters map[string][]string) ([]*libpod.PodInspect, error) {
var (
- inspect []libpod.PodInspect
+ inspect []*libpod.PodInspect
)
conn, err := bindings.GetConnectionFromContext(ctx)
if err != nil {
@@ -103,11 +103,11 @@ func List(ctx context.Context, filters map[string][]string) (*[]libpod.PodInspec
}
params["filters"] = stringFilter
}
- response, err := conn.DoRequest(nil, http.MethodPost, "/pods/json", params)
+ response, err := conn.DoRequest(nil, http.MethodGet, "/pods/json", params)
if err != nil {
- return &inspect, err
+ return inspect, err
}
- return &inspect, response.Process(&inspect)
+ return inspect, response.Process(&inspect)
}
// Restart restarts all containers in a pod.
@@ -147,7 +147,7 @@ func Start(ctx context.Context, nameOrID string) error {
if err != nil {
return err
}
- response, err := conn.DoRequest(nil, http.MethodDelete, "/pods/%s/start", nil, nameOrID)
+ response, err := conn.DoRequest(nil, http.MethodPost, "/pods/%s/start", nil, nameOrID)
if err != nil {
return err
}