@@ -17,6 +17,7 @@ import (
17
17
. "github.com/onsi/ginkgo/v2"
18
18
. "github.com/onsi/gomega"
19
19
20
+ "github.com/docker/go-units"
20
21
"github.com/google/uuid"
21
22
22
23
v1 "k8s.io/api/core/v1"
@@ -126,7 +127,7 @@ var _ = Describe("[rfe_id:1115][crit:high][vendor:
[email protected] ][level:compo
126
127
By ("Verify the image contents" )
127
128
Expect (f .VerifyBlankDisk (f .Namespace , pvc )).To (BeTrue ())
128
129
By ("Verifying the image is sparse" )
129
- Expect (f .VerifySparse (f .Namespace , pvc , utils .DefaultImagePath )).To (BeTrue ())
130
+ Expect (f .VerifySparse (f .Namespace , pvc , utils .DefaultImagePath , utils . UploadFileSize )).To (BeTrue ())
130
131
By ("Verifying permissions are 660" )
131
132
Expect (f .VerifyPermissions (f .Namespace , pvc )).To (BeTrue (), "Permissions on disk image are not 660" )
132
133
if utils .DefaultStorageCSIRespectsFsGroup {
@@ -1626,7 +1627,7 @@ var _ = Describe("Import populator", func() {
1626
1627
tests .DisableWebhookPvcRendering (f .CrClient )
1627
1628
})
1628
1629
1629
- DescribeTable ("should import fileSystem PVC" , func (expectedMD5 string , volumeImportSourceFunc func (cdiv1.DataVolumeContentType , bool ) error , preallocation , webhookRendering bool ) {
1630
+ DescribeTable ("should import fileSystem PVC" , func (expectedMD5 string , originalVirtualSize int , volumeImportSourceFunc func (cdiv1.DataVolumeContentType , bool ) error , preallocation , webhookRendering bool ) {
1630
1631
pvc = importPopulationPVCDefinition ()
1631
1632
1632
1633
if webhookRendering {
@@ -1660,7 +1661,7 @@ var _ = Describe("Import populator", func() {
1660
1661
Expect (ok ).To (BeTrue ())
1661
1662
} else {
1662
1663
By ("Verifying the image is sparse" )
1663
- Expect (f .VerifySparse (f .Namespace , pvc , utils .DefaultImagePath )).To (BeTrue ())
1664
+ Expect (f .VerifySparse (f .Namespace , pvc , utils .DefaultImagePath , int64 ( originalVirtualSize ) )).To (BeTrue ())
1664
1665
}
1665
1666
1666
1667
if utils .DefaultStorageCSIRespectsFsGroup {
@@ -1685,17 +1686,17 @@ var _ = Describe("Import populator", func() {
1685
1686
return err != nil && k8serrors .IsNotFound (err )
1686
1687
}, timeout , pollingInterval ).Should (BeTrue ())
1687
1688
},
1688
- Entry ("[test_id:11001]with HTTP image and preallocation" , utils .TinyCoreMD5 , createHTTPImportPopulatorCR , true , false ),
1689
- Entry ("[test_id:11002]with HTTP image without preallocation" , utils .TinyCoreMD5 , createHTTPImportPopulatorCR , false , false ),
1690
- Entry ("[rfe_id:10985][crit:high][test_id:11003]with HTTP image and preallocation, with incomplete PVC webhook rendering" , Serial , utils .TinyCoreMD5 , createHTTPImportPopulatorCR , true , true ),
1691
- Entry ("[test_id:11004]with Registry image and preallocation" , utils .TinyCoreMD5 , createRegistryImportPopulatorCR , true , false ),
1692
- Entry ("[test_id:11005]with Registry image without preallocation" , utils .TinyCoreMD5 , createRegistryImportPopulatorCR , false , false ),
1693
- Entry ("[test_id:11006]with ImageIO image with preallocation" , Serial , utils .ImageioMD5 , createImageIOImportPopulatorCR , true , false ),
1694
- Entry ("[test_id:11007]with ImageIO image without preallocation" , Serial , utils .ImageioMD5 , createImageIOImportPopulatorCR , false , false ),
1695
- Entry ("[test_id:11008]with VDDK image with preallocation" , utils .VcenterMD5 , createVDDKImportPopulatorCR , true , false ),
1696
- Entry ("[test_id:11009]with VDDK image without preallocation" , utils .VcenterMD5 , createVDDKImportPopulatorCR , false , false ),
1697
- Entry ("[test_id:11010]with Blank image with preallocation" , utils .BlankMD5 , createBlankImportPopulatorCR , true , false ),
1698
- Entry ("[test_id:11011]with Blank image without preallocation" , utils .BlankMD5 , createBlankImportPopulatorCR , false , false ),
1689
+ Entry ("[test_id:11001]with HTTP image and preallocation" , utils .TinyCoreMD5 , utils . UploadFileSize , createHTTPImportPopulatorCR , true , false ),
1690
+ Entry ("[test_id:11002]with HTTP image without preallocation" , utils .TinyCoreMD5 , utils . UploadFileSize , createHTTPImportPopulatorCR , false , false ),
1691
+ Entry ("[rfe_id:10985][crit:high][test_id:11003]with HTTP image and preallocation, with incomplete PVC webhook rendering" , Serial , utils .TinyCoreMD5 , utils . UploadFileSize , createHTTPImportPopulatorCR , true , true ),
1692
+ Entry ("[test_id:11004]with Registry image and preallocation" , utils .TinyCoreMD5 , utils . UploadFileSize , createRegistryImportPopulatorCR , true , false ),
1693
+ Entry ("[test_id:11005]with Registry image without preallocation" , utils .TinyCoreMD5 , utils . UploadFileSize , createRegistryImportPopulatorCR , false , false ),
1694
+ Entry ("[test_id:11006]with ImageIO image with preallocation" , Serial , utils .ImageioMD5 , utils . CirrosRawFileSize , createImageIOImportPopulatorCR , true , false ),
1695
+ Entry ("[test_id:11007]with ImageIO image without preallocation" , Serial , utils .ImageioMD5 , utils . CirrosRawFileSize , createImageIOImportPopulatorCR , false , false ),
1696
+ Entry ("[test_id:11008]with VDDK image with preallocation" , utils .VcenterMD5 , utils . CirrosRawFileSize , createVDDKImportPopulatorCR , true , false ),
1697
+ Entry ("[test_id:11009]with VDDK image without preallocation" , utils .VcenterMD5 , utils . CirrosRawFileSize , createVDDKImportPopulatorCR , false , false ),
1698
+ Entry ("[test_id:11010]with Blank image with preallocation" , utils .BlankMD5 , units . MiB , createBlankImportPopulatorCR , true , false ),
1699
+ Entry ("[test_id:11011]with Blank image without preallocation" , utils .BlankMD5 , units . MiB , createBlankImportPopulatorCR , false , false ),
1699
1700
)
1700
1701
1701
1702
DescribeTable ("should import Block PVC" , func (expectedMD5 string , volumeImportSourceFunc func (cdiv1.DataVolumeContentType , bool ) error ) {
@@ -1723,7 +1724,7 @@ var _ = Describe("Import populator", func() {
1723
1724
Expect (err ).ToNot (HaveOccurred ())
1724
1725
Expect (md5 ).To (Equal (expectedMD5 ))
1725
1726
By ("Verifying the image is sparse" )
1726
- Expect (f .VerifySparse (f .Namespace , pvc , utils .DefaultPvcMountPath )).To (BeTrue ())
1727
+ Expect (f .VerifySparse (f .Namespace , pvc , utils .DefaultPvcMountPath , utils . UploadFileSize )).To (BeTrue ())
1727
1728
1728
1729
By ("Verify 100.0% annotation" )
1729
1730
progress , ok , err := utils .WaitForPVCAnnotation (f .K8sClient , f .Namespace .Name , pvc , controller .AnnPopulatorProgress )
@@ -1799,8 +1800,6 @@ var _ = Describe("Import populator", func() {
1799
1800
md5 , err := f .GetMD5 (f .Namespace , pvc , utils .DefaultImagePath , utils .MD5PrefixSize )
1800
1801
Expect (err ).ToNot (HaveOccurred ())
1801
1802
Expect (md5 ).To (Equal (utils .TinyCoreMD5 ))
1802
- By ("Verifying the image is sparse" )
1803
- Expect (f .VerifySparse (f .Namespace , pvc , utils .DefaultImagePath )).To (BeTrue ())
1804
1803
sourceMD5 := md5
1805
1804
1806
1805
By ("Retaining PV" )
0 commit comments