Skip to content

Commit

Permalink
Avoid comparing uncompressed and compressed images in the unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
chhsia0 committed Aug 24, 2019
1 parent 11f3b79 commit ba9b616
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions pkg/executor/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ func Test_OCILayoutPath(t *testing.T) {
t.Fatalf("could not get image digest: %s", err)
}

want, err := image.Manifest()
if err != nil {
t.Fatalf("could not get image manifest: %s", err)
}

opts := config.KanikoOptions{
NoPush: true,
OCILayoutPath: tmpDir,
Expand All @@ -100,12 +105,17 @@ func Test_OCILayoutPath(t *testing.T) {
t.Fatalf("could not push image: %s", err)
}

index, err := layout.ImageIndexFromPath(tmpDir)
layoutIndex, err := layout.ImageIndexFromPath(tmpDir)
if err != nil {
t.Fatalf("could not get index from layout: %s", err)
}
testutil.CheckError(t, false, validate.Index(index))
testutil.CheckError(t, false, validate.Index(layoutIndex))

layoutImage, err := layoutIndex.Image(digest)
if err != nil {
t.Fatalf("could not get image from layout: %s", err)
}

got, err := index.Image(digest)
testutil.CheckErrorAndDeepEqual(t, false, err, image, got)
got, err := layoutImage.Manifest()
testutil.CheckErrorAndDeepEqual(t, false, err, want, got)
}

0 comments on commit ba9b616

Please sign in to comment.