@@ -25,6 +25,7 @@ import (
2525 "github.com/containerd/containerd/diff/apply"
2626 "github.com/containerd/containerd/diff/walking"
2727 "github.com/containerd/containerd/errdefs"
28+ "github.com/containerd/containerd/labels"
2829 "github.com/containerd/containerd/leases"
2930 ctdmetadata "github.com/containerd/containerd/metadata"
3031 "github.com/containerd/containerd/mount"
@@ -731,7 +732,7 @@ func TestSetBlob(t *testing.T) {
731732 err = snap .(* immutableRef ).setBlob (ctx , ocispecs.Descriptor {
732733 Digest : digest .FromBytes ([]byte ("foobar" )),
733734 Annotations : map [string ]string {
734- "containerd.io/uncompressed" : digest .FromBytes ([]byte ("foobar2" )).String (),
735+ labels . LabelUncompressed : digest .FromBytes ([]byte ("foobar2" )).String (),
735736 },
736737 })
737738 require .Error (t , err )
@@ -742,7 +743,7 @@ func TestSetBlob(t *testing.T) {
742743 require .NoError (t , err )
743744
744745 snapRef = snap .(* immutableRef )
745- require .Equal (t , desc .Annotations ["containerd.io/uncompressed" ], string (snapRef .getDiffID ()))
746+ require .Equal (t , desc .Annotations [labels . LabelUncompressed ], string (snapRef .getDiffID ()))
746747 require .Equal (t , desc .Digest , snapRef .getBlob ())
747748 require .Equal (t , desc .MediaType , snapRef .getMediaType ())
748749 require .Equal (t , snapRef .getDiffID (), snapRef .getChainID ())
@@ -768,7 +769,7 @@ func TestSetBlob(t *testing.T) {
768769 require .NoError (t , err )
769770
770771 snapRef2 := snap2 .(* immutableRef )
771- require .Equal (t , desc2 .Annotations ["containerd.io/uncompressed" ], string (snapRef2 .getDiffID ()))
772+ require .Equal (t , desc2 .Annotations [labels . LabelUncompressed ], string (snapRef2 .getDiffID ()))
772773 require .Equal (t , desc2 .Digest , snapRef2 .getBlob ())
773774 require .Equal (t , desc2 .MediaType , snapRef2 .getMediaType ())
774775 require .Equal (t , digest .FromBytes ([]byte (snapRef .getChainID ()+ " " + snapRef2 .getDiffID ())), snapRef2 .getChainID ())
@@ -786,7 +787,7 @@ func TestSetBlob(t *testing.T) {
786787 require .NoError (t , err )
787788
788789 snapRef3 := snap3 .(* immutableRef )
789- require .Equal (t , desc3 .Annotations ["containerd.io/uncompressed" ], string (snapRef3 .getDiffID ()))
790+ require .Equal (t , desc3 .Annotations [labels . LabelUncompressed ], string (snapRef3 .getDiffID ()))
790791 require .Equal (t , desc3 .Digest , snapRef3 .getBlob ())
791792 require .Equal (t , desc3 .MediaType , snapRef3 .getMediaType ())
792793 require .Equal (t , digest .FromBytes ([]byte (snapRef .getChainID ()+ " " + snapRef3 .getDiffID ())), snapRef3 .getChainID ())
@@ -804,7 +805,7 @@ func TestSetBlob(t *testing.T) {
804805 b5 , desc5 , err := mapToBlob (map [string ]string {"foo5" : "bar5" }, true )
805806 require .NoError (t , err )
806807
807- desc5 .Annotations ["containerd.io/uncompressed" ] = snapRef2 .getDiffID ().String ()
808+ desc5 .Annotations [labels . LabelUncompressed ] = snapRef2 .getDiffID ().String ()
808809
809810 err = content .WriteBlob (ctx , co .cs , "ref5" , bytes .NewBuffer (b5 ), desc5 )
810811 require .NoError (t , err )
@@ -833,7 +834,7 @@ func TestSetBlob(t *testing.T) {
833834 require .NoError (t , err )
834835
835836 snapRef6 := snap6 .(* immutableRef )
836- require .Equal (t , desc6 .Annotations ["containerd.io/uncompressed" ], string (snapRef6 .getDiffID ()))
837+ require .Equal (t , desc6 .Annotations [labels . LabelUncompressed ], string (snapRef6 .getDiffID ()))
837838 require .Equal (t , desc6 .Digest , snapRef6 .getBlob ())
838839 require .Equal (t , digest .FromBytes ([]byte (snapRef3 .getChainID ()+ " " + snapRef6 .getDiffID ())), snapRef6 .getChainID ())
839840 require .Equal (t , digest .FromBytes ([]byte (snapRef3 .getBlobChainID ()+ " " + digest .FromBytes ([]byte (snapRef6 .getBlob ()+ " " + snapRef6 .getDiffID ())))), snapRef6 .getBlobChainID ())
@@ -843,7 +844,7 @@ func TestSetBlob(t *testing.T) {
843844 _ , err = cm .GetByBlob (ctx , ocispecs.Descriptor {
844845 Digest : digest .FromBytes ([]byte ("notexist" )),
845846 Annotations : map [string ]string {
846- "containerd.io/uncompressed" : digest .FromBytes ([]byte ("notexist" )).String (),
847+ labels . LabelUncompressed : digest .FromBytes ([]byte ("notexist" )).String (),
847848 },
848849 }, snap3 )
849850 require .Error (t , err )
@@ -1584,7 +1585,7 @@ func TestConversion(t *testing.T) {
15841585 }
15851586 require .Equal (t , recreatedDesc .Digest , orgDesc .Digest , testName )
15861587 require .NotNil (t , recreatedDesc .Annotations )
1587- require .Equal (t , recreatedDesc .Annotations ["containerd.io/uncompressed" ], orgDesc .Digest .String (), testName )
1588+ require .Equal (t , recreatedDesc .Annotations [labels . LabelUncompressed ], orgDesc .Digest .String (), testName )
15881589 return nil
15891590 })
15901591 }
@@ -1965,7 +1966,7 @@ func checkInfo(ctx context.Context, t *testing.T, cs content.Store, info content
19651966 if info .Labels == nil {
19661967 return
19671968 }
1968- uncompressedDgst , ok := info .Labels [containerdUncompressed ]
1969+ uncompressedDgst , ok := info .Labels [labels . LabelUncompressed ]
19691970 if ! ok {
19701971 return
19711972 }
@@ -1987,7 +1988,7 @@ func checkDescriptor(ctx context.Context, t *testing.T, cs content.Store, desc o
19871988 }
19881989
19891990 // Check annotations exist
1990- uncompressedDgst , ok := desc .Annotations [containerdUncompressed ]
1991+ uncompressedDgst , ok := desc .Annotations [labels . LabelUncompressed ]
19911992 require .True (t , ok , "uncompressed digest annotation not found: %q" , desc .Digest )
19921993 var uncompressedSize int64
19931994 if compressionType == compression .EStargz {
@@ -2579,7 +2580,7 @@ func mapToBlobWithCompression(m map[string]string, compress func(io.Writer) (io.
25792580 MediaType : mediaType ,
25802581 Size : int64 (buf .Len ()),
25812582 Annotations : map [string ]string {
2582- "containerd.io/uncompressed" : sha .Digest ().String (),
2583+ labels . LabelUncompressed : sha .Digest ().String (),
25832584 },
25842585 }, nil
25852586}
@@ -2631,7 +2632,7 @@ func fileToBlob(file *os.File, compress bool) ([]byte, ocispecs.Descriptor, erro
26312632 MediaType : mediaType ,
26322633 Size : int64 (buf .Len ()),
26332634 Annotations : map [string ]string {
2634- "containerd.io/uncompressed" : sha .Digest ().String (),
2635+ labels . LabelUncompressed : sha .Digest ().String (),
26352636 },
26362637 }, nil
26372638}
@@ -2688,7 +2689,7 @@ func mapToSystemTarBlob(t *testing.T, m map[string]string) ([]byte, ocispecs.Des
26882689 MediaType : ocispecs .MediaTypeImageLayer ,
26892690 Size : int64 (len (tarout )),
26902691 Annotations : map [string ]string {
2691- "containerd.io/uncompressed" : digest .FromBytes (tarout ).String (),
2692+ labels . LabelUncompressed : digest .FromBytes (tarout ).String (),
26922693 },
26932694 }, nil
26942695}
0 commit comments