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

remove redandunt check for imagestore create #1800

Merged
merged 1 commit into from Nov 28, 2017

Conversation

yanxuean
Copy link
Member

  1. remove redandunt check for imagestore create
  2. correct check object for imagestore update

Signed-off-by: yanxuean yan.xuean@zte.com.cn

@codecov-io
Copy link

codecov-io commented Nov 23, 2017

Codecov Report

Merging #1800 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1800      +/-   ##
==========================================
+ Coverage   48.71%   48.73%   +0.01%     
==========================================
  Files          81       81              
  Lines        8116     8113       -3     
==========================================
  Hits         3954     3954              
+ Misses       3515     3513       -2     
+ Partials      647      646       -1
Flag Coverage Δ
#linux 48.79% <100%> (+0.01%) ⬆️
#windows 44.94% <100%> (+0.02%) ⬆️
Impacted Files Coverage Δ
metadata/images.go 58.06% <100%> (+0.79%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update abeb262...3b670eb. Read the comment docs.

@@ -177,7 +173,7 @@ func (s *imageStore) Update(ctx context.Context, image images.Image, fieldpaths
updated = image
}

if err := validateImage(&image); err != nil {
if err := validateImage(&updated); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a test case that fails without this change?

Copy link
Member

Choose a reason for hiding this comment

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

I am trying to think of a test case here that would meet that criteria. A test could exist which errors with invalid values in image but are not in the field path and therefore do not get set in updated, however I am not sure that is a useful test. We currently don't enforce the overall label size so can't test that the update pushes the resulting updated into an invalid state. Every other invalid input I can think of would fail with both image and updated.

Copy link
Member

Choose a reason for hiding this comment

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

@dmcgowan The problem here is that I've scoured this code twice and seen this mistake twice. I am not sure this actually matters if we don't think a test case can catch it.

A possible test case here would be to have a field that is validated with a wrong value, but not a part of the field path. Its possible none may exist for the image type.

Copy link
Member

Choose a reason for hiding this comment

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

@yanxuean To be clear, no need to add a test for this case, as its not possible. ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I agree

@dmcgowan
Copy link
Member

nit: typo in commit message redandunt -> redundant

@stevvooe
Copy link
Member

LGTM

The test doesn't seem possible or necessary. I'll give this a day for the spelling error to correct itself.

@yanxuean
Copy link
Member Author

nit: typo in commit message redandunt -> redundant

done @dmcgowan

correct check object for imagestore update
Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
@stevvooe
Copy link
Member

LGTM

1 similar comment
@dmcgowan
Copy link
Member

LGTM

@dmcgowan dmcgowan merged commit f011bec into containerd:master Nov 28, 2017
@yanxuean yanxuean deleted the image-store-redandunt branch November 28, 2017 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants