github.com/SamWhited/moby@v1.13.1/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/pkg/integration/checker" 11 "github.com/go-check/check" 12 ) 13 14 // #16665 15 func (s *DockerSuite) TestInspectAPICpusetInConfigPre120(c *check.C) { 16 testRequires(c, DaemonIsLinux) 17 testRequires(c, cgroupCpuset) 18 19 name := "cpusetinconfig-pre120" 20 dockerCmd(c, "run", "--name", name, "--cpuset-cpus", "0", "busybox", "true") 21 22 status, body, err := sockRequest("GET", fmt.Sprintf("/v1.19/containers/%s/json", name), nil) 23 c.Assert(status, check.Equals, http.StatusOK) 24 c.Assert(err, check.IsNil) 25 26 var inspectJSON map[string]interface{} 27 err = json.Unmarshal(body, &inspectJSON) 28 c.Assert(err, checker.IsNil, check.Commentf("unable to unmarshal body for version 1.19")) 29 30 config, ok := inspectJSON["Config"] 31 c.Assert(ok, checker.True, check.Commentf("Unable to find 'Config'")) 32 cfg := config.(map[string]interface{}) 33 _, ok = cfg["Cpuset"] 34 c.Assert(ok, checker.True, check.Commentf("API version 1.19 expected to include Cpuset in 'Config'")) 35 }