Merge pull request #5972 from zouyee/labels

This commit is contained in:
Fu Wei 2021-09-11 09:42:43 +08:00 committed by GitHub
commit 8766f2118c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,7 +44,7 @@ func TestContainerdImage(t *testing.T) {
} }
t.Logf("pull the image into containerd") 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) assert.NoError(t, err)
defer func() { defer func() {
// Make sure the image is cleaned up in any case. // Make sure the image is cleaned up in any case.
@ -121,6 +121,11 @@ func TestContainerdImage(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, imgByID.Labels()["io.cri-containerd.image"], "managed") 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") t.Logf("should be able to start container with the image")
sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox", "containerd-image") sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox", "containerd-image")