@@ -29,6 +29,7 @@ import (
2929 "github.com/containerd/containerd/errdefs"
3030 "github.com/containerd/containerd/integration/images"
3131 "github.com/containerd/containerd/namespaces"
32+ "github.com/containerd/containerd/pkg/cri/labels"
3233 "github.com/stretchr/testify/assert"
3334 "github.com/stretchr/testify/require"
3435 runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
@@ -47,7 +48,8 @@ func TestContainerdImage(t *testing.T) {
4748 }
4849
4950 t .Logf ("pull the image into containerd" )
50- _ , err = containerdClient .Pull (ctx , testImage , containerd .WithPullUnpack , containerd .WithPullLabel ("foo" , "bar" ))
51+ lbs := map [string ]string {"foo" : "bar" , labels .PinnedImageLabelKey : labels .PinnedImageLabelValue }
52+ _ , err = containerdClient .Pull (ctx , testImage , containerd .WithPullUnpack , containerd .WithPullLabels (lbs ))
5153 assert .NoError (t , err )
5254 defer func () {
5355 // Make sure the image is cleaned up in any case.
@@ -128,6 +130,13 @@ func TestContainerdImage(t *testing.T) {
128130 img , err := containerdClient .GetImage (ctx , testImage )
129131 assert .NoError (t , err )
130132 assert .Equal (t , img .Labels ()["foo" ], "bar" )
133+ assert .Equal (t , img .Labels ()[labels .ImageLabelKey ], labels .ImageLabelValue )
134+
135+ t .Logf ("the image should be pinned" )
136+ i , err = imageService .ImageStatus (& runtime.ImageSpec {Image : testImage })
137+ require .NoError (t , err )
138+ require .NotNil (t , i )
139+ assert .True (t , i .Pinned )
131140
132141 t .Logf ("should be able to start container with the image" )
133142 sb , sbConfig := PodSandboxConfigWithCleanup (t , "sandbox" , "containerd-image" )
0 commit comments