2015-04-13 02:36:04 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-04-13 13:30:07 -04:00
|
|
|
"net/http"
|
2015-04-13 02:36:04 -04:00
|
|
|
"os/exec"
|
|
|
|
"strings"
|
2015-04-18 12:46:47 -04:00
|
|
|
|
|
|
|
"github.com/go-check/check"
|
2015-04-13 02:36:04 -04:00
|
|
|
)
|
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
func (s *DockerSuite) TestExecResizeApiHeightWidthNoInt(c *check.C) {
|
2015-04-13 02:36:04 -04:00
|
|
|
runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "top")
|
|
|
|
out, _, err := runCommandWithOutput(runCmd)
|
|
|
|
if err != nil {
|
2015-04-18 12:46:47 -04:00
|
|
|
c.Fatalf(out, err)
|
2015-04-13 02:36:04 -04:00
|
|
|
}
|
|
|
|
cleanedContainerID := strings.TrimSpace(out)
|
|
|
|
|
|
|
|
endpoint := "/exec/" + cleanedContainerID + "/resize?h=foo&w=bar"
|
2015-04-13 13:30:07 -04:00
|
|
|
status, _, err := sockRequest("POST", endpoint, nil)
|
2015-04-13 02:36:04 -04:00
|
|
|
if err == nil {
|
2015-04-18 12:46:47 -04:00
|
|
|
c.Fatal("Expected exec resize Request to fail")
|
2015-04-13 02:36:04 -04:00
|
|
|
}
|
2015-04-13 13:30:07 -04:00
|
|
|
if status != http.StatusInternalServerError {
|
2015-04-18 12:46:47 -04:00
|
|
|
c.Fatalf("Status expected %d, got %d", http.StatusInternalServerError, status)
|
2015-04-13 13:30:07 -04:00
|
|
|
}
|
2015-04-13 02:36:04 -04:00
|
|
|
}
|