fix: normalize default arm64 v8 image platform

This commit is contained in:
2026-10-15 09:50:30 +08:00
parent 56c8f76e32
commit f6fc681a68
3 changed files with 45 additions and 1 deletions
+22
View File
@@ -13,6 +13,28 @@ import (
"testing"
)
func TestInspectedImagePlatform(t *testing.T) {
for _, tc := range []struct{ os, arch, variant, want string }{
{"linux", "arm64", "", "linux/arm64"},
{"linux", "arm64", "v8", "linux/arm64"},
{"linux", "arm64", "v9", "linux/arm64/v9"},
{"linux", "arm64", "v8.1", "linux/arm64/v8.1"},
{"linux", "arm", "v7", "linux/arm/v7"},
{"linux", "arm", "v8", "linux/arm/v8"},
{"linux", "amd64", "", "linux/amd64"},
{"linux", "amd64", "v8", "linux/amd64/v8"},
{"", "arm64", "v8", ""},
{"linux", "", "v8", ""},
} {
t.Run(tc.os+"/"+tc.arch+"/"+tc.variant, func(t *testing.T) {
im := inspectedImage{Os: tc.os, Architecture: tc.arch, Variant: tc.variant}
if got := im.platform(); got != tc.want {
t.Fatalf("platform() = %q, want %q", got, tc.want)
}
})
}
}
func TestImageLegacyMigrationNeverCertifies(t *testing.T) {
a, sid := imageTestAPI(t, func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/v1.47/images/json" {