fix: normalize default arm64 v8 image platform
This commit is contained in:
@@ -161,6 +161,18 @@ func TestReleaseGitEnvironmentAndFailure(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPinnedReleaseWorkerAdmissionAndBlock(t *testing.T) {
|
||||
testPinnedReleaseWorkerAdmissionAndBlock(t, "")
|
||||
}
|
||||
|
||||
func TestPinnedReleaseWorkerARM64V8AdmissionAndBlock(t *testing.T) {
|
||||
previous := imagePlatform
|
||||
imagePlatform = "linux/arm64"
|
||||
t.Cleanup(func() { imagePlatform = previous })
|
||||
testPinnedReleaseWorkerAdmissionAndBlock(t, "v8")
|
||||
}
|
||||
|
||||
func testPinnedReleaseWorkerAdmissionAndBlock(t *testing.T, variant string) {
|
||||
t.Helper()
|
||||
info := releaseFixture()
|
||||
labels := map[string]string{"dsh-mgr.role": "runtime", "dsh-mgr.version": info.Version, "dsh-mgr.recipe": "7", "dsh-mgr.release": info.ReleaseID, "dsh-mgr.source": info.Repository, "dsh-mgr.commit": info.Commit}
|
||||
a, _ := imageTestAPI(t, func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -180,7 +192,7 @@ func TestPinnedReleaseWorkerAdmissionAndBlock(t *testing.T) {
|
||||
io.WriteString(w, `{"aux":{"ID":"sha256:release"}}`)
|
||||
case "/v1.47/images/sha256:release/json":
|
||||
parts := strings.Split(imagePlatform, "/")
|
||||
writeJSON(w, map[string]any{"Id": "sha256:release", "Os": parts[0], "Architecture": parts[1], "Config": map[string]any{"Labels": labels}})
|
||||
writeJSON(w, map[string]any{"Id": "sha256:release", "Os": parts[0], "Architecture": parts[1], "Variant": variant, "Config": map[string]any{"Labels": labels}})
|
||||
case "/v1.47/containers/create":
|
||||
var cfg struct {
|
||||
Image, User string
|
||||
@@ -235,6 +247,10 @@ func TestPinnedReleaseWorkerAdmissionAndBlock(t *testing.T) {
|
||||
if b.Status != "success" {
|
||||
t.Fatalf("%+v", b)
|
||||
}
|
||||
records := []buildRecord{b}
|
||||
if err = a.reconcileBuilds(context.Background(), records); err != nil || records[0].Status != "success" {
|
||||
t.Fatalf("reconciliation: %+v %v", records, err)
|
||||
}
|
||||
im, err := a.evaluateImage(context.Background(), b.ImageID)
|
||||
if err != nil || !im.Selectable {
|
||||
t.Fatalf("%+v %v", im, err)
|
||||
|
||||
Reference in New Issue
Block a user