Add image pull duration metric with bucketed image size

Signed-off-by: ruiwen-zhao <ruiwen@google.com>
This commit is contained in:
ruiwen-zhao
2023-11-03 16:52:46 +00:00
parent 6eee80fa9a
commit 0f5cf6c1cd
11 changed files with 354 additions and 13 deletions

View File

@@ -149,6 +149,20 @@ func TestGetImageRef(t *testing.T) {
assert.Equal(t, image, imageRef)
}
func TestImageSize(t *testing.T) {
ctx := context.Background()
_, fakeImageService, fakeManager, err := createTestRuntimeManager()
assert.NoError(t, err)
const imageSize = uint64(64)
fakeImageService.SetFakeImageSize(imageSize)
image := "busybox"
fakeImageService.SetFakeImages([]string{image})
actualSize, err := fakeManager.GetImageSize(ctx, kubecontainer.ImageSpec{Image: image})
assert.NoError(t, err)
assert.Equal(t, imageSize, actualSize)
}
func TestGetImageRefImageNotAvailableLocally(t *testing.T) {
ctx := context.Background()
_, _, fakeManager, err := createTestRuntimeManager()