Skip to content

test: add custom cgroup test#3146

Merged
estesp merged 1 commit intocontainerd:masterfrom
Ace-Tang:add-test
Mar 29, 2019
Merged

test: add custom cgroup test#3146
estesp merged 1 commit intocontainerd:masterfrom
Ace-Tang:add-test

Conversation

@Ace-Tang
Copy link
Copy Markdown
Contributor

avoid issue #3133 occurs again

Signed-off-by: Ace-Tang [email protected]

@Ace-Tang
Copy link
Copy Markdown
Contributor Author

ci fail with

--- FAIL: TestContentClient (6.80s)
    --- PASS: TestContentClient/Writer (0.12s)
    --- PASS: TestContentClient/UpdateStatus (0.03s)
    --- PASS: TestContentClient/CommitExists (0.05s)
    --- PASS: TestContentClient/Resume (0.04s)
    --- PASS: TestContentClient/ResumeTruncate (0.63s)
    --- PASS: TestContentClient/ResumeDiscard (0.58s)
    --- PASS: TestContentClient/ResumeCopy (0.54s)
    --- PASS: TestContentClient/ResumeCopySeeker (0.52s)
    --- PASS: TestContentClient/ResumeCopyReaderAt (0.47s)
    --- PASS: TestContentClient/SmallBlob (0.04s)
    --- PASS: TestContentClient/Labels (0.04s)
    --- FAIL: TestContentClient/CommitErrorState (3.75s)
        testsuite.go:117: Cleanup failed: unknown
            github.com/containerd/containerd/errdefs.init.ializers
            	C:/gopath/src/github.com/containerd/containerd/errdefs/errors.go:39
            runtime.main
            	C:/go/src/runtime/proc.go:188
            runtime.goexit
            	C:/go/src/runtime/asm_amd64.s:1337
            remove C:\Program Files\containerd\root-test\io.containerd.content.v1.content\ingest\9101c5f249b4cb38a50dddda86a787c09f31099573c87c525fc50774ac21d05d\.tmp-updatedat713004283: The process cannot access the file because it is being used by another process.

avoid issue containerd#3133 occurs again

Signed-off-by: Ace-Tang <[email protected]>
@codecov-io
Copy link
Copy Markdown

codecov-io commented Mar 29, 2019

Codecov Report

Merging #3146 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3146   +/-   ##
=======================================
  Coverage   45.16%   45.16%           
=======================================
  Files         111      111           
  Lines       11962    11962           
=======================================
  Hits         5403     5403           
  Misses       5727     5727           
  Partials      832      832
Flag Coverage Δ
#linux 49.25% <ø> (ø) ⬆️
#windows 40.49% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e7b6fea...f7f6dd7. Read the comment docs.

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if numPostFields < 3 {
continue
}
cgroupPath[filepath.Base(fields[4])] = fields[4]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?)

Copy link
Copy Markdown
Contributor Author

@Ace-Tang Ace-Tang Mar 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that looks fine for now; was just thinking if spaces would still break custom paths, but that's a bit orthogonal

@crosbymichael
Copy link
Copy Markdown
Member

LGTM

@estesp estesp merged commit 2d0a06d into containerd:master Mar 29, 2019
@Ace-Tang Ace-Tang deleted the add-test branch April 2, 2019 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants