@@ -27,6 +27,7 @@ import (
2727 "github.com/containerd/containerd"
2828 "github.com/containerd/containerd/errdefs"
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 "golang.org/x/net/context"
@@ -46,7 +47,8 @@ func TestContainerdImage(t *testing.T) {
4647 }
4748
4849 t .Logf ("pull the image into containerd" )
49- _ , err = containerdClient .Pull (ctx , testImage , containerd .WithPullUnpack , containerd .WithPullLabel ("foo" , "bar" ))
50+ lbs := map [string ]string {"foo" : "bar" , labels .PinnedImageLabelKey : labels .PinnedImageLabelValue }
51+ _ , err = containerdClient .Pull (ctx , testImage , containerd .WithPullUnpack , containerd .WithPullLabels (lbs ))
5052 assert .NoError (t , err )
5153 defer func () {
5254 // Make sure the image is cleaned up in any case.
@@ -127,6 +129,13 @@ func TestContainerdImage(t *testing.T) {
127129 img , err := containerdClient .GetImage (ctx , testImage )
128130 assert .NoError (t , err )
129131 assert .Equal (t , img .Labels ()["foo" ], "bar" )
132+ assert .Equal (t , img .Labels ()[labels .ImageLabelKey ], labels .ImageLabelValue )
133+
134+ t .Logf ("the image should be pinned" )
135+ i , err = imageService .ImageStatus (& runtime.ImageSpec {Image : testImage })
136+ require .NoError (t , err )
137+ require .NotNil (t , i )
138+ assert .True (t , i .Pinned )
130139
131140 t .Logf ("should be able to start container with the image" )
132141 sb , sbConfig := PodSandboxConfigWithCleanup (t , "sandbox" , "containerd-image" )
0 commit comments