MCPcopy Create free account
hub / github.com/containerd/cgroups / TestCreateSubCgroup

Function TestCreateSubCgroup

cgroup1/cgroup_test.go:474–514  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

472}
473
474func TestCreateSubCgroup(t *testing.T) {
475 mock, err := newMock(t)
476 if err != nil {
477 t.Fatal(err)
478 }
479 defer func() {
480 if err := mock.delete(); err != nil {
481 t.Errorf("failed delete: %v", err)
482 }
483 }()
484 control, err := New(StaticPath("test"), &specs.LinuxResources{}, WithHierarchy(mock.hierarchy))
485 if err != nil {
486 t.Error(err)
487 return
488 }
489 sub, err := control.New("child", &specs.LinuxResources{})
490 if err != nil {
491 t.Error(err)
492 return
493 }
494 if err := sub.Add(Process{Pid: 1234}); err != nil {
495 t.Error(err)
496 return
497 }
498 for _, s := range Subsystems() {
499 if err := checkPid(mock, filepath.Join(string(s), "test", "child"), 1234); err != nil {
500 t.Error(err)
501 return
502 }
503 }
504 if err := sub.AddTask(Process{Pid: 5678}); err != nil {
505 t.Error(err)
506 return
507 }
508 for _, s := range Subsystems() {
509 if err := checkTaskid(mock, filepath.Join(string(s), "test", "child"), 5678); err != nil {
510 t.Error(err)
511 return
512 }
513 }
514}
515
516func TestFreezeThaw(t *testing.T) {
517 mock, err := newMock(t)

Callers

nothing calls this directly

Calls 11

newMockFunction · 0.85
NewFunction · 0.85
StaticPathFunction · 0.85
WithHierarchyFunction · 0.85
SubsystemsFunction · 0.85
checkPidFunction · 0.85
checkTaskidFunction · 0.85
deleteMethod · 0.80
NewMethod · 0.65
AddMethod · 0.65
AddTaskMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…