|
@@ -5383,11 +5383,11 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
|
|
cID := strings.TrimSpace(out)
|
|
cID := strings.TrimSpace(out)
|
|
|
|
|
|
type hostConfig struct {
|
|
type hostConfig struct {
|
|
- Memory float64 // Use float64 here since the json decoder sees it that way
|
|
|
|
- MemorySwap int
|
|
|
|
|
|
+ Memory int64
|
|
|
|
+ MemorySwap int64
|
|
CpusetCpus string
|
|
CpusetCpus string
|
|
CpusetMems string
|
|
CpusetMems string
|
|
- CpuShares int
|
|
|
|
|
|
+ CpuShares int64
|
|
}
|
|
}
|
|
|
|
|
|
cfg, err := inspectFieldJSON(cID, "HostConfig")
|
|
cfg, err := inspectFieldJSON(cID, "HostConfig")
|
|
@@ -5399,10 +5399,9 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
|
|
if err := json.Unmarshal([]byte(cfg), &c1); err != nil {
|
|
if err := json.Unmarshal([]byte(cfg), &c1); err != nil {
|
|
c.Fatal(err, cfg)
|
|
c.Fatal(err, cfg)
|
|
}
|
|
}
|
|
- mem := int64(c1.Memory)
|
|
|
|
- if mem != 67108864 || c1.MemorySwap != -1 || c1.CpusetCpus != "0" || c1.CpusetMems != "0" || c1.CpuShares != 100 {
|
|
|
|
|
|
+ if c1.Memory != 67108864 || c1.MemorySwap != -1 || c1.CpusetCpus != "0" || c1.CpusetMems != "0" || c1.CpuShares != 100 {
|
|
c.Fatalf("resource constraints not set properly:\nMemory: %d, MemSwap: %d, CpusetCpus: %s, CpusetMems: %s, CpuShares: %d",
|
|
c.Fatalf("resource constraints not set properly:\nMemory: %d, MemSwap: %d, CpusetCpus: %s, CpusetMems: %s, CpuShares: %d",
|
|
- mem, c1.MemorySwap, c1.CpusetCpus, c1.CpusetMems, c1.CpuShares)
|
|
|
|
|
|
+ c1.Memory, c1.MemorySwap, c1.CpusetCpus, c1.CpusetMems, c1.CpuShares)
|
|
}
|
|
}
|
|
|
|
|
|
// Make sure constraints aren't saved to image
|
|
// Make sure constraints aren't saved to image
|
|
@@ -5416,10 +5415,9 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
|
|
if err := json.Unmarshal([]byte(cfg), &c2); err != nil {
|
|
if err := json.Unmarshal([]byte(cfg), &c2); err != nil {
|
|
c.Fatal(err, cfg)
|
|
c.Fatal(err, cfg)
|
|
}
|
|
}
|
|
- mem = int64(c2.Memory)
|
|
|
|
- if mem == 67108864 || c2.MemorySwap == -1 || c2.CpusetCpus == "0" || c2.CpusetMems == "0" || c2.CpuShares == 100 {
|
|
|
|
|
|
+ if c2.Memory == 67108864 || c2.MemorySwap == -1 || c2.CpusetCpus == "0" || c2.CpusetMems == "0" || c2.CpuShares == 100 {
|
|
c.Fatalf("resource constraints leaked from build:\nMemory: %d, MemSwap: %d, CpusetCpus: %s, CpusetMems: %s, CpuShares: %d",
|
|
c.Fatalf("resource constraints leaked from build:\nMemory: %d, MemSwap: %d, CpusetCpus: %s, CpusetMems: %s, CpuShares: %d",
|
|
- mem, c2.MemorySwap, c2.CpusetCpus, c2.CpusetMems, c2.CpuShares)
|
|
|
|
|
|
+ c2.Memory, c2.MemorySwap, c2.CpusetCpus, c2.CpusetMems, c2.CpuShares)
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|