From 3dc043fb3f26075f5d73bb7a731043908f74b6d8 Mon Sep 17 00:00:00 2001 From: Alex Kalenyuk Date: Sun, 21 Apr 2024 17:00:26 +0300 Subject: [PATCH] Correct wrong check of resulting image sparsiness Following 2168 the check for sparsiness is not always honest. Signed-off-by: Alex Kalenyuk --- tests/framework/pvc.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/framework/pvc.go b/tests/framework/pvc.go index 7c108c0fad..fe6b38a9c2 100644 --- a/tests/framework/pvc.go +++ b/tests/framework/pvc.go @@ -296,10 +296,11 @@ func (f *Framework) VerifySparse(namespace *k8sv1.Namespace, pvc *k8sv1.Persiste return false, err } if info.ActualSize-imageContentSize >= units.MiB { - return false, fmt.Errorf("Diff between content size %d and size on disk %d is significant, something's not right", imageContentSize, info.ActualSize) + return false, fmt.Errorf("diff between content size %d and size on disk %d is significant, something's not right", imageContentSize, info.ActualSize) } fmt.Fprintf(ginkgo.GinkgoWriter, "INFO: VerifySparse comparison: Virtual: %d vs Content: %d\n", info.VirtualSize, imageContentSize) - return info.VirtualSize >= imageContentSize, nil + // The size a sparse image takes on disk is significantly lower than it's virtual size + return info.VirtualSize-imageContentSize >= units.MiB, nil } // VerifyFSOverhead checks whether virtual size is smaller than actual size. That means FS Overhead has been accounted for.