docker_api_exec_resize_test.go 686 B

123456789101112131415161718192021222324252627
  1. package main
  2. import (
  3. "net/http"
  4. "os/exec"
  5. "strings"
  6. "github.com/go-check/check"
  7. )
  8. func (s *DockerSuite) TestExecResizeApiHeightWidthNoInt(c *check.C) {
  9. runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "top")
  10. out, _, err := runCommandWithOutput(runCmd)
  11. if err != nil {
  12. c.Fatalf(out, err)
  13. }
  14. cleanedContainerID := strings.TrimSpace(out)
  15. endpoint := "/exec/" + cleanedContainerID + "/resize?h=foo&w=bar"
  16. status, _, err := sockRequest("POST", endpoint, nil)
  17. if err == nil {
  18. c.Fatal("Expected exec resize Request to fail")
  19. }
  20. if status != http.StatusInternalServerError {
  21. c.Fatalf("Status expected %d, got %d", http.StatusInternalServerError, status)
  22. }
  23. }