Signed-off-by: Marianna <mtesselh@gmail.com>
Marianna authored on 2015/03/28 11:18:24... | ... |
@@ -5251,3 +5251,30 @@ func (s *DockerSuite) TestBuildEmptyStringVolume(c *check.C) { |
5251 | 5251 |
} |
5252 | 5252 |
|
5253 | 5253 |
} |
5254 |
+ |
|
5255 |
+func TestBuildContainerWithCgroupParent(t *testing.T) { |
|
5256 |
+ testRequires(t, NativeExecDriver) |
|
5257 |
+ defer deleteImages() |
|
5258 |
+ |
|
5259 |
+ cgroupParent := "test" |
|
5260 |
+ data, err := ioutil.ReadFile("/proc/self/cgroup") |
|
5261 |
+ if err != nil { |
|
5262 |
+ t.Fatalf("failed to read '/proc/self/cgroup - %v", err) |
|
5263 |
+ } |
|
5264 |
+ selfCgroupPaths := parseCgroupPaths(string(data)) |
|
5265 |
+ _, found := selfCgroupPaths["memory"] |
|
5266 |
+ if !found { |
|
5267 |
+ t.Fatalf("unable to find self cpu cgroup path. CgroupsPath: %v", selfCgroupPaths) |
|
5268 |
+ } |
|
5269 |
+ cmd := exec.Command(dockerBinary, "build", "--cgroup-parent", cgroupParent , "-") |
|
5270 |
+ cmd.Stdin = strings.NewReader(` |
|
5271 |
+FROM busybox |
|
5272 |
+RUN cat /proc/self/cgroup |
|
5273 |
+`) |
|
5274 |
+ |
|
5275 |
+ out, _, err := runCommandWithOutput(cmd) |
|
5276 |
+ if err != nil { |
|
5277 |
+ t.Fatalf("unexpected failure when running container with --cgroup-parent option - %s\n%v", string(out), err) |
|
5278 |
+ } |
|
5279 |
+ logDone("build - cgroup parent") |
|
5280 |
+} |