From aa3dfeabf47d30a74fb66045e3930e14b385b3ff Mon Sep 17 00:00:00 2001 From: Matej Vasek Date: Wed, 19 Jul 2023 17:13:27 +0200 Subject: [PATCH] fixup: platform tests Signed-off-by: Matej Vasek --- pkg/docker/platform_test.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/pkg/docker/platform_test.go b/pkg/docker/platform_test.go index 4cdff8c3b6..edd5eaed41 100644 --- a/pkg/docker/platform_test.go +++ b/pkg/docker/platform_test.go @@ -16,8 +16,6 @@ import ( "github.com/google/go-containerregistry/pkg/v1/empty" "github.com/google/go-containerregistry/pkg/v1/mutate" "github.com/google/go-containerregistry/pkg/v1/remote" - gcrTypes "github.com/google/go-containerregistry/pkg/v1/types" - "knative.dev/func/pkg/docker" ) @@ -52,16 +50,9 @@ func TestPlatform(t *testing.T) { t.Fatal(err) } - zeroHash := v1.Hash{ - Algorithm: "sha256", - Hex: "0000000000000000000000000000000000000000000000000000000000000000", - } - var imgIdx = mutate.AppendManifests(empty.Index, mutate.IndexAddendum{ - Add: empty.Index, + Add: img, Descriptor: v1.Descriptor{ - MediaType: gcrTypes.DockerManifestList, - Digest: zeroHash, Platform: &v1.Platform{ Architecture: "ppc64le", OS: "linux", @@ -99,8 +90,13 @@ func TestPlatform(t *testing.T) { if err != nil { t.Errorf("unexpeced error: %v", err) } - if ref != testRegistry+"/default/builder@sha256:0000000000000000000000000000000000000000000000000000000000000000" { - t.Error("incorrect reference") + + imgDigest, err := img.Digest() + if err != nil { + t.Fatal(err) + } + if ref != testRegistry+"/default/builder@"+imgDigest.String() { + t.Errorf("incorrect reference: %q", ref) } }