github.com/wulonghui/docker@v1.8.0-rc2/integration-cli/docker_api_info_test.go (about) 1 package main 2 3 import ( 4 "net/http" 5 "strings" 6 7 "github.com/go-check/check" 8 ) 9 10 func (s *DockerSuite) TestInfoApi(c *check.C) { 11 endpoint := "/info" 12 13 status, body, err := sockRequest("GET", endpoint, nil) 14 c.Assert(status, check.Equals, http.StatusOK) 15 c.Assert(err, check.IsNil) 16 17 // always shown fields 18 stringsToCheck := []string{ 19 "ID", 20 "Containers", 21 "Images", 22 "ExecutionDriver", 23 "LoggingDriver", 24 "OperatingSystem", 25 "NCPU", 26 "MemTotal", 27 "KernelVersion", 28 "Driver"} 29 30 out := string(body) 31 for _, linePrefix := range stringsToCheck { 32 if !strings.Contains(out, linePrefix) { 33 c.Errorf("couldn't find string %v in output", linePrefix) 34 } 35 } 36 }