@@ -42,8 +42,8 @@ import (
42
42
"k8s.io/kubernetes/test/e2e/storage/utils"
43
43
imageutils "k8s.io/kubernetes/test/utils/image"
44
44
45
- . "github.com/onsi/ginkgo"
46
- . "github.com/onsi/gomega"
45
+ "github.com/onsi/ginkgo"
46
+ "github.com/onsi/gomega"
47
47
)
48
48
49
49
type cleanupFuncs func ()
@@ -132,7 +132,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
132
132
}
133
133
134
134
createPod := func () (* storagev1.StorageClass , * v1.PersistentVolumeClaim , * v1.Pod ) {
135
- By ("Creating pod" )
135
+ ginkgo . By ("Creating pod" )
136
136
var sc * storagev1.StorageClass
137
137
if dDriver , ok := m .driver .(testsuites.DynamicPVTestDriver ); ok {
138
138
sc = dDriver .GetDynamicProvisionStorageClass (m .config , "" )
@@ -197,12 +197,12 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
197
197
var errs []error
198
198
199
199
for _ , pod := range m .pods {
200
- By (fmt .Sprintf ("Deleting pod %s" , pod .Name ))
200
+ ginkgo . By (fmt .Sprintf ("Deleting pod %s" , pod .Name ))
201
201
errs = append (errs , framework .DeletePodWithWait (f , cs , pod ))
202
202
}
203
203
204
204
for _ , claim := range m .pvcs {
205
- By (fmt .Sprintf ("Deleting claim %s" , claim .Name ))
205
+ ginkgo . By (fmt .Sprintf ("Deleting claim %s" , claim .Name ))
206
206
claim , err := cs .CoreV1 ().PersistentVolumeClaims (claim .Namespace ).Get (claim .Name , metav1.GetOptions {})
207
207
if err == nil {
208
208
cs .CoreV1 ().PersistentVolumeClaims (claim .Namespace ).Delete (claim .Name , nil )
@@ -212,11 +212,11 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
212
212
}
213
213
214
214
for _ , sc := range m .sc {
215
- By (fmt .Sprintf ("Deleting storageclass %s" , sc .Name ))
215
+ ginkgo . By (fmt .Sprintf ("Deleting storageclass %s" , sc .Name ))
216
216
cs .StorageV1 ().StorageClasses ().Delete (sc .Name , nil )
217
217
}
218
218
219
- By ("Cleaning up resources" )
219
+ ginkgo . By ("Cleaning up resources" )
220
220
for _ , cleanupFunc := range m .testCleanups {
221
221
cleanupFunc ()
222
222
}
@@ -230,7 +230,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
230
230
}
231
231
232
232
// The CSIDriverRegistry feature gate is needed for this test in Kubernetes 1.12.
233
- Context ("CSI attach test using mock driver" , func () {
233
+ ginkgo . Context ("CSI attach test using mock driver" , func () {
234
234
tests := []struct {
235
235
name string
236
236
disableAttach bool
@@ -252,7 +252,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
252
252
}
253
253
for _ , t := range tests {
254
254
test := t
255
- It (t .name , func () {
255
+ ginkgo . It (t .name , func () {
256
256
var err error
257
257
init (testParameters {registerDriver : test .deployClusterRegistrar , disableAttach : test .disableAttach })
258
258
defer cleanup ()
@@ -264,7 +264,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
264
264
err = framework .WaitForPodNameRunningInNamespace (m .cs , pod .Name , pod .Namespace )
265
265
framework .ExpectNoError (err , "Failed to start pod: %v" , err )
266
266
267
- By ("Checking if VolumeAttachment was created for the pod" )
267
+ ginkgo . By ("Checking if VolumeAttachment was created for the pod" )
268
268
handle := getVolumeHandle (m .cs , claim )
269
269
attachmentHash := sha256 .Sum256 ([]byte (fmt .Sprintf ("%s%s%s" , handle , m .provisioner , m .config .ClientNodeName )))
270
270
attachmentName := fmt .Sprintf ("csi-%x" , attachmentHash )
@@ -279,14 +279,14 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
279
279
}
280
280
}
281
281
if test .disableAttach {
282
- Expect (err ).To (HaveOccurred (), "Unexpected VolumeAttachment found" )
282
+ gomega . Expect (err ).To (gomega . HaveOccurred (), "Unexpected VolumeAttachment found" )
283
283
}
284
284
})
285
285
286
286
}
287
287
})
288
288
289
- Context ("CSI workload information using mock driver" , func () {
289
+ ginkgo . Context ("CSI workload information using mock driver" , func () {
290
290
var (
291
291
err error
292
292
podInfoTrue = true
@@ -324,7 +324,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
324
324
}
325
325
for _ , t := range tests {
326
326
test := t
327
- It (t .name , func () {
327
+ ginkgo . It (t .name , func () {
328
328
init (testParameters {
329
329
registerDriver : test .deployClusterRegistrar ,
330
330
scName : "csi-mock-sc-" + f .UniqueName ,
@@ -338,7 +338,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
338
338
}
339
339
err = framework .WaitForPodNameRunningInNamespace (m .cs , pod .Name , pod .Namespace )
340
340
framework .ExpectNoError (err , "Failed to start pod: %v" , err )
341
- By ("Checking CSI driver logs" )
341
+ ginkgo . By ("Checking CSI driver logs" )
342
342
343
343
// The driver is deployed as a statefulset with stable pod names
344
344
driverPodName := "csi-mockplugin-0"
@@ -348,8 +348,8 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
348
348
}
349
349
})
350
350
351
- Context ("CSI volume limit information using mock driver" , func () {
352
- It ("should report attach limit when limit is bigger than 0 [Slow]" , func () {
351
+ ginkgo . Context ("CSI volume limit information using mock driver" , func () {
352
+ ginkgo . It ("should report attach limit when limit is bigger than 0 [Slow]" , func () {
353
353
// define volume limit to be 2 for this test
354
354
355
355
var err error
@@ -362,28 +362,28 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
362
362
nodeAttachLimit , err := checkNodeForLimits (nodeName , attachKey , m .cs )
363
363
framework .ExpectNoError (err , "while fetching node %v" , err )
364
364
365
- Expect (nodeAttachLimit ).To (Equal (2 ))
365
+ gomega . Expect (nodeAttachLimit ).To (gomega . Equal (2 ))
366
366
367
367
_ , _ , pod1 := createPod ()
368
- Expect (pod1 ).NotTo (BeNil (), "while creating first pod" )
368
+ gomega . Expect (pod1 ).NotTo (gomega . BeNil (), "while creating first pod" )
369
369
370
370
err = framework .WaitForPodNameRunningInNamespace (m .cs , pod1 .Name , pod1 .Namespace )
371
371
framework .ExpectNoError (err , "Failed to start pod1: %v" , err )
372
372
373
373
_ , _ , pod2 := createPod ()
374
- Expect (pod2 ).NotTo (BeNil (), "while creating second pod" )
374
+ gomega . Expect (pod2 ).NotTo (gomega . BeNil (), "while creating second pod" )
375
375
376
376
err = framework .WaitForPodNameRunningInNamespace (m .cs , pod2 .Name , pod2 .Namespace )
377
377
framework .ExpectNoError (err , "Failed to start pod2: %v" , err )
378
378
379
379
_ , _ , pod3 := createPod ()
380
- Expect (pod3 ).NotTo (BeNil (), "while creating third pod" )
380
+ gomega . Expect (pod3 ).NotTo (gomega . BeNil (), "while creating third pod" )
381
381
err = waitForMaxVolumeCondition (pod3 , m .cs )
382
382
framework .ExpectNoError (err , "while waiting for max volume condition on pod : %+v" , pod3 )
383
383
})
384
384
})
385
385
386
- Context ("CSI Volume expansion [Feature:ExpandCSIVolumes]" , func () {
386
+ ginkgo . Context ("CSI Volume expansion [Feature:ExpandCSIVolumes]" , func () {
387
387
tests := []struct {
388
388
name string
389
389
nodeExpansionRequired bool
@@ -412,7 +412,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
412
412
}
413
413
for _ , t := range tests {
414
414
test := t
415
- It (t .name , func () {
415
+ ginkgo . It (t .name , func () {
416
416
var err error
417
417
tp := testParameters {
418
418
enableResizing : true ,
@@ -430,70 +430,70 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
430
430
431
431
ns := f .Namespace .Name
432
432
sc , pvc , pod := createPod ()
433
- Expect (pod ).NotTo (BeNil (), "while creating pod for resizing" )
433
+ gomega . Expect (pod ).NotTo (gomega . BeNil (), "while creating pod for resizing" )
434
434
435
- Expect (* sc .AllowVolumeExpansion ).To (BeTrue (), "failed creating sc with allowed expansion" )
435
+ gomega . Expect (* sc .AllowVolumeExpansion ).To (gomega . BeTrue (), "failed creating sc with allowed expansion" )
436
436
437
437
err = framework .WaitForPodNameRunningInNamespace (m .cs , pod .Name , pod .Namespace )
438
438
framework .ExpectNoError (err , "Failed to start pod1: %v" , err )
439
439
440
- By ("Expanding current pvc" )
440
+ ginkgo . By ("Expanding current pvc" )
441
441
newSize := resource .MustParse ("6Gi" )
442
442
pvc , err = expandPVCSize (pvc , newSize , m .cs )
443
443
framework .ExpectNoError (err , "While updating pvc for more size" )
444
- Expect (pvc ).NotTo (BeNil ())
444
+ gomega . Expect (pvc ).NotTo (gomega . BeNil ())
445
445
446
446
pvcSize := pvc .Spec .Resources .Requests [v1 .ResourceStorage ]
447
447
if pvcSize .Cmp (newSize ) != 0 {
448
448
framework .Failf ("error updating pvc size %q" , pvc .Name )
449
449
}
450
450
if test .expectFailure {
451
451
err = waitForResizingCondition (pvc , m .cs , csiResizingConditionWait )
452
- Expect (err ).To (HaveOccurred (), "unexpected resizing condition on PVC" )
452
+ gomega . Expect (err ).To (gomega . HaveOccurred (), "unexpected resizing condition on PVC" )
453
453
return
454
454
}
455
455
456
- By ("Waiting for persistent volume resize to finish" )
456
+ ginkgo . By ("Waiting for persistent volume resize to finish" )
457
457
err = waitForControllerVolumeResize (pvc , m .cs , csiResizeWaitPeriod )
458
458
framework .ExpectNoError (err , "While waiting for CSI PV resize to finish" )
459
459
460
460
checkPVCSize := func () {
461
- By ("Waiting for PVC resize to finish" )
461
+ ginkgo . By ("Waiting for PVC resize to finish" )
462
462
pvc , err = waitForFSResize (pvc , m .cs )
463
463
framework .ExpectNoError (err , "while waiting for PVC resize to finish" )
464
464
465
465
pvcConditions := pvc .Status .Conditions
466
- Expect (len (pvcConditions )).To (Equal (0 ), "pvc should not have conditions" )
466
+ gomega . Expect (len (pvcConditions )).To (gomega . Equal (0 ), "pvc should not have conditions" )
467
467
}
468
468
469
469
// if node expansion is not required PVC should be resized as well
470
470
if ! test .nodeExpansionRequired {
471
471
checkPVCSize ()
472
472
} else {
473
- By ("Checking for conditions on pvc" )
473
+ ginkgo . By ("Checking for conditions on pvc" )
474
474
pvc , err = m .cs .CoreV1 ().PersistentVolumeClaims (ns ).Get (pvc .Name , metav1.GetOptions {})
475
475
framework .ExpectNoError (err , "While fetching pvc after controller resize" )
476
476
477
477
inProgressConditions := pvc .Status .Conditions
478
478
if len (inProgressConditions ) > 0 {
479
- Expect (inProgressConditions [0 ].Type ).To (Equal (v1 .PersistentVolumeClaimFileSystemResizePending ), "pvc must have fs resizing condition" )
479
+ gomega . Expect (inProgressConditions [0 ].Type ).To (gomega . Equal (v1 .PersistentVolumeClaimFileSystemResizePending ), "pvc must have fs resizing condition" )
480
480
}
481
481
482
- By ("Deleting the previously created pod" )
482
+ ginkgo . By ("Deleting the previously created pod" )
483
483
err = framework .DeletePodWithWait (f , m .cs , pod )
484
484
framework .ExpectNoError (err , "while deleting pod for resizing" )
485
485
486
- By ("Creating a new pod with same volume" )
486
+ ginkgo . By ("Creating a new pod with same volume" )
487
487
pod2 , err := createPodWithPVC (pvc )
488
- Expect (pod2 ).NotTo (BeNil (), "while creating pod for csi resizing" )
488
+ gomega . Expect (pod2 ).NotTo (gomega . BeNil (), "while creating pod for csi resizing" )
489
489
framework .ExpectNoError (err , "while recreating pod for resizing" )
490
490
491
491
checkPVCSize ()
492
492
}
493
493
})
494
494
}
495
495
})
496
- Context ("CSI online volume expansion [Feature:ExpandCSIVolumes][Feature:ExpandInUseVolumes]" , func () {
496
+ ginkgo . Context ("CSI online volume expansion [Feature:ExpandCSIVolumes][Feature:ExpandInUseVolumes]" , func () {
497
497
tests := []struct {
498
498
name string
499
499
disableAttach bool
@@ -508,7 +508,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
508
508
}
509
509
for _ , t := range tests {
510
510
test := t
511
- It (test .name , func () {
511
+ ginkgo . It (test .name , func () {
512
512
var err error
513
513
params := testParameters {enableResizing : true , enableNodeExpansion : true }
514
514
if test .disableAttach {
@@ -521,34 +521,34 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
521
521
defer cleanup ()
522
522
523
523
sc , pvc , pod := createPod ()
524
- Expect (pod ).NotTo (BeNil (), "while creating pod for resizing" )
524
+ gomega . Expect (pod ).NotTo (gomega . BeNil (), "while creating pod for resizing" )
525
525
526
- Expect (* sc .AllowVolumeExpansion ).To (BeTrue (), "failed creating sc with allowed expansion" )
526
+ gomega . Expect (* sc .AllowVolumeExpansion ).To (gomega . BeTrue (), "failed creating sc with allowed expansion" )
527
527
528
528
err = framework .WaitForPodNameRunningInNamespace (m .cs , pod .Name , pod .Namespace )
529
529
framework .ExpectNoError (err , "Failed to start pod1: %v" , err )
530
530
531
- By ("Expanding current pvc" )
531
+ ginkgo . By ("Expanding current pvc" )
532
532
newSize := resource .MustParse ("6Gi" )
533
533
pvc , err = expandPVCSize (pvc , newSize , m .cs )
534
534
framework .ExpectNoError (err , "While updating pvc for more size" )
535
- Expect (pvc ).NotTo (BeNil ())
535
+ gomega . Expect (pvc ).NotTo (gomega . BeNil ())
536
536
537
537
pvcSize := pvc .Spec .Resources .Requests [v1 .ResourceStorage ]
538
538
if pvcSize .Cmp (newSize ) != 0 {
539
539
framework .Failf ("error updating pvc size %q" , pvc .Name )
540
540
}
541
541
542
- By ("Waiting for persistent volume resize to finish" )
542
+ ginkgo . By ("Waiting for persistent volume resize to finish" )
543
543
err = waitForControllerVolumeResize (pvc , m .cs , csiResizeWaitPeriod )
544
544
framework .ExpectNoError (err , "While waiting for PV resize to finish" )
545
545
546
- By ("Waiting for PVC resize to finish" )
546
+ ginkgo . By ("Waiting for PVC resize to finish" )
547
547
pvc , err = waitForFSResize (pvc , m .cs )
548
548
framework .ExpectNoError (err , "while waiting for PVC to finish" )
549
549
550
550
pvcConditions := pvc .Status .Conditions
551
- Expect (len (pvcConditions )).To (Equal (0 ), "pvc should not have conditions" )
551
+ gomega . Expect (len (pvcConditions )).To (gomega . Equal (0 ), "pvc should not have conditions" )
552
552
553
553
})
554
554
}
@@ -801,7 +801,7 @@ func getVolumeHandle(cs clientset.Interface, claim *v1.PersistentVolumeClaim) st
801
801
return ""
802
802
}
803
803
if pv .Spec .CSI == nil {
804
- Expect (pv .Spec .CSI ).NotTo (BeNil ())
804
+ gomega . Expect (pv .Spec .CSI ).NotTo (gomega . BeNil ())
805
805
return ""
806
806
}
807
807
return pv .Spec .CSI .VolumeHandle
0 commit comments