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

fix: make cpuquota, MemorySwappiness validation compatible with docker #2474

Merged
merged 1 commit into from
Nov 19, 2018

Conversation

zhuangqh
Copy link
Contributor

Signed-off-by: zhuangqh zhuangqhc@gmail.com

Ⅰ. Describe what this PR did

correct validation rule

  • CpuQuota: -1, 0, >= 1000
  • MemorySwappiness: [-1, 100]

refactor: logCreateOption before validation, it enable developer to see what's wrong.

Ⅱ. Does this pull request fix one issue?

fixes #2473

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

stricter validation in github.com/alibaba/pouch/daemon/mgr/container_validation.go

@codecov
Copy link

codecov bot commented Nov 19, 2018

Codecov Report

Merging #2474 into master will decrease coverage by 0.03%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2474      +/-   ##
==========================================
- Coverage      69%   68.96%   -0.04%     
==========================================
  Files         277      277              
  Lines       18298    18298              
==========================================
- Hits        12626    12619       -7     
- Misses       4246     4253       +7     
  Partials     1426     1426
Flag Coverage Δ
#criv1alpha1test 31.6% <0%> (+0.02%) ⬆️
#criv1alpha2test 35.76% <0%> (+0.08%) ⬆️
#integrationtest 40.28% <83.33%> (-0.12%) ⬇️
#nodee2etest 33.03% <0%> (-0.04%) ⬇️
#unittest 26.68% <0%> (ø) ⬆️
Impacted Files Coverage Δ
daemon/mgr/container_validation.go 43.75% <0%> (+1.25%) ⬆️
apis/server/network_bridge.go 63.63% <100%> (ø) ⬆️
apis/server/exec_bridge.go 63.95% <100%> (ø) ⬆️
apis/server/volume_bridge.go 86.66% <100%> (ø) ⬆️
apis/server/container_bridge.go 87.42% <100%> (ø) ⬆️
daemon/mgr/system.go 67.93% <0%> (-5.35%) ⬇️
ctrd/watch.go 78.78% <0%> (-4.55%) ⬇️
cri/v1alpha2/cri_wrapper.go 63.6% <0%> (-1.2%) ⬇️
cri/v1alpha2/cri_utils.go 91.17% <0%> (-0.3%) ⬇️
cri/v1alpha2/cri.go 70.29% <0%> (ø) ⬆️
... and 3 more

@pouchrobot pouchrobot added kind/bug This is bug report for project size/M labels Nov 19, 2018
apis/swagger.yml Outdated
@@ -2663,7 +2662,7 @@ definitions:
description: "Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add more details in the description?

@@ -115,7 +115,7 @@ func (suite *PouchRunMemorySuite) TestRunWithMemoryswappiness(c *check.C) {
"--memory-swappiness", "-1",
"--name", cname, busyboxImage, "top")
DelContainerForceMultyTime(c, cname)
c.Assert(res.ExitCode, check.Equals, 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

If we use the swagger validation, this test case should not passed, Right?

refactor: logCreateOption before validation, it enable developer to see what's wrong.

Signed-off-by: zhuangqh <zhuangqhc@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wrong validation in api swagger
5 participants