Skip to content

Commit 5b926ed

Browse files
committed
Correct wrong check of resulting image sparsiness
The check we have in tests for sparsiness is not honest because of the "equal to" part. The virtual size has to be strictly greater than the content (as the content is displayed by tools that understand sparseness). Signed-off-by: Alex Kalenyuk <[email protected]>
1 parent aab2017 commit 5b926ed

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/framework/pvc.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,11 @@ func (f *Framework) VerifySparse(namespace *k8sv1.Namespace, pvc *k8sv1.Persiste
296296
return false, err
297297
}
298298
if info.ActualSize-imageContentSize >= units.MiB {
299-
return false, fmt.Errorf("Diff between content size %d and size on disk %d is significant, something's not right", imageContentSize, info.ActualSize)
299+
return false, fmt.Errorf("diff between content size %d and size on disk %d is significant, something's not right", imageContentSize, info.ActualSize)
300300
}
301301
fmt.Fprintf(ginkgo.GinkgoWriter, "INFO: VerifySparse comparison: Virtual: %d vs Content: %d\n", info.VirtualSize, imageContentSize)
302-
return info.VirtualSize >= imageContentSize, nil
302+
// The content size of a sparse image is significantly lower than the image's virtual size
303+
return info.VirtualSize-imageContentSize >= units.MiB, nil
303304
}
304305

305306
// VerifyFSOverhead checks whether virtual size is smaller than actual size. That means FS Overhead has been accounted for.

0 commit comments

Comments
 (0)