Additional integration tests for pulling image with labels

Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
This commit is contained in:
zounengren 2021-09-10 20:16:57 +08:00
parent 8e850bc0fe
commit 16cd6ed137

View File

@ -44,7 +44,7 @@ func TestContainerdImage(t *testing.T) {
}
t.Logf("pull the image into containerd")
_, err = containerdClient.Pull(ctx, testImage, containerd.WithPullUnpack)
_, err = containerdClient.Pull(ctx, testImage, containerd.WithPullUnpack, containerd.WithPullLabel("foo", "bar"))
assert.NoError(t, err)
defer func() {
// Make sure the image is cleaned up in any case.
@ -121,6 +121,11 @@ func TestContainerdImage(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, imgByID.Labels()["io.cri-containerd.image"], "managed")
t.Logf("the image should be labeled")
img, err := containerdClient.GetImage(ctx, testImage)
assert.NoError(t, err)
assert.Equal(t, img.Labels()["foo"], "bar")
t.Logf("should be able to start container with the image")
sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox", "containerd-image")