@@ -256,6 +256,8 @@ func (v *volumeExpandTestSuite) DefineTests(driver storageframework.TestDriver,
256
256
257
257
pvcConditions := l .resource .Pvc .Status .Conditions
258
258
gomega .Expect (pvcConditions ).To (gomega .BeEmpty (), "pvc should not have conditions" )
259
+ err = VerifyRecoveryRelatedFields (l .resource .Pvc )
260
+ framework .ExpectNoError (err , "while verifying recovery related fields" )
259
261
})
260
262
261
263
ginkgo .It ("should resize volume when PVC is edited while pod is using it" , func (ctx context.Context ) {
@@ -305,6 +307,9 @@ func (v *volumeExpandTestSuite) DefineTests(driver storageframework.TestDriver,
305
307
306
308
pvcConditions := l .resource .Pvc .Status .Conditions
307
309
gomega .Expect (pvcConditions ).To (gomega .BeEmpty (), "pvc should not have conditions" )
310
+
311
+ err = VerifyRecoveryRelatedFields (l .resource .Pvc )
312
+ framework .ExpectNoError (err , "while verifying recovery related fields" )
308
313
})
309
314
310
315
}
@@ -483,3 +488,18 @@ func WaitForFSResize(ctx context.Context, pvc *v1.PersistentVolumeClaim, c clien
483
488
}
484
489
return updatedPVC , nil
485
490
}
491
+
492
+ func VerifyRecoveryRelatedFields (pvc * v1.PersistentVolumeClaim ) error {
493
+ resizeStatus := pvc .Status .AllocatedResourceStatuses [v1 .ResourceStorage ]
494
+ if resizeStatus != "" {
495
+ return fmt .Errorf ("pvc %q had %s resize status, expected none" , pvc .Name , resizeStatus )
496
+ }
497
+
498
+ allocatedSize := pvc .Status .AllocatedResources [v1 .ResourceStorage ]
499
+ requestedSize := pvc .Spec .Resources .Requests [v1 .ResourceStorage ]
500
+ // at this point allocatedSize should be greater than pvc resource request
501
+ if allocatedSize .Cmp (requestedSize ) < 0 {
502
+ return fmt .Errorf ("pvc %q had %s allocated size, expected %s" , pvc .Name , allocatedSize .String (), requestedSize .String ())
503
+ }
504
+ return nil
505
+ }
0 commit comments