Skip to content

Commit

Permalink
add ut
Browse files Browse the repository at this point in the history
Signed-off-by: Zoey Li <[email protected]>
  • Loading branch information
lizMSFT committed Jan 25, 2024
1 parent 1b64aef commit 9a15291
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/platform/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit 9a15291

Please sign in to comment.