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

refactor: merge different validate funtions #1730

Merged
merged 1 commit into from
Aug 3, 2018
Merged

refactor: merge different validate funtions #1730

merged 1 commit into from
Aug 3, 2018

Conversation

Ace-Tang
Copy link
Contributor

merge validateLogConfig into validateConfig, and move validate functions
into file daemon/mgr/container_validation.go

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

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@Ace-Tang
Copy link
Contributor Author

@fuweid , please take a carefully review to see whether I miss something

// validate log config
if err := mgr.validateLogConfig(container); err != nil {
return nil, err
Root: mgr.ContainerRoot(id),
Copy link
Contributor

Choose a reason for hiding this comment

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

Please consider the migration. If the container is existing, the Root must be empty. I think we can use the util function to return the path. make senses?

@pouchrobot
Copy link
Collaborator

ping @Ace-Tang

CI fails according integration system.
Please refer to the CI failure Details button to corresponding test, and update your PR to pass CI.

If this is flaky test, welcome to track this with profiling an issue.

build url: https://travis-ci.org/alibaba/pouch/builds/404315435
build duration: 2397s

@codecov-io
Copy link

codecov-io commented Jul 17, 2018

Codecov Report

Merging #1730 into master will decrease coverage by <.01%.
The diff coverage is 27.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1730      +/-   ##
==========================================
- Coverage   63.83%   63.82%   -0.01%     
==========================================
  Files         201      201              
  Lines       15528    15526       -2     
==========================================
- Hits         9912     9910       -2     
+ Misses       4380     4379       -1     
- Partials     1236     1237       +1
Flag Coverage Δ
#criv1alpha1test 33.68% <14.42%> (+0.01%) ⬆️
#criv1alpha2test 34.22% <14.42%> (+0.04%) ⬆️
#integrationtest 38.5% <27.88%> (-0.02%) ⬇️
#unittest 22.78% <0%> (ø) ⬆️
Impacted Files Coverage Δ
daemon/mgr/container_logger.go 84.61% <ø> (ø) ⬆️
daemon/mgr/container_utils.go 85.18% <ø> (+25.61%) ⬆️
daemon/mgr/container.go 53.93% <100%> (-0.08%) ⬇️
daemon/mgr/container_validation.go 30.43% <27.18%> (-16.24%) ⬇️
ctrd/watch.go 72.72% <0%> (-3.04%) ⬇️
daemon/logger/jsonfile/utils.go 71.54% <0%> (-1.63%) ⬇️
cri/v1alpha2/cri.go 66.13% <0%> (+0.17%) ⬆️

@@ -378,7 +373,7 @@ func (mgr *ContainerManager) Create(ctx context.Context, name string, config *ty
amendContainerSettings(&config.ContainerConfig, config.HostConfig)

// validate container Config
warnings, err := validateConfig(&config.ContainerConfig, config.HostConfig, false)
warnings, err := mgr.validateConfig(container, false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I do not think validation part should locate in the manager.
Is there anyways to locate them in the bridge layer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I remember @fuweid has explained once. ping @fuweid

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, we have lots of configs have related with daemon, so we cannot put validate into api bridge, that not make sense.

merge validateLogConfig into validateConfig, and move validate functions
into file daemon/mgr/container_validation.go

Signed-off-by: Ace-Tang <[email protected]>
Copy link
Contributor

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM @Ace-Tang thanks !

@fuweid fuweid merged commit a97c205 into AliyunContainerService:master Aug 3, 2018
@Ace-Tang Ace-Tang deleted the merge_validate_log branch August 3, 2018 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants