Skip to content

Commit

Permalink
fixup: platform tests
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Vasek <[email protected]>
  • Loading branch information
matejvasek committed Jul 19, 2023
1 parent 40a13bb commit aa3dfea
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions pkg/docker/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
}
}

Expand Down

0 comments on commit aa3dfea

Please sign in to comment.