docker_api_info_test.go 766 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package main
  2. import (
  3. "net/http"
  4. "github.com/docker/docker/pkg/integration/checker"
  5. "github.com/go-check/check"
  6. )
  7. func (s *DockerSuite) TestInfoApi(c *check.C) {
  8. endpoint := "/info"
  9. status, body, err := sockRequest("GET", endpoint, nil)
  10. c.Assert(status, checker.Equals, http.StatusOK)
  11. c.Assert(err, checker.IsNil)
  12. // always shown fields
  13. stringsToCheck := []string{
  14. "ID",
  15. "Containers",
  16. "ContainersRunning",
  17. "ContainersPaused",
  18. "ContainersStopped",
  19. "Images",
  20. "LoggingDriver",
  21. "OperatingSystem",
  22. "NCPU",
  23. "OSType",
  24. "Architecture",
  25. "MemTotal",
  26. "KernelVersion",
  27. "Driver",
  28. "ServerVersion",
  29. "SecurityOptions"}
  30. out := string(body)
  31. for _, linePrefix := range stringsToCheck {
  32. c.Assert(out, checker.Contains, linePrefix)
  33. }
  34. }