diff --git a/internal/platform/platform_test.go b/internal/platform/platform_test.go index 4e19a770..89466e6e 100644 --- a/internal/platform/platform_test.go +++ b/internal/platform/platform_test.go @@ -289,7 +289,8 @@ func TestSelectManifest(t *testing.T) { t.Fatalf("failed to push test content to src: %d: %v", i, err) } } - // test SelectManifest on image index, only one matching manifest found + + // Test SelectManifest on an image index when no platform exists in the manifest list and a target platform is provided root = descs[4] targetPlatform = ocispec.Platform{ Architecture: arc_1, @@ -301,6 +302,16 @@ func TestSelectManifest(t *testing.T) { t.Fatalf("SelectManifest() error = %v, wantErr %v", err, expected) } + // Test SelectManifest on an image index when no platform exists in the manifest list and no target platform is provided + wantDesc = descs[3] + gotDesc, err = SelectManifest(ctx, storage, root, nil) + if err != nil { + t.Fatalf("SelectManifest() error = %v, wantErr %v", err, false) + } + if !reflect.DeepEqual(gotDesc, wantDesc) { + t.Errorf("SelectManifest() = %v, want %v", gotDesc, wantDesc) + } + // generate incorrect test content storage = cas.NewMemory() blobs = nil