@@ -27,6 +27,7 @@ import (
2727 "github.com/containerd/containerd/errdefs"
2828 "github.com/containerd/containerd/integration/images"
2929 "github.com/containerd/containerd/namespaces"
30+ "github.com/containerd/containerd/pkg/cri/labels"
3031 "github.com/stretchr/testify/assert"
3132 "github.com/stretchr/testify/require"
3233 runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
@@ -45,7 +46,8 @@ func TestContainerdImage(t *testing.T) {
4546 }
4647
4748 t .Logf ("pull the image into containerd" )
48- _ , err = containerdClient .Pull (ctx , testImage , containerd .WithPullUnpack , containerd .WithPullLabel ("foo" , "bar" ))
49+ lbs := map [string ]string {"foo" : "bar" , labels .PinnedImageLabelKey : labels .PinnedImageLabelValue }
50+ _ , err = containerdClient .Pull (ctx , testImage , containerd .WithPullUnpack , containerd .WithPullLabels (lbs ))
4951 assert .NoError (t , err )
5052 defer func () {
5153 // Make sure the image is cleaned up in any case.
@@ -126,6 +128,13 @@ func TestContainerdImage(t *testing.T) {
126128 img , err := containerdClient .GetImage (ctx , testImage )
127129 assert .NoError (t , err )
128130 assert .Equal (t , img .Labels ()["foo" ], "bar" )
131+ assert .Equal (t , img .Labels ()[labels .ImageLabelKey ], labels .ImageLabelValue )
132+
133+ t .Logf ("the image should be pinned" )
134+ i , err = imageService .ImageStatus (& runtime.ImageSpec {Image : testImage })
135+ require .NoError (t , err )
136+ require .NotNil (t , i )
137+ assert .True (t , i .Pinned )
129138
130139 t .Logf ("should be able to start container with the image" )
131140 sb , sbConfig := PodSandboxConfigWithCleanup (t , "sandbox" , "containerd-image" )
0 commit comments