docker_api_info_test.go 714 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package main
  2. import (
  3. "net/http"
  4. "strings"
  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, check.Equals, http.StatusOK)
  11. c.Assert(err, check.IsNil)
  12. // always shown fields
  13. stringsToCheck := []string{
  14. "ID",
  15. "Containers",
  16. "Images",
  17. "ExecutionDriver",
  18. "LoggingDriver",
  19. "OperatingSystem",
  20. "NCPU",
  21. "OSType",
  22. "Architecture",
  23. "MemTotal",
  24. "KernelVersion",
  25. "Driver",
  26. "ServerVersion"}
  27. out := string(body)
  28. for _, linePrefix := range stringsToCheck {
  29. if !strings.Contains(out, linePrefix) {
  30. c.Errorf("couldn't find string %v in output", linePrefix)
  31. }
  32. }
  33. }