test: add custom cgroup test#3146
Conversation
|
ci fail with |
avoid issue containerd#3133 occurs again Signed-off-by: Ace-Tang <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #3146 +/- ##
=======================================
Coverage 45.16% 45.16%
=======================================
Files 111 111
Lines 11962 11962
=======================================
Hits 5403 5403
Misses 5727 5727
Partials 832 832
Continue to review full report at Codecov.
|
| if numPostFields < 3 { | ||
| continue | ||
| } | ||
| cgroupPath[filepath.Base(fields[4])] = fields[4] |
There was a problem hiding this comment.
Should this take spaces into account? (see the discussion on moby/moby#38458) (i.e., if a custom path with a space in it is used, will the os.Stat() below fail?)
There was a problem hiding this comment.
I check for this case, print the path, and it is pass
$ sudo /usr/local/go/bin/go test -race -v -test.root=true -run TestDaemonCustomCgroup
[sudo] password for ace:
INFO[0000] running tests against containerd revision=86cfcb870e6be834890075a0debc6a2993583b8a.m runtime= version=v1.2.0-377-g86cfcb87.m
=== RUN TestDaemonCustomCgroup
path /sys/fs/cgroup/hugetlb/786233940 xxx
path /sys/fs/cgroup/perf_event/786233940 xxx
path /sys/fs/cgroup/systemd/786233940 xxx
path /sys/fs/cgroup/cpu,cpuacct/786233940 xxx
path /sys/fs/cgroup/blkio/786233940 xxx
path /sys/fs/cgroup/pids/786233940 xxx
path /sys/fs/cgroup/freezer/786233940 xxx
path /sys/fs/cgroup/devices/786233940 xxx
path /sys/fs/cgroup/memory/786233940 xxx
path /sys/fs/cgroup/net_cls,net_prio/786233940 xxx
path /sys/fs/cgroup/cpuset/786233940 xxx
path /sys/fs/cgroup/rdma/786233940 xxx
--- PASS: TestDaemonCustomCgroup (0.07s)
PASS
ok github.com/containerd/containerd 45.531s
There was a problem hiding this comment.
@thaJeztah this is only in the testsuite, and the pathname is fixed to a string (the unix epoch seconds) without spaces; are you OK with merge without handling that special case in the testsuite?
There was a problem hiding this comment.
Yes, that looks fine for now; was just thinking if spaces would still break custom paths, but that's a bit orthogonal
|
LGTM |
avoid issue #3133 occurs again
Signed-off-by: Ace-Tang [email protected]