From afa3e215c423339fb5ea12e7bf365139e259c256 Mon Sep 17 00:00:00 2001 From: Joey Brown Date: Thu, 7 Nov 2024 17:18:01 -0600 Subject: [PATCH] ensure tests pass on arm64 Signed-off-by: Joey Brown --- local/local_test.go | 2 +- remote/remote_test.go | 9 ++++++--- testhelpers/testhelpers.go | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/local/local_test.go b/local/local_test.go index 134248fa..678383a8 100644 --- a/local/local_test.go +++ b/local/local_test.go @@ -717,7 +717,7 @@ func testImage(t *testing.T, when spec.G, it spec.S) { h.AssertNil(t, err) // based on static base image refs - expectedTime := time.Date(2018, 10, 2, 17, 19, 34, 239926273, time.UTC) + expectedTime := time.Date(2024, 9, 26, 21, 31, 42, 0, time.UTC) if daemonOS == "windows" { expectedTime = time.Date(2020, 03, 04, 13, 28, 48, 673000000, time.UTC) } diff --git a/remote/remote_test.go b/remote/remote_test.go index 56627807..c50a5f94 100644 --- a/remote/remote_test.go +++ b/remote/remote_test.go @@ -270,9 +270,12 @@ func testImage(t *testing.T, when spec.G, it spec.S) { }) when("base image is a multi-OS/Arch manifest list", func() { - it("returns a base image matching linux/amd64", func() { + it("returns a base image matching linux/architecture", func() { manifestListName := "golang:1.13.8" - existingLayerSha := "sha256:427da4a135b0869c1a274ba38e23d45bdbda93134c4ad99c8900cb0cfe9f0c9e" + existingLayerDigests := map[string]string{ + "amd64": "sha256:427da4a135b0869c1a274ba38e23d45bdbda93134c4ad99c8900cb0cfe9f0c9e", + "arm64": "sha256:c50765ba68c46491618574144955985555c2c7584137e69a0bd1017f411111d2", + } img, err := remote.NewImage( repoName, @@ -293,7 +296,7 @@ func testImage(t *testing.T, when spec.G, it spec.S) { h.AssertNil(t, err) h.AssertEq(t, arch, runtime.GOARCH) - readCloser, err := img.GetLayer(existingLayerSha) + readCloser, err := img.GetLayer(existingLayerDigests[runtime.GOARCH]) h.AssertNil(t, err) defer readCloser.Close() }) diff --git a/testhelpers/testhelpers.go b/testhelpers/testhelpers.go index 179ec902..5c522cad 100644 --- a/testhelpers/testhelpers.go +++ b/testhelpers/testhelpers.go @@ -413,7 +413,7 @@ func RunnableBaseImage(os string) string { // windows/amd64 image from manifest cached on github actions Windows 2019 workers: https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md#docker-images return "mcr.microsoft.com/windows/nanoserver@sha256:08c883692e527b2bb4d7f6579e7707a30a2aaa66556b265b917177565fd76117" } - return "busybox@sha256:915f390a8912e16d4beb8689720a17348f3f6d1a7b659697df850ab625ea29d5" + return "busybox@sha256:768e5c6f5cb6db0794eec98dc7a967f40631746c32232b78a3105fb946f3ab83" } func StringElementAt(elements []string, offset int) string {