Allow greater or equal in storage provisioning check

The current check enforces that a dynamic provisioner creates
persistent volumes of capacity equals to the persistent volume
claim request size. However there are provisioners that will
create persistent volumes with a capacity greater than the
request size (cinder comes to mind which increments in 1Gi
increments, so if you request 0.5Gi, you get 1Gi). Also
provisioners that have shared storage should be reporting the
total space not the request size (nfs/hostpath for instance).

All these will fail the provisioning check currently because
the capacity is > than the request size. This modifies the check
to be capacity >= request size.

Signed-off-by: Alexander Wels <awels@redhat.com>
This commit is contained in:
Alexander Wels 2022-01-07 08:29:13 -06:00
parent 9d0d2e8ece
commit 2102769c14

View File

@ -474,11 +474,11 @@ func (t StorageClassTest) checkProvisioning(client clientset.Interface, claim *v
// Check sizes
expectedCapacity := resource.MustParse(t.ExpectedSize)
pvCapacity := pv.Spec.Capacity[v1.ResourceName(v1.ResourceStorage)]
framework.ExpectEqual(pvCapacity.Value(), expectedCapacity.Value(), "pvCapacity is not equal to expectedCapacity")
gomega.Expect(pvCapacity.Value()).To(gomega.BeNumerically(">=", expectedCapacity.Value), "pvCapacity is not greater or equal to expectedCapacity")
requestedCapacity := resource.MustParse(t.ClaimSize)
claimCapacity := claim.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
framework.ExpectEqual(claimCapacity.Value(), requestedCapacity.Value(), "claimCapacity is not equal to requestedCapacity")
gomega.Expect(claimCapacity.Value()).To(gomega.BeNumerically(">=", requestedCapacity.Value), "claimCapacity is not greater or equal to requestedCapacity")
// Check PV properties
ginkgo.By("checking the PV")