Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add TestRunMemoryOOM test case #1552

Merged
merged 1 commit into from
Jun 22, 2018

Conversation

sunyuan3
Copy link
Contributor

Signed-off-by: Yuan Sun [email protected]

@pouchrobot
Copy link
Collaborator

Thanks for your contribution. 🍻 @sunyuan3
While we thought PR Description could be more specific, longer than 100 chars.
Please edit this PR title instead of opening a new one.
More details, please refer to https://github.com/alibaba/pouch/blob/master/CONTRIBUTING.md

@allencloud allencloud changed the title add TestRunMemoryOOM test case test: add TestRunMemoryOOM test case Jun 19, 2018
@codecov-io
Copy link

Codecov Report

Merging #1552 into master will decrease coverage by 2.49%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #1552     +/-   ##
=========================================
- Coverage    41.3%   38.81%   -2.5%     
=========================================
  Files         267      183     -84     
  Lines       17331    14372   -2959     
=========================================
- Hits         7159     5578   -1581     
+ Misses       9282     7915   -1367     
+ Partials      890      879     -11
Impacted Files Coverage Δ
pkg/multierror/def.go 0% <0%> (-100%) ⬇️
apis/opts/sysctl.go 0% <0%> (-100%) ⬇️
apis/opts/shm_size.go 0% <0%> (-100%) ⬇️
apis/opts/memory_swappiness.go 0% <0%> (-100%) ⬇️
apis/opts/memory.go 0% <0%> (-100%) ⬇️
apis/opts/log_options.go 0% <0%> (-100%) ⬇️
pkg/net/interface.go 0% <0%> (-89.07%) ⬇️
apis/opts/diskquota.go 0% <0%> (-87.5%) ⬇️
apis/opts/memory_swap.go 0% <0%> (-81.82%) ⬇️
daemon/logger/loggerutils/tag.go 0% <0%> (-81.82%) ⬇️
... and 122 more

cname := "TestRunMemoryOOM"
ret := command.PouchRun("run", "-m", "20m", "--name", cname, busyboxImage, "sh", "-c", "x=a; while true; do x=$x$x$x$x; done")
defer DelContainerForceMultyTime(c, cname)
ret.Assert(c, icmd.Expected{ExitCode: 137})
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we still need to use API to check whether this container is under OOM state. @sunyuan3
cc @HusterWan

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@allencloud How to check? I don't find other string to show the container is under OOM state expect return value.

#pouch inspect 038341
[
{
"Args": null,
"Created": "2018-06-20T09:00:04.906931671Z",
"ExecIDs": null,
"GraphDriver": {
"Data": {
"MergedDir": "",
"UpperDir": "/home/t4/pouch/containerd/root/io.containerd.snapshotter.v1.overlayfs/snapshots/927/fs"
},
"Name": "overlayfs"
},
"HostConfig": {
"LogConfig": {
"Type": "json-file"
},
"NetworkMode": "none",
"OomScoreAdj": -500,
"RestartPolicy": {
"Name": "no"
},
"Runtime": "runc",
"BlkioDeviceReadBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceWriteIOps": null,
"BlkioWeightDevice": null,
"CgroupParent": "default",
"DeviceCgroupRules": null,
"Devices": [],
"Memory": 4194304,
"MemoryExtra": 0,
"MemorySwappiness": -1,
"MemoryWmarkRatio": 0,
"OomKillDisable": false,
"Ulimits": null
},
"Id": "0383413d557a932dcdd006e5d731959a9dfc6f5feb6acdb50f2e36c5e03976ce",
"Image": "reg.docker.alibaba-inc.com/sunyuan/ubuntu:14.04",
"Mounts": [],
"Name": "038341",
"NetworkSettings": {
"Networks": {
"none": {
"Aliases": null,
"Links": null,
"NetworkID": "65f29c4d3becf916a635ebda8997e36e2e8acd87922c8b2466f3742563014ba1"
}
},
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null
},
"Snapshotter": {
"Data": {
"MergedDir": "",
"UpperDir": "/home/t4/pouch/containerd/root/io.containerd.snapshotter.v1.overlayfs/snapshots/927/fs"
},
"Name": "overlayfs"
},
"State": {
"ExitCode": 137,
"FinishedAt": "2018-06-20T09:01:02.354659891Z",
"Pid": -1,
"StartedAt": "2018-06-20T09:00:05.094187175Z",
"Status": "exited"
},
"Config": {
"Cmd": [
"bash",
"-c",
"x=a; while true; do x=$x$x$x$x; done"
],
"Entrypoint": null,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Image": "reg.docker.alibaba-inc.com/sunyuan/ubuntu:14.04",
"OnBuild": null,
"Shell": null
}
}
]

Copy link
Collaborator

Choose a reason for hiding this comment

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

I discussed with @HusterWan offline. And currently we have no way to be noticed that a container is under OOM. in moby, there is event policy to tell users.

@allencloud
Copy link
Collaborator

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Jun 22, 2018
@allencloud allencloud merged commit 40928ca into AliyunContainerService:master Jun 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
areas/test LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants