-
Notifications
You must be signed in to change notification settings - Fork 950
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
Conversation
Codecov Report
@@ 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
|
daemon/logger/jsonfile/jsonfile.go
Outdated
func ValidateLogOpt(cfg map[string]string) error { | ||
for key := range cfg { | ||
switch key { | ||
case "max-file": |
There was a problem hiding this comment.
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.
I think we should add some integration test for this feature. WDYT? @ZYecho |
daemon/mgr/container_validation.go
Outdated
@@ -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" |
There was a problem hiding this comment.
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.
a220b86
to
ce7cb9b
Compare
Signed-off-by: zhangyue <zy675793960@yeah.net>
ce7cb9b
to
dee059d
Compare
done. |
LGTM |
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.