-
Notifications
You must be signed in to change notification settings - Fork 112
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
FIXME: pass the logger and print the warning inside #1038
FIXME: pass the logger and print the warning inside #1038
Conversation
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
@natalieparellano I started working on this issue, and I was hoping to get suggestions on how to tackle this. |
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.
@anushkamittal20 this looks great! Apologies for the slow reply (I've been out). You are definitely on the right track! It would be good to add a couple tests in layermetadata_test.go. You can construct a "spy" logger for this, if you search for assertLogEntry
you'll find where we do something similar elsewhere.
Thank you very much for the review @natalieparellano. |
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
…nto FIXME-warning-inside-func
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
7ee1b30
to
ef1e4d4
Compare
@natalieparellano , sorry it took a bit, I have tried to implement the change, and the current implementation works as well. Please let me know if you need any corrections. Thank you for taking the time to help!
Thank you! |
@anushkamittal20 I think you forgot to run |
@anushkamittal20 I think (though I'm not sure) that the logic you quoted should move inside |
@jjbustamante, I will run |
…nto FIXME-warning-inside-func
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
Looks like it needs another |
…nto FIXME-warning-inside-func
@anushkamittal20 any update on this one? |
@natalieparellano wanted to update you on this. |
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
buildpack/layermetadata.go
Outdated
logger.Warn(str) | ||
if !api.MustParse(buildpackAPI).LessThan("0.6") { | ||
return LayerMetadataFile{}, errors.New(str) | ||
} |
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.
logger.Warn(str) | |
if !api.MustParse(buildpackAPI).LessThan("0.6") { | |
return LayerMetadataFile{}, errors.New(str) | |
} | |
if api.MustParse(buildpackAPI).LessThan("0.6") { | |
logger.Warn(str) | |
} else { | |
return LayerMetadataFile{}, errors.New(str) | |
} |
I think this is what we want... the test failures may be due to a test needing to be updated
buildpack/layermetadata_test.go
Outdated
h.AssertEq(t, lmf.Cache, true) | ||
h.AssertEq(t, lmf.Build, false) | ||
h.AssertEq(t, lmf.Launch, false) | ||
}) | ||
it("metadata file in wrong format", func() { |
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.
it("metadata file in wrong format", func() { | |
it("logs a warning when the metadata file has wrong format (on older apis)", func() { |
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.
We can make another it
block for returns an error when the metadata file has wrong format
that provides a newer buildpack API on the equivalent of line 59
buildpack/layermetadata_test.go
Outdated
h.AssertNil(t, err) | ||
|
||
var lmf buildpack.LayerMetadataFile | ||
lmf, _ = buildpack.DecodeLayerMetadataFile(metadataFile.Name(), "0.9", logger) |
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.
lmf, _ = buildpack.DecodeLayerMetadataFile(metadataFile.Name(), "0.9", logger) | |
lmf, err := buildpack.DecodeLayerMetadataFile(metadataFile.Name(), "0.5", logger) | |
h.AssertNil(t, err) |
@anushkamittal20 thanks for taking another look at this. I think it's on the right track, we just need two different test cases for old and new buildpack API. |
Hey @natalieparellano, thank you very much for your review. |
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
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.
Looks great! Awesome work @anushkamittal20 - thanks so much for the PR ❤️
References: issue
slack thread
I have made changes to remove the message returned from
DecodeLayerMetadataFile
and the consequent changes that were required.