Skip to content

Commit

Permalink
Merge pull request #1744 from joe-kimmel-vmw/jkutner/dep-updates
Browse files Browse the repository at this point in the history
inspect image: add one unit test
  • Loading branch information
natalieparellano authored May 5, 2023
2 parents 8e03c74 + 0ca7318 commit dee7a7e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/client/inspect_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (c *Client) InspectImage(name string, daemon bool) (*ImageInfo, error) {
}

var stackCompat platform.StackMetadata
if layersMd.RunImage.Image != "" { // TODO: add unit
if layersMd.RunImage.Image != "" {
stackCompat = layersMd.RunImage.ToStackMetadata()
} else {
stackCompat = layersMd.Stack
Expand Down
17 changes: 17 additions & 0 deletions pkg/client/inspect_image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,23 @@ func testInspectImage(t *testing.T, when spec.G, it spec.S) {
h.AssertEq(t, infoWithExtension.StackID, "test.stack.id")
})

it("returns the stack from runImage.Image if set", func() {
h.AssertNil(t, mockImage.SetLabel(
"io.buildpacks.lifecycle.metadata",
`{
"runImage": {
"topLayer": "some-top-layer",
"reference": "some-run-image-reference",
"image": "is everything"
}
}`,
))
info, err := subject.InspectImage("some/image", useDaemon)
h.AssertNil(t, err)
h.AssertEq(t, info.Stack,
platform.StackMetadata{RunImage: platform.RunImageForExport{Image: "is everything"}})
})

it("returns the stack", func() {
info, err := subject.InspectImage("some/image", useDaemon)
h.AssertNil(t, err)
Expand Down

0 comments on commit dee7a7e

Please sign in to comment.