Skip to content

Commit e0be0af

Browse files
committed
[PRFix modify err msg]
Signed-off-by: Zoey Li <zoeyli@microsoft.com>
1 parent cb89654 commit e0be0af

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

copy_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ func TestCopy_WithTargetPlatformOptions(t *testing.T) {
978978
}
979979

980980
_, err = oras.Copy(ctx, src, ref, dst, "", opts)
981-
expected = fmt.Sprintf("fail to recognize media type %s: expect %s", docker.MediaTypeConfig, ocispec.MediaTypeImageConfig)
981+
expected = fmt.Sprintf("fail to recognize platform from unknown config %s: expect %s", docker.MediaTypeConfig, ocispec.MediaTypeImageConfig)
982982
if err.Error() != expected {
983983
t.Fatalf("Copy() error = %v, wantErr %v", err, expected)
984984
}

internal/platform/platform.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func SelectManifest(ctx context.Context, src content.ReadOnlyStorage, root ocisp
118118
// fields in config blob.
119119
func getPlatformFromConfig(ctx context.Context, src content.ReadOnlyStorage, desc ocispec.Descriptor, targetConfigMediaType string) (*ocispec.Platform, error) {
120120
if desc.MediaType != targetConfigMediaType {
121-
return nil, fmt.Errorf("fail to recognize media type %s: expect %s", desc.MediaType, targetConfigMediaType)
121+
return nil, fmt.Errorf("fail to recognize platform from unknown config %s: expect %s", desc.MediaType, targetConfigMediaType)
122122
}
123123

124124
rc, err := src.Fetch(ctx, desc)

internal/platform/platform_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func TestSelectManifest(t *testing.T) {
291291
OS: os_1,
292292
}
293293
_, err = SelectManifest(ctx, storage, root, &targetPlatform)
294-
expected = fmt.Sprintf("fail to recognize media type %s: expect %s", docker.MediaTypeConfig, ocispec.MediaTypeImageConfig)
294+
expected = fmt.Sprintf("fail to recognize platform from unknown config %s: expect %s", docker.MediaTypeConfig, ocispec.MediaTypeImageConfig)
295295
if err.Error() != expected {
296296
t.Fatalf("SelectManifest() error = %v, wantErr %v", err, expected)
297297
}

0 commit comments

Comments
 (0)