@@ -188,12 +188,11 @@ func (v *volumeModifyTestSuite) DefineTests(driver storageframework.TestDriver,
188
188
framework .ExpectNoError (err , "While creating pod for modifying" )
189
189
190
190
ginkgo .By ("Modifying PVC via VAC" )
191
- newPVC := SetPVCVACName (ctx , l .resource .Pvc , l .vac .Name , f .ClientSet , setVACWaitPeriod )
192
- l .resource .Pvc = newPVC
191
+ l .resource .Pvc = SetPVCVACName (ctx , l .resource .Pvc , l .vac .Name , f .ClientSet , setVACWaitPeriod )
193
192
gomega .Expect (l .resource .Pvc ).NotTo (gomega .BeNil ())
194
193
195
194
ginkgo .By ("Waiting for modification to finish" )
196
- WaitForVolumeModification (ctx , l .resource .Pvc , f .ClientSet , modifyVolumeWaitPeriod )
195
+ l . resource . Pvc = WaitForVolumeModification (ctx , l .resource .Pvc , f .ClientSet , modifyVolumeWaitPeriod )
197
196
198
197
pvcConditions := l .resource .Pvc .Status .Conditions
199
198
gomega .Expect (pvcConditions ).To (gomega .BeEmpty (), "PVC should not have conditions" )
@@ -223,12 +222,11 @@ func (v *volumeModifyTestSuite) DefineTests(driver storageframework.TestDriver,
223
222
framework .ExpectNoError (err , "While creating pod for modifying" )
224
223
225
224
ginkgo .By ("Modifying PVC via VAC" )
226
- newPVC := SetPVCVACName (ctx , l .resource .Pvc , newVAC .Name , f .ClientSet , setVACWaitPeriod )
227
- l .resource .Pvc = newPVC
225
+ l .resource .Pvc = SetPVCVACName (ctx , l .resource .Pvc , newVAC .Name , f .ClientSet , setVACWaitPeriod )
228
226
gomega .Expect (l .resource .Pvc ).NotTo (gomega .BeNil ())
229
227
230
228
ginkgo .By ("Waiting for modification to finish" )
231
- WaitForVolumeModification (ctx , l .resource .Pvc , f .ClientSet , modifyVolumeWaitPeriod )
229
+ l . resource . Pvc = WaitForVolumeModification (ctx , l .resource .Pvc , f .ClientSet , modifyVolumeWaitPeriod )
232
230
233
231
pvcConditions := l .resource .Pvc .Status .Conditions
234
232
gomega .Expect (pvcConditions ).To (gomega .BeEmpty (), "PVC should not have conditions" )
@@ -254,16 +252,18 @@ func SetPVCVACName(ctx context.Context, origPVC *v1.PersistentVolumeClaim, name
254
252
255
253
// WaitForVolumeModification waits for the volume to be modified
256
254
// The input PVC is assumed to have a VolumeAttributesClassName set
257
- func WaitForVolumeModification (ctx context.Context , pvc * v1.PersistentVolumeClaim , c clientset.Interface , timeout time.Duration ) {
255
+ func WaitForVolumeModification (ctx context.Context , pvc * v1.PersistentVolumeClaim , c clientset.Interface , timeout time.Duration ) * v1.PersistentVolumeClaim {
256
+ var newPVC * v1.PersistentVolumeClaim
258
257
pvName := pvc .Spec .VolumeName
259
258
gomega .Eventually (ctx , func (g gomega.Gomega ) {
260
259
pv , err := c .CoreV1 ().PersistentVolumes ().Get (ctx , pvName , metav1.GetOptions {})
261
260
framework .ExpectNoError (err , "While getting existing PV" )
262
261
g .Expect (pv .Spec .VolumeAttributesClassName ).NotTo (gomega .BeNil ())
263
- newPVC , err : = c .CoreV1 ().PersistentVolumeClaims (pvc .Namespace ).Get (ctx , pvc .Name , metav1.GetOptions {})
262
+ newPVC , err = c .CoreV1 ().PersistentVolumeClaims (pvc .Namespace ).Get (ctx , pvc .Name , metav1.GetOptions {})
264
263
framework .ExpectNoError (err , "While getting new PVC" )
265
264
g .Expect (vacMatches (newPVC , * pv .Spec .VolumeAttributesClassName , true )).To (gomega .BeTrueBecause ("Modified PVC should match expected VAC" ))
266
265
}, timeout , modifyPollInterval ).Should (gomega .Succeed ())
266
+ return newPVC
267
267
}
268
268
269
269
func CleanupVAC (ctx context.Context , vac * storagev1alpha1.VolumeAttributesClass , c clientset.Interface , timeout time.Duration ) {
0 commit comments