2014-12-31 01:22:31 +03:00
|
|
|
// +build !test_no_exec
|
|
|
|
|
2014-12-01 20:16:49 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
2015-07-02 09:57:44 +03:00
|
|
|
"encoding/json"
|
2014-12-01 20:16:49 +03:00
|
|
|
"fmt"
|
2017-02-28 19:12:30 +03:00
|
|
|
"io/ioutil"
|
2015-04-21 00:03:56 +03:00
|
|
|
"net/http"
|
2016-01-15 19:57:23 +03:00
|
|
|
"time"
|
2015-04-18 19:46:47 +03:00
|
|
|
|
2017-05-24 06:56:26 +03:00
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
"github.com/docker/docker/client"
|
2016-12-30 20:23:00 +03:00
|
|
|
"github.com/docker/docker/integration-cli/checker"
|
2016-12-30 12:49:36 +03:00
|
|
|
"github.com/docker/docker/integration-cli/request"
|
2015-04-18 19:46:47 +03:00
|
|
|
"github.com/go-check/check"
|
2017-05-24 06:56:26 +03:00
|
|
|
"golang.org/x/net/context"
|
2014-12-01 20:16:49 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// Regression test for #9414
|
[nit] integration-cli: obey Go's naming convention
No substantial code change.
- Api --> API
- Cli --> CLI
- Http, Https --> HTTP, HTTPS
- Id --> ID
- Uid,Gid,Pid --> UID,PID,PID
- Ipam --> IPAM
- Tls --> TLS (TestDaemonNoTlsCliTlsVerifyWithEnv --> TestDaemonTLSVerifyIssue13964)
Didn't touch in this commit:
- Git: because it is officially "Git": https://git-scm.com/
- Tar: because it is officially "Tar": https://www.gnu.org/software/tar/
- Cpu, Nat, Mac, Ipc, Shm: for keeping a consistency with existing production code (not changable, for compatibility)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-09-28 04:50:12 +03:00
|
|
|
func (s *DockerSuite) TestExecAPICreateNoCmd(c *check.C) {
|
2014-12-01 20:16:49 +03:00
|
|
|
name := "exec_test"
|
2015-07-14 09:35:36 +03:00
|
|
|
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
2014-12-01 20:16:49 +03:00
|
|
|
|
2017-05-24 06:56:26 +03:00
|
|
|
res, body, err := request.Post(fmt.Sprintf("/containers/%s/exec", name), request.JSONBody(map[string]interface{}{"Cmd": nil}))
|
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
c.Assert(res.StatusCode, checker.Equals, http.StatusBadRequest)
|
|
|
|
|
|
|
|
b, err := request.ReadBody(body)
|
2015-11-20 10:03:34 +03:00
|
|
|
c.Assert(err, checker.IsNil)
|
2015-04-21 00:03:56 +03:00
|
|
|
|
2015-11-20 10:03:34 +03:00
|
|
|
comment := check.Commentf("Expected message when creating exec command with no Cmd specified")
|
2017-05-24 06:56:26 +03:00
|
|
|
c.Assert(getErrorMessage(c, b), checker.Contains, "No exec command specified", comment)
|
2014-12-01 20:16:49 +03:00
|
|
|
}
|
2015-07-02 09:57:44 +03:00
|
|
|
|
[nit] integration-cli: obey Go's naming convention
No substantial code change.
- Api --> API
- Cli --> CLI
- Http, Https --> HTTP, HTTPS
- Id --> ID
- Uid,Gid,Pid --> UID,PID,PID
- Ipam --> IPAM
- Tls --> TLS (TestDaemonNoTlsCliTlsVerifyWithEnv --> TestDaemonTLSVerifyIssue13964)
Didn't touch in this commit:
- Git: because it is officially "Git": https://git-scm.com/
- Tar: because it is officially "Tar": https://www.gnu.org/software/tar/
- Cpu, Nat, Mac, Ipc, Shm: for keeping a consistency with existing production code (not changable, for compatibility)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-09-28 04:50:12 +03:00
|
|
|
func (s *DockerSuite) TestExecAPICreateNoValidContentType(c *check.C) {
|
2015-07-02 09:57:44 +03:00
|
|
|
name := "exec_test"
|
|
|
|
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
|
|
|
|
|
|
|
jsonData := bytes.NewBuffer(nil)
|
|
|
|
if err := json.NewEncoder(jsonData).Encode(map[string]interface{}{"Cmd": nil}); err != nil {
|
|
|
|
c.Fatalf("Can not encode data to json %s", err)
|
|
|
|
}
|
|
|
|
|
2017-03-06 18:35:27 +03:00
|
|
|
res, body, err := request.Post(fmt.Sprintf("/containers/%s/exec", name), request.RawContent(ioutil.NopCloser(jsonData)), request.ContentType("test/plain"))
|
2015-11-20 10:03:34 +03:00
|
|
|
c.Assert(err, checker.IsNil)
|
2017-07-19 17:20:13 +03:00
|
|
|
c.Assert(res.StatusCode, checker.Equals, http.StatusBadRequest)
|
2015-07-02 09:57:44 +03:00
|
|
|
|
2017-08-22 01:50:40 +03:00
|
|
|
b, err := request.ReadBody(body)
|
2015-11-20 10:03:34 +03:00
|
|
|
c.Assert(err, checker.IsNil)
|
2015-07-02 09:57:44 +03:00
|
|
|
|
2015-11-20 10:03:34 +03:00
|
|
|
comment := check.Commentf("Expected message when creating exec command with invalid Content-Type specified")
|
2016-05-21 14:56:04 +03:00
|
|
|
c.Assert(getErrorMessage(c, b), checker.Contains, "Content-Type specified", comment)
|
2015-07-02 09:57:44 +03:00
|
|
|
}
|
2015-09-12 05:50:21 +03:00
|
|
|
|
[nit] integration-cli: obey Go's naming convention
No substantial code change.
- Api --> API
- Cli --> CLI
- Http, Https --> HTTP, HTTPS
- Id --> ID
- Uid,Gid,Pid --> UID,PID,PID
- Ipam --> IPAM
- Tls --> TLS (TestDaemonNoTlsCliTlsVerifyWithEnv --> TestDaemonTLSVerifyIssue13964)
Didn't touch in this commit:
- Git: because it is officially "Git": https://git-scm.com/
- Tar: because it is officially "Tar": https://www.gnu.org/software/tar/
- Cpu, Nat, Mac, Ipc, Shm: for keeping a consistency with existing production code (not changable, for compatibility)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-09-28 04:50:12 +03:00
|
|
|
func (s *DockerSuite) TestExecAPICreateContainerPaused(c *check.C) {
|
2016-01-29 03:26:06 +03:00
|
|
|
// Not relevant on Windows as Windows containers cannot be paused
|
2015-11-19 08:51:26 +03:00
|
|
|
testRequires(c, DaemonIsLinux)
|
|
|
|
name := "exec_create_test"
|
|
|
|
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
|
|
|
|
|
|
|
dockerCmd(c, "pause", name)
|
2017-05-24 06:56:26 +03:00
|
|
|
|
|
|
|
cli, err := client.NewEnvClient()
|
2015-11-20 10:03:34 +03:00
|
|
|
c.Assert(err, checker.IsNil)
|
2017-05-24 06:56:26 +03:00
|
|
|
defer cli.Close()
|
|
|
|
|
|
|
|
config := types.ExecConfig{
|
|
|
|
Cmd: []string{"true"},
|
|
|
|
}
|
|
|
|
_, err = cli.ContainerExecCreate(context.Background(), name, config)
|
2015-11-19 08:51:26 +03:00
|
|
|
|
2016-02-17 22:05:51 +03:00
|
|
|
comment := check.Commentf("Expected message when creating exec command with Container %s is paused", name)
|
2017-05-24 06:56:26 +03:00
|
|
|
c.Assert(err.Error(), checker.Contains, "Container "+name+" is paused, unpause the container before exec", comment)
|
2015-11-19 08:51:26 +03:00
|
|
|
}
|
|
|
|
|
[nit] integration-cli: obey Go's naming convention
No substantial code change.
- Api --> API
- Cli --> CLI
- Http, Https --> HTTP, HTTPS
- Id --> ID
- Uid,Gid,Pid --> UID,PID,PID
- Ipam --> IPAM
- Tls --> TLS (TestDaemonNoTlsCliTlsVerifyWithEnv --> TestDaemonTLSVerifyIssue13964)
Didn't touch in this commit:
- Git: because it is officially "Git": https://git-scm.com/
- Tar: because it is officially "Tar": https://www.gnu.org/software/tar/
- Cpu, Nat, Mac, Ipc, Shm: for keeping a consistency with existing production code (not changable, for compatibility)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-09-28 04:50:12 +03:00
|
|
|
func (s *DockerSuite) TestExecAPIStart(c *check.C) {
|
2017-01-17 07:45:27 +03:00
|
|
|
testRequires(c, DaemonIsLinux) // Uses pause/unpause but bits may be salvageable to Windows to Windows CI
|
2015-09-12 05:50:21 +03:00
|
|
|
dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")
|
|
|
|
|
2015-10-23 19:48:55 +03:00
|
|
|
id := createExec(c, "test")
|
2016-01-15 19:57:23 +03:00
|
|
|
startExec(c, id, http.StatusOK)
|
2015-09-12 05:50:21 +03:00
|
|
|
|
2016-10-17 20:49:36 +03:00
|
|
|
var execJSON struct{ PID int }
|
|
|
|
inspectExec(c, id, &execJSON)
|
|
|
|
c.Assert(execJSON.PID, checker.GreaterThan, 1)
|
|
|
|
|
2015-10-23 19:48:55 +03:00
|
|
|
id = createExec(c, "test")
|
2015-09-12 05:50:21 +03:00
|
|
|
dockerCmd(c, "stop", "test")
|
|
|
|
|
2016-01-15 19:57:23 +03:00
|
|
|
startExec(c, id, http.StatusNotFound)
|
2015-09-12 05:50:21 +03:00
|
|
|
|
|
|
|
dockerCmd(c, "start", "test")
|
2016-01-15 19:57:23 +03:00
|
|
|
startExec(c, id, http.StatusNotFound)
|
2015-09-12 05:50:21 +03:00
|
|
|
|
|
|
|
// make sure exec is created before pausing
|
2015-10-23 19:48:55 +03:00
|
|
|
id = createExec(c, "test")
|
2015-09-12 05:50:21 +03:00
|
|
|
dockerCmd(c, "pause", "test")
|
2016-01-15 19:57:23 +03:00
|
|
|
startExec(c, id, http.StatusConflict)
|
2015-09-12 05:50:21 +03:00
|
|
|
dockerCmd(c, "unpause", "test")
|
2016-01-15 19:57:23 +03:00
|
|
|
startExec(c, id, http.StatusOK)
|
2015-09-12 05:50:21 +03:00
|
|
|
}
|
2015-10-23 19:48:55 +03:00
|
|
|
|
2016-12-05 18:58:53 +03:00
|
|
|
func (s *DockerSuite) TestExecAPIStartEnsureHeaders(c *check.C) {
|
|
|
|
testRequires(c, DaemonIsLinux)
|
|
|
|
dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")
|
|
|
|
|
|
|
|
id := createExec(c, "test")
|
2017-03-06 18:35:27 +03:00
|
|
|
resp, _, err := request.Post(fmt.Sprintf("/exec/%s/start", id), request.RawString(`{"Detach": true}`), request.JSON)
|
2016-12-05 18:58:53 +03:00
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
c.Assert(resp.Header.Get("Server"), checker.Not(checker.Equals), "")
|
|
|
|
}
|
|
|
|
|
[nit] integration-cli: obey Go's naming convention
No substantial code change.
- Api --> API
- Cli --> CLI
- Http, Https --> HTTP, HTTPS
- Id --> ID
- Uid,Gid,Pid --> UID,PID,PID
- Ipam --> IPAM
- Tls --> TLS (TestDaemonNoTlsCliTlsVerifyWithEnv --> TestDaemonTLSVerifyIssue13964)
Didn't touch in this commit:
- Git: because it is officially "Git": https://git-scm.com/
- Tar: because it is officially "Tar": https://www.gnu.org/software/tar/
- Cpu, Nat, Mac, Ipc, Shm: for keeping a consistency with existing production code (not changable, for compatibility)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-09-28 04:50:12 +03:00
|
|
|
func (s *DockerSuite) TestExecAPIStartBackwardsCompatible(c *check.C) {
|
2016-10-31 20:15:43 +03:00
|
|
|
testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
|
2016-01-29 03:26:06 +03:00
|
|
|
runSleepingContainer(c, "-d", "--name", "test")
|
2015-10-23 19:48:55 +03:00
|
|
|
id := createExec(c, "test")
|
|
|
|
|
2017-03-06 18:35:27 +03:00
|
|
|
resp, body, err := request.Post(fmt.Sprintf("/v1.20/exec/%s/start", id), request.RawString(`{"Detach": true}`), request.ContentType("text/plain"))
|
2015-11-20 10:03:34 +03:00
|
|
|
c.Assert(err, checker.IsNil)
|
2015-10-23 19:48:55 +03:00
|
|
|
|
2017-08-22 01:50:40 +03:00
|
|
|
b, err := request.ReadBody(body)
|
2015-10-23 19:48:55 +03:00
|
|
|
comment := check.Commentf("response body: %s", b)
|
2015-11-20 10:03:34 +03:00
|
|
|
c.Assert(err, checker.IsNil, comment)
|
|
|
|
c.Assert(resp.StatusCode, checker.Equals, http.StatusOK, comment)
|
2015-10-23 19:48:55 +03:00
|
|
|
}
|
|
|
|
|
2016-01-15 19:57:23 +03:00
|
|
|
// #19362
|
[nit] integration-cli: obey Go's naming convention
No substantial code change.
- Api --> API
- Cli --> CLI
- Http, Https --> HTTP, HTTPS
- Id --> ID
- Uid,Gid,Pid --> UID,PID,PID
- Ipam --> IPAM
- Tls --> TLS (TestDaemonNoTlsCliTlsVerifyWithEnv --> TestDaemonTLSVerifyIssue13964)
Didn't touch in this commit:
- Git: because it is officially "Git": https://git-scm.com/
- Tar: because it is officially "Tar": https://www.gnu.org/software/tar/
- Cpu, Nat, Mac, Ipc, Shm: for keeping a consistency with existing production code (not changable, for compatibility)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-09-28 04:50:12 +03:00
|
|
|
func (s *DockerSuite) TestExecAPIStartMultipleTimesError(c *check.C) {
|
2016-01-29 03:26:06 +03:00
|
|
|
runSleepingContainer(c, "-d", "--name", "test")
|
2016-01-15 19:57:23 +03:00
|
|
|
execID := createExec(c, "test")
|
|
|
|
startExec(c, execID, http.StatusOK)
|
2017-01-21 14:35:54 +03:00
|
|
|
waitForExec(c, execID)
|
2016-01-15 19:57:23 +03:00
|
|
|
|
|
|
|
startExec(c, execID, http.StatusConflict)
|
|
|
|
}
|
|
|
|
|
2016-02-25 05:04:44 +03:00
|
|
|
// #20638
|
[nit] integration-cli: obey Go's naming convention
No substantial code change.
- Api --> API
- Cli --> CLI
- Http, Https --> HTTP, HTTPS
- Id --> ID
- Uid,Gid,Pid --> UID,PID,PID
- Ipam --> IPAM
- Tls --> TLS (TestDaemonNoTlsCliTlsVerifyWithEnv --> TestDaemonTLSVerifyIssue13964)
Didn't touch in this commit:
- Git: because it is officially "Git": https://git-scm.com/
- Tar: because it is officially "Tar": https://www.gnu.org/software/tar/
- Cpu, Nat, Mac, Ipc, Shm: for keeping a consistency with existing production code (not changable, for compatibility)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-09-28 04:50:12 +03:00
|
|
|
func (s *DockerSuite) TestExecAPIStartWithDetach(c *check.C) {
|
2016-02-25 05:04:44 +03:00
|
|
|
name := "foo"
|
2016-02-25 16:27:22 +03:00
|
|
|
runSleepingContainer(c, "-d", "-t", "--name", name)
|
2017-05-24 06:56:26 +03:00
|
|
|
|
|
|
|
config := types.ExecConfig{
|
|
|
|
Cmd: []string{"true"},
|
|
|
|
AttachStderr: true,
|
2016-02-25 05:04:44 +03:00
|
|
|
}
|
|
|
|
|
2017-05-24 06:56:26 +03:00
|
|
|
cli, err := client.NewEnvClient()
|
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
defer cli.Close()
|
|
|
|
|
|
|
|
createResp, err := cli.ContainerExecCreate(context.Background(), name, config)
|
|
|
|
c.Assert(err, checker.IsNil)
|
2016-02-25 05:04:44 +03:00
|
|
|
|
2017-03-06 18:35:27 +03:00
|
|
|
_, body, err := request.Post(fmt.Sprintf("/exec/%s/start", createResp.ID), request.RawString(`{"Detach": true}`), request.JSON)
|
2016-02-25 05:04:44 +03:00
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
|
2017-05-24 06:56:26 +03:00
|
|
|
b, err := request.ReadBody(body)
|
2016-02-25 05:04:44 +03:00
|
|
|
comment := check.Commentf("response body: %s", b)
|
|
|
|
c.Assert(err, checker.IsNil, comment)
|
|
|
|
|
2017-03-06 18:35:27 +03:00
|
|
|
resp, _, err := request.Get("/_ping")
|
2016-02-25 05:04:44 +03:00
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
if resp.StatusCode != http.StatusOK {
|
|
|
|
c.Fatal("daemon is down, it should alive")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-21 14:35:54 +03:00
|
|
|
// #30311
|
|
|
|
func (s *DockerSuite) TestExecAPIStartValidCommand(c *check.C) {
|
|
|
|
name := "exec_test"
|
|
|
|
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
|
|
|
|
|
|
|
id := createExecCmd(c, name, "true")
|
|
|
|
startExec(c, id, http.StatusOK)
|
|
|
|
|
|
|
|
waitForExec(c, id)
|
|
|
|
|
|
|
|
var inspectJSON struct{ ExecIDs []string }
|
|
|
|
inspectContainer(c, name, &inspectJSON)
|
|
|
|
|
|
|
|
c.Assert(inspectJSON.ExecIDs, checker.IsNil)
|
|
|
|
}
|
|
|
|
|
|
|
|
// #30311
|
|
|
|
func (s *DockerSuite) TestExecAPIStartInvalidCommand(c *check.C) {
|
|
|
|
name := "exec_test"
|
|
|
|
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
|
|
|
|
|
|
|
id := createExecCmd(c, name, "invalid")
|
2017-07-19 17:20:13 +03:00
|
|
|
startExec(c, id, http.StatusBadRequest)
|
2017-01-21 14:35:54 +03:00
|
|
|
waitForExec(c, id)
|
|
|
|
|
|
|
|
var inspectJSON struct{ ExecIDs []string }
|
|
|
|
inspectContainer(c, name, &inspectJSON)
|
|
|
|
|
|
|
|
c.Assert(inspectJSON.ExecIDs, checker.IsNil)
|
|
|
|
}
|
|
|
|
|
2015-10-23 19:48:55 +03:00
|
|
|
func createExec(c *check.C, name string) string {
|
2017-01-21 14:35:54 +03:00
|
|
|
return createExecCmd(c, name, "true")
|
|
|
|
}
|
|
|
|
|
|
|
|
func createExecCmd(c *check.C, name string, cmd string) string {
|
2017-03-06 18:35:27 +03:00
|
|
|
_, reader, err := request.Post(fmt.Sprintf("/containers/%s/exec", name), request.JSONBody(map[string]interface{}{"Cmd": []string{cmd}}))
|
2017-02-28 19:12:30 +03:00
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
b, err := ioutil.ReadAll(reader)
|
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
defer reader.Close()
|
2015-10-23 19:48:55 +03:00
|
|
|
createResp := struct {
|
|
|
|
ID string `json:"Id"`
|
|
|
|
}{}
|
2015-11-20 10:03:34 +03:00
|
|
|
c.Assert(json.Unmarshal(b, &createResp), checker.IsNil, check.Commentf(string(b)))
|
2015-10-23 19:48:55 +03:00
|
|
|
return createResp.ID
|
|
|
|
}
|
2016-01-15 19:57:23 +03:00
|
|
|
|
|
|
|
func startExec(c *check.C, id string, code int) {
|
2017-03-06 18:35:27 +03:00
|
|
|
resp, body, err := request.Post(fmt.Sprintf("/exec/%s/start", id), request.RawString(`{"Detach": true}`), request.JSON)
|
2016-01-15 19:57:23 +03:00
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
|
2017-08-22 01:50:40 +03:00
|
|
|
b, err := request.ReadBody(body)
|
2016-01-15 19:57:23 +03:00
|
|
|
comment := check.Commentf("response body: %s", b)
|
|
|
|
c.Assert(err, checker.IsNil, comment)
|
|
|
|
c.Assert(resp.StatusCode, checker.Equals, code, comment)
|
|
|
|
}
|
|
|
|
|
|
|
|
func inspectExec(c *check.C, id string, out interface{}) {
|
2017-03-06 18:35:27 +03:00
|
|
|
resp, body, err := request.Get(fmt.Sprintf("/exec/%s/json", id))
|
2016-01-15 19:57:23 +03:00
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
defer body.Close()
|
|
|
|
c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
|
|
|
|
err = json.NewDecoder(body).Decode(out)
|
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
}
|
2017-01-21 14:35:54 +03:00
|
|
|
|
|
|
|
func waitForExec(c *check.C, id string) {
|
|
|
|
timeout := time.After(60 * time.Second)
|
|
|
|
var execJSON struct{ Running bool }
|
|
|
|
for {
|
|
|
|
select {
|
|
|
|
case <-timeout:
|
|
|
|
c.Fatal("timeout waiting for exec to start")
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
|
|
|
|
inspectExec(c, id, &execJSON)
|
|
|
|
if !execJSON.Running {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func inspectContainer(c *check.C, id string, out interface{}) {
|
2017-03-06 18:35:27 +03:00
|
|
|
resp, body, err := request.Get(fmt.Sprintf("/containers/%s/json", id))
|
2017-01-21 14:35:54 +03:00
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
defer body.Close()
|
|
|
|
c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
|
|
|
|
err = json.NewDecoder(body).Decode(out)
|
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
}
|