github.com/jiasir/docker@v1.3.3-0.20170609024000-252e610103e7/integration-cli/docker_api_inspect_unix_test.go (about) 1 // +build !windows 2 3 package main 4 5 import ( 6 "encoding/json" 7 "fmt" 8 "net/http" 9 10 "github.com/docker/docker/integration-cli/checker" 11 "github.com/docker/docker/integration-cli/request" 12 "github.com/go-check/check" 13 ) 14 15 // #16665 16 func (s *DockerSuite) TestInspectAPICpusetInConfigPre120(c *check.C) { 17 testRequires(c, DaemonIsLinux) 18 testRequires(c, cgroupCpuset) 19 20 name := "cpusetinconfig-pre120" 21 dockerCmd(c, "run", "--name", name, "--cpuset-cpus", "0", "busybox", "true") 22 23 status, body, err := request.SockRequest("GET", fmt.Sprintf("/v1.19/containers/%s/json", name), nil, daemonHost()) 24 c.Assert(status, check.Equals, http.StatusOK) 25 c.Assert(err, check.IsNil) 26 27 var inspectJSON map[string]interface{} 28 err = json.Unmarshal(body, &inspectJSON) 29 c.Assert(err, checker.IsNil, check.Commentf("unable to unmarshal body for version 1.19")) 30 31 config, ok := inspectJSON["Config"] 32 c.Assert(ok, checker.True, check.Commentf("Unable to find 'Config'")) 33 cfg := config.(map[string]interface{}) 34 _, ok = cfg["Cpuset"] 35 c.Assert(ok, checker.True, check.Commentf("API version 1.19 expected to include Cpuset in 'Config'")) 36 }