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

Function TestSystemd240

cgroup1/paths_test.go:94–125  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func TestSystemd240(t *testing.T) {
95 if isUnified {
96 t.Skipf("requires the system to be running in legacy mode")
97 }
98 const data = `8:net_cls:/
99 7:memory:/system.slice/docker.service
100 6:freezer:/
101 5:blkio:/system.slice/docker.service
102 4:devices:/system.slice/docker.service
103 3:cpuset:/
104 2:cpu,cpuacct:/system.slice/docker.service
105 1:name=systemd:/system.slice/docker.service
106 0::/system.slice/docker.service`
107 r := strings.NewReader(data)
108 paths, unified, err := cgroups.ParseCgroupFromReaderUnified(r)
109 if err != nil {
110 t.Fatal(err)
111 }
112
113 path := existingPath(paths, "")
114 _, err = path("net_prio")
115 if err == nil {
116 t.Fatal("error for net_prio should not be nil")
117 }
118 if err != ErrControllerNotActive {
119 t.Fatalf("expected error %q but received %q", ErrControllerNotActive, err)
120 }
121 unifiedExpected := "/system.slice/docker.service"
122 if unified != unifiedExpected {
123 t.Fatalf("expected %q, got %q", unifiedExpected, unified)
124 }
125}

Callers

nothing calls this directly

Calls 1

existingPathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…