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

bugfix: add check for json-file log opt #2306

Merged
merged 1 commit into from
Oct 15, 2018

Conversation

ZYecho
Copy link
Contributor

@ZYecho ZYecho commented Oct 12, 2018

Signed-off-by: zhangyue zy675793960@yeah.net

Ⅰ. Describe what this PR did

check the pouch if run with unsupported log options.

Ⅱ. Does this pull request fix one issue?

fix issue #2276

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

None.

Ⅳ. Describe how to verify it

pouch run --name=test --log-opt env1=baz busybox echo hello
Get
Error: failed to run container: {"message":"unknown log opt 'env1' for json-file log driver"}

Ⅴ. Special notes for reviews

None.

@codecov
Copy link

codecov bot commented Oct 12, 2018

Codecov Report

Merging #2306 into master will increase coverage by 0.08%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2306      +/-   ##
==========================================
+ Coverage   66.97%   67.05%   +0.08%     
==========================================
  Files         211      211              
  Lines       17306    17316      +10     
==========================================
+ Hits        11591    11612      +21     
+ Misses       4312     4306       -6     
+ Partials     1403     1398       -5
Flag Coverage Δ
#criv1alpha1test 32.15% <27.27%> (+0.07%) ⬆️
#criv1alpha2test 35.75% <27.27%> (+0.15%) ⬆️
#integrationtest 40.28% <100%> (+0.09%) ⬆️
#nodee2etest 33.14% <27.27%> (+0.02%) ⬆️
#unittest 23.39% <0%> (-0.02%) ⬇️
Impacted Files Coverage Δ
daemon/mgr/container_validation.go 45.09% <100%> (ø) ⬆️
daemon/logger/jsonfile/jsonfile.go 77.77% <100%> (+8.54%) ⬆️
daemon/mgr/snapshot.go 89.85% <0%> (-4.35%) ⬇️
daemon/mgr/container.go 57.43% <0%> (+0.2%) ⬆️
daemon/mgr/container_utils.go 84.33% <0%> (+1.2%) ⬆️
pkg/meta/store.go 64.06% <0%> (+1.56%) ⬆️
ctrd/container.go 59.76% <0%> (+1.9%) ⬆️

@pouchrobot pouchrobot added areas/log kind/bug This is bug report for project size/S labels Oct 12, 2018
func ValidateLogOpt(cfg map[string]string) error {
for key := range cfg {
switch key {
case "max-file":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add all these valid type in a single slice?
And we could check if the input type is in the slice. Then we could make the detailed implemented function decoupled from the specific string, but only a parameter of slice.

@allencloud
Copy link
Collaborator

I think we should add some integration test for this feature. WDYT? @ZYecho

@@ -11,6 +11,7 @@ import (
"github.com/alibaba/pouch/daemon/logger/syslog"
"github.com/alibaba/pouch/pkg/system"

"github.com/alibaba/pouch/daemon/logger/jsonfile"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove the blank line before this import line and add a blank line below it.

Signed-off-by: zhangyue <zy675793960@yeah.net>
@ZYecho
Copy link
Contributor Author

ZYecho commented Oct 12, 2018

I think we should add some integration test for this feature. WDYT? @ZYecho

done.

@fuweid
Copy link
Contributor

fuweid commented Oct 15, 2018

LGTM

@fuweid fuweid added this to the v1.1 milestone Oct 15, 2018
@fuweid fuweid merged commit abff661 into AliyunContainerService:master Oct 15, 2018
@ZYecho ZYecho deleted the add-logopt-check branch November 6, 2018 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
areas/log kind/bug This is bug report for project size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants