-
Notifications
You must be signed in to change notification settings - Fork 293
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
inspect-builder throws error with missing remote and local builder #406
Conversation
internal/commands/inspect_builder.go
Outdated
remoteOutput, remoteWarnings, remoteErr := inspectBuilderOutput(client, cfg, imageName, false) | ||
localOutput, localWarnings, localErr := inspectBuilderOutput(client, cfg, imageName, true) | ||
|
||
if remoteOutput == "(not present)" && localOutput == "(not present)" { |
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.
I would feel more comfortable with a string comparison if it was a constant used inside the inspectBuilderOutput
function and in this statement.
Alternatively, an additional return value similar to how maps returns a boolean value (ok
) if it was found would work here.
No strong opinion either way but something should be changed to not just do arbitrary freeform string comparisons IMO.
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.
Did the 2nd option and added additional return value 'present'
@@ -60,14 +60,12 @@ func testInspectBuilderCommand(t *testing.T, when spec.G, it spec.S) { | |||
|
|||
when("#Get", func() { | |||
when("image cannot be found", func() { | |||
it("logs 'Not present'", func() { | |||
it("logs 'ERROR Unable'", 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.
This should read it("errors when no image is found")
or something similar.
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 also need at least one test (preferably two) where we test when only one of the two is returned and ensure it doesn't error.
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.
Done and done after reorganizing test data.
Signed-off-by: ktpv <ktpv@users.noreply.github.com>
Signed-off-by: ktpv ktpv@users.noreply.github.com