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

Don’t compute onbuild triggers for images that are stage names #938

Merged
merged 2 commits into from
Sep 6, 2018

Conversation

dgageot
Copy link
Contributor

@dgageot dgageot commented Aug 29, 2018

Fix #502

@dgageot dgageot requested review from balopat and r2d4 as code owners August 29, 2018 16:17
@codecov-io
Copy link

codecov-io commented Aug 29, 2018

Codecov Report

Merging #938 into master will increase coverage by 0.16%.
The diff coverage is 92.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #938      +/-   ##
==========================================
+ Coverage   43.38%   43.55%   +0.16%     
==========================================
  Files          63       63              
  Lines        2639     2645       +6     
==========================================
+ Hits         1145     1152       +7     
+ Misses       1374     1373       -1     
  Partials      120      120
Impacted Files Coverage Δ
pkg/skaffold/docker/parse.go 70.53% <92.85%> (+1.26%) ⬆️

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 e78bf17...38728de. Read the comment docs.

@dgageot
Copy link
Contributor Author

dgageot commented Aug 31, 2018

ping @balopat @r2d4 Could you TAL?
In another PR, I'd like to refactor the code that parses the Dockerfiles

Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

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

one testing related issue, otherwise LGTM

@@ -171,6 +176,10 @@ var ImageConfigs = map[string]*v1.ConfigFile{
}

func mockRetrieveImage(image string) (*v1.ConfigFile, error) {
if image == "base" {
panic("we should never retrieve images which are stage names")
Copy link
Contributor

Choose a reason for hiding this comment

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

panic is considered a bad practice in testing as it stops the test execution - can we just return an error, or pass in testing.T?

Copy link
Contributor

Choose a reason for hiding this comment

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

also assertion logic should not be embedded in the mock, this makes a test hard to understand.

Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: reorganize the mock with usual "capture" semantics, that records the calls as a slice of strings and make the retrieved images an explicit assertion in the tests.

@dgageot
Copy link
Contributor Author

dgageot commented Sep 5, 2018

@balopat should be all good now.

@dgageot dgageot merged commit 0592b2b into GoogleContainerTools:master Sep 6, 2018
@dgageot dgageot deleted the fix-502 branch December 28, 2018 07:11
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.

3 participants