2014-10-23 16:30:18 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-04-13 13:30:07 -04:00
|
|
|
"net/http"
|
2014-10-23 16:30:18 -04:00
|
|
|
"strings"
|
2015-04-18 12:46:47 -04:00
|
|
|
|
2015-10-13 08:01:58 -04:00
|
|
|
"github.com/docker/docker/pkg/integration/checker"
|
2015-04-18 12:46:47 -04:00
|
|
|
"github.com/go-check/check"
|
2014-10-23 16:30:18 -04: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-27 21:50:12 -04:00
|
|
|
func (s *DockerSuite) TestResizeAPIResponse(c *check.C) {
|
2016-02-02 21:51:42 -05:00
|
|
|
out, _ := runSleepingContainer(c, "-d")
|
2015-04-06 09:21:18 -04:00
|
|
|
cleanedContainerID := strings.TrimSpace(out)
|
2014-10-23 16:30:18 -04:00
|
|
|
|
|
|
|
endpoint := "/containers/" + cleanedContainerID + "/resize?h=40&w=40"
|
2015-04-20 17:03:56 -04:00
|
|
|
status, _, err := sockRequest("POST", endpoint, nil)
|
|
|
|
c.Assert(status, check.Equals, http.StatusOK)
|
|
|
|
c.Assert(err, check.IsNil)
|
2014-10-23 16:30:18 -04: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-27 21:50:12 -04:00
|
|
|
func (s *DockerSuite) TestResizeAPIHeightWidthNoInt(c *check.C) {
|
2016-02-02 21:51:42 -05:00
|
|
|
out, _ := runSleepingContainer(c, "-d")
|
2015-04-13 02:36:04 -04:00
|
|
|
cleanedContainerID := strings.TrimSpace(out)
|
|
|
|
|
|
|
|
endpoint := "/containers/" + cleanedContainerID + "/resize?h=foo&w=bar"
|
2015-04-13 13:30:07 -04:00
|
|
|
status, _, err := sockRequest("POST", endpoint, nil)
|
2015-04-20 17:03:56 -04:00
|
|
|
c.Assert(status, check.Equals, http.StatusInternalServerError)
|
|
|
|
c.Assert(err, check.IsNil)
|
2015-04-13 02:36:04 -04: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-27 21:50:12 -04:00
|
|
|
func (s *DockerSuite) TestResizeAPIResponseWhenContainerNotStarted(c *check.C) {
|
2015-07-14 02:35:36 -04:00
|
|
|
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
2015-04-06 09:21:18 -04:00
|
|
|
cleanedContainerID := strings.TrimSpace(out)
|
2014-10-23 16:30:18 -04:00
|
|
|
|
2015-04-10 03:09:26 -04:00
|
|
|
// make sure the exited container is not running
|
2015-07-14 02:35:36 -04:00
|
|
|
dockerCmd(c, "wait", cleanedContainerID)
|
2014-10-23 16:30:18 -04:00
|
|
|
|
|
|
|
endpoint := "/containers/" + cleanedContainerID + "/resize?h=40&w=40"
|
2015-04-20 17:03:56 -04:00
|
|
|
status, body, err := sockRequest("POST", endpoint, nil)
|
|
|
|
c.Assert(status, check.Equals, http.StatusInternalServerError)
|
|
|
|
c.Assert(err, check.IsNil)
|
|
|
|
|
2016-05-21 07:56:04 -04:00
|
|
|
c.Assert(getErrorMessage(c, body), checker.Contains, "is not running", check.Commentf("resize should fail with message 'Container is not running'"))
|
2014-10-23 16:30:18 -04:00
|
|
|
}
|