docker_api_exec_resize_test.go 744 B

1234567891011121314151617181920212223242526272829
  1. package main
  2. import (
  3. "net/http"
  4. "os/exec"
  5. "strings"
  6. "testing"
  7. )
  8. func TestExecResizeApiHeightWidthNoInt(t *testing.T) {
  9. runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "top")
  10. out, _, err := runCommandWithOutput(runCmd)
  11. if err != nil {
  12. t.Fatalf(out, err)
  13. }
  14. defer deleteAllContainers()
  15. cleanedContainerID := strings.TrimSpace(out)
  16. endpoint := "/exec/" + cleanedContainerID + "/resize?h=foo&w=bar"
  17. status, _, err := sockRequest("POST", endpoint, nil)
  18. if err == nil {
  19. t.Fatal("Expected exec resize Request to fail")
  20. }
  21. if status != http.StatusInternalServerError {
  22. t.Fatalf("Status expected %d, got %d", http.StatusInternalServerError, status)
  23. }
  24. logDone("container exec resize - height, width no int fail")
  25. }