|
@@ -5555,7 +5555,7 @@ func TestBuildResourceConstraintsAreUsed(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- cmd := exec.Command(dockerBinary, "build", "--no-cache", "--rm=false", "--memory=64m", "--memory-swap=-1", "--cpuset-cpus=0", "--cpu-shares=100", "-t", name, ".")
|
|
|
+ cmd := exec.Command(dockerBinary, "build", "--no-cache", "--rm=false", "--memory=64m", "--memory-swap=-1", "--cpuset-cpus=0", "--cpuset-mems=0", "--cpu-shares=100", "-t", name, ".")
|
|
|
cmd.Dir = ctx.Dir
|
|
|
|
|
|
out, _, err := runCommandWithOutput(cmd)
|
|
@@ -5573,6 +5573,7 @@ func TestBuildResourceConstraintsAreUsed(t *testing.T) {
|
|
|
Memory float64 // Use float64 here since the json decoder sees it that way
|
|
|
MemorySwap int
|
|
|
CpusetCpus string
|
|
|
+ CpusetMems string
|
|
|
CpuShares int
|
|
|
}
|
|
|
|
|
@@ -5586,9 +5587,9 @@ func TestBuildResourceConstraintsAreUsed(t *testing.T) {
|
|
|
t.Fatal(err, cfg)
|
|
|
}
|
|
|
mem := int64(c1.Memory)
|
|
|
- if mem != 67108864 || c1.MemorySwap != -1 || c1.CpusetCpus != "0" || c1.CpuShares != 100 {
|
|
|
- t.Fatalf("resource constraints not set properly:\nMemory: %d, MemSwap: %d, CpusetCpus: %s, CpuShares: %d",
|
|
|
- mem, c1.MemorySwap, c1.CpusetCpus, c1.CpuShares)
|
|
|
+ if mem != 67108864 || c1.MemorySwap != -1 || c1.CpusetCpus != "0" || c1.CpusetMems != "0" || c1.CpuShares != 100 {
|
|
|
+ t.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)
|
|
|
}
|
|
|
|
|
|
// Make sure constraints aren't saved to image
|
|
@@ -5605,9 +5606,9 @@ func TestBuildResourceConstraintsAreUsed(t *testing.T) {
|
|
|
t.Fatal(err, cfg)
|
|
|
}
|
|
|
mem = int64(c2.Memory)
|
|
|
- if mem == 67108864 || c2.MemorySwap == -1 || c2.CpusetCpus == "0" || c2.CpuShares == 100 {
|
|
|
- t.Fatalf("resource constraints leaked from build:\nMemory: %d, MemSwap: %d, CpusetCpus: %s, CpuShares: %d",
|
|
|
- mem, c2.MemorySwap, c2.CpusetCpus, c2.CpuShares)
|
|
|
+ if mem == 67108864 || c2.MemorySwap == -1 || c2.CpusetCpus == "0" || c2.CpusetMems == "0" || c2.CpuShares == 100 {
|
|
|
+ t.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)
|
|
|
}
|
|
|
|
|
|
logDone("build - resource constraints applied")
|