Skip to content

Commit 1058877

Browse files
committed
remove dot imports in e2e/storage
1 parent 8a6fede commit 1058877

37 files changed

+912
-913
lines changed

test/e2e/storage/csi_mock_volume.go

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ import (
4242
"k8s.io/kubernetes/test/e2e/storage/utils"
4343
imageutils "k8s.io/kubernetes/test/utils/image"
4444

45-
. "github.com/onsi/ginkgo"
46-
. "github.com/onsi/gomega"
45+
"github.com/onsi/ginkgo"
46+
"github.com/onsi/gomega"
4747
)
4848

4949
type cleanupFuncs func()
@@ -132,7 +132,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
132132
}
133133

134134
createPod := func() (*storagev1.StorageClass, *v1.PersistentVolumeClaim, *v1.Pod) {
135-
By("Creating pod")
135+
ginkgo.By("Creating pod")
136136
var sc *storagev1.StorageClass
137137
if dDriver, ok := m.driver.(testsuites.DynamicPVTestDriver); ok {
138138
sc = dDriver.GetDynamicProvisionStorageClass(m.config, "")
@@ -197,12 +197,12 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
197197
var errs []error
198198

199199
for _, pod := range m.pods {
200-
By(fmt.Sprintf("Deleting pod %s", pod.Name))
200+
ginkgo.By(fmt.Sprintf("Deleting pod %s", pod.Name))
201201
errs = append(errs, framework.DeletePodWithWait(f, cs, pod))
202202
}
203203

204204
for _, claim := range m.pvcs {
205-
By(fmt.Sprintf("Deleting claim %s", claim.Name))
205+
ginkgo.By(fmt.Sprintf("Deleting claim %s", claim.Name))
206206
claim, err := cs.CoreV1().PersistentVolumeClaims(claim.Namespace).Get(claim.Name, metav1.GetOptions{})
207207
if err == nil {
208208
cs.CoreV1().PersistentVolumeClaims(claim.Namespace).Delete(claim.Name, nil)
@@ -212,11 +212,11 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
212212
}
213213

214214
for _, sc := range m.sc {
215-
By(fmt.Sprintf("Deleting storageclass %s", sc.Name))
215+
ginkgo.By(fmt.Sprintf("Deleting storageclass %s", sc.Name))
216216
cs.StorageV1().StorageClasses().Delete(sc.Name, nil)
217217
}
218218

219-
By("Cleaning up resources")
219+
ginkgo.By("Cleaning up resources")
220220
for _, cleanupFunc := range m.testCleanups {
221221
cleanupFunc()
222222
}
@@ -230,7 +230,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
230230
}
231231

232232
// 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() {
234234
tests := []struct {
235235
name string
236236
disableAttach bool
@@ -252,7 +252,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
252252
}
253253
for _, t := range tests {
254254
test := t
255-
It(t.name, func() {
255+
ginkgo.It(t.name, func() {
256256
var err error
257257
init(testParameters{registerDriver: test.deployClusterRegistrar, disableAttach: test.disableAttach})
258258
defer cleanup()
@@ -264,7 +264,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
264264
err = framework.WaitForPodNameRunningInNamespace(m.cs, pod.Name, pod.Namespace)
265265
framework.ExpectNoError(err, "Failed to start pod: %v", err)
266266

267-
By("Checking if VolumeAttachment was created for the pod")
267+
ginkgo.By("Checking if VolumeAttachment was created for the pod")
268268
handle := getVolumeHandle(m.cs, claim)
269269
attachmentHash := sha256.Sum256([]byte(fmt.Sprintf("%s%s%s", handle, m.provisioner, m.config.ClientNodeName)))
270270
attachmentName := fmt.Sprintf("csi-%x", attachmentHash)
@@ -279,14 +279,14 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
279279
}
280280
}
281281
if test.disableAttach {
282-
Expect(err).To(HaveOccurred(), "Unexpected VolumeAttachment found")
282+
gomega.Expect(err).To(gomega.HaveOccurred(), "Unexpected VolumeAttachment found")
283283
}
284284
})
285285

286286
}
287287
})
288288

289-
Context("CSI workload information using mock driver", func() {
289+
ginkgo.Context("CSI workload information using mock driver", func() {
290290
var (
291291
err error
292292
podInfoTrue = true
@@ -324,7 +324,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
324324
}
325325
for _, t := range tests {
326326
test := t
327-
It(t.name, func() {
327+
ginkgo.It(t.name, func() {
328328
init(testParameters{
329329
registerDriver: test.deployClusterRegistrar,
330330
scName: "csi-mock-sc-" + f.UniqueName,
@@ -338,7 +338,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
338338
}
339339
err = framework.WaitForPodNameRunningInNamespace(m.cs, pod.Name, pod.Namespace)
340340
framework.ExpectNoError(err, "Failed to start pod: %v", err)
341-
By("Checking CSI driver logs")
341+
ginkgo.By("Checking CSI driver logs")
342342

343343
// The driver is deployed as a statefulset with stable pod names
344344
driverPodName := "csi-mockplugin-0"
@@ -348,8 +348,8 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
348348
}
349349
})
350350

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() {
353353
// define volume limit to be 2 for this test
354354

355355
var err error
@@ -362,28 +362,28 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
362362
nodeAttachLimit, err := checkNodeForLimits(nodeName, attachKey, m.cs)
363363
framework.ExpectNoError(err, "while fetching node %v", err)
364364

365-
Expect(nodeAttachLimit).To(Equal(2))
365+
gomega.Expect(nodeAttachLimit).To(gomega.Equal(2))
366366

367367
_, _, pod1 := createPod()
368-
Expect(pod1).NotTo(BeNil(), "while creating first pod")
368+
gomega.Expect(pod1).NotTo(gomega.BeNil(), "while creating first pod")
369369

370370
err = framework.WaitForPodNameRunningInNamespace(m.cs, pod1.Name, pod1.Namespace)
371371
framework.ExpectNoError(err, "Failed to start pod1: %v", err)
372372

373373
_, _, pod2 := createPod()
374-
Expect(pod2).NotTo(BeNil(), "while creating second pod")
374+
gomega.Expect(pod2).NotTo(gomega.BeNil(), "while creating second pod")
375375

376376
err = framework.WaitForPodNameRunningInNamespace(m.cs, pod2.Name, pod2.Namespace)
377377
framework.ExpectNoError(err, "Failed to start pod2: %v", err)
378378

379379
_, _, pod3 := createPod()
380-
Expect(pod3).NotTo(BeNil(), "while creating third pod")
380+
gomega.Expect(pod3).NotTo(gomega.BeNil(), "while creating third pod")
381381
err = waitForMaxVolumeCondition(pod3, m.cs)
382382
framework.ExpectNoError(err, "while waiting for max volume condition on pod : %+v", pod3)
383383
})
384384
})
385385

386-
Context("CSI Volume expansion [Feature:ExpandCSIVolumes]", func() {
386+
ginkgo.Context("CSI Volume expansion [Feature:ExpandCSIVolumes]", func() {
387387
tests := []struct {
388388
name string
389389
nodeExpansionRequired bool
@@ -412,7 +412,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
412412
}
413413
for _, t := range tests {
414414
test := t
415-
It(t.name, func() {
415+
ginkgo.It(t.name, func() {
416416
var err error
417417
tp := testParameters{
418418
enableResizing: true,
@@ -430,70 +430,70 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
430430

431431
ns := f.Namespace.Name
432432
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")
434434

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")
436436

437437
err = framework.WaitForPodNameRunningInNamespace(m.cs, pod.Name, pod.Namespace)
438438
framework.ExpectNoError(err, "Failed to start pod1: %v", err)
439439

440-
By("Expanding current pvc")
440+
ginkgo.By("Expanding current pvc")
441441
newSize := resource.MustParse("6Gi")
442442
pvc, err = expandPVCSize(pvc, newSize, m.cs)
443443
framework.ExpectNoError(err, "While updating pvc for more size")
444-
Expect(pvc).NotTo(BeNil())
444+
gomega.Expect(pvc).NotTo(gomega.BeNil())
445445

446446
pvcSize := pvc.Spec.Resources.Requests[v1.ResourceStorage]
447447
if pvcSize.Cmp(newSize) != 0 {
448448
framework.Failf("error updating pvc size %q", pvc.Name)
449449
}
450450
if test.expectFailure {
451451
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")
453453
return
454454
}
455455

456-
By("Waiting for persistent volume resize to finish")
456+
ginkgo.By("Waiting for persistent volume resize to finish")
457457
err = waitForControllerVolumeResize(pvc, m.cs, csiResizeWaitPeriod)
458458
framework.ExpectNoError(err, "While waiting for CSI PV resize to finish")
459459

460460
checkPVCSize := func() {
461-
By("Waiting for PVC resize to finish")
461+
ginkgo.By("Waiting for PVC resize to finish")
462462
pvc, err = waitForFSResize(pvc, m.cs)
463463
framework.ExpectNoError(err, "while waiting for PVC resize to finish")
464464

465465
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")
467467
}
468468

469469
// if node expansion is not required PVC should be resized as well
470470
if !test.nodeExpansionRequired {
471471
checkPVCSize()
472472
} else {
473-
By("Checking for conditions on pvc")
473+
ginkgo.By("Checking for conditions on pvc")
474474
pvc, err = m.cs.CoreV1().PersistentVolumeClaims(ns).Get(pvc.Name, metav1.GetOptions{})
475475
framework.ExpectNoError(err, "While fetching pvc after controller resize")
476476

477477
inProgressConditions := pvc.Status.Conditions
478478
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")
480480
}
481481

482-
By("Deleting the previously created pod")
482+
ginkgo.By("Deleting the previously created pod")
483483
err = framework.DeletePodWithWait(f, m.cs, pod)
484484
framework.ExpectNoError(err, "while deleting pod for resizing")
485485

486-
By("Creating a new pod with same volume")
486+
ginkgo.By("Creating a new pod with same volume")
487487
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")
489489
framework.ExpectNoError(err, "while recreating pod for resizing")
490490

491491
checkPVCSize()
492492
}
493493
})
494494
}
495495
})
496-
Context("CSI online volume expansion [Feature:ExpandCSIVolumes][Feature:ExpandInUseVolumes]", func() {
496+
ginkgo.Context("CSI online volume expansion [Feature:ExpandCSIVolumes][Feature:ExpandInUseVolumes]", func() {
497497
tests := []struct {
498498
name string
499499
disableAttach bool
@@ -508,7 +508,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
508508
}
509509
for _, t := range tests {
510510
test := t
511-
It(test.name, func() {
511+
ginkgo.It(test.name, func() {
512512
var err error
513513
params := testParameters{enableResizing: true, enableNodeExpansion: true}
514514
if test.disableAttach {
@@ -521,34 +521,34 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
521521
defer cleanup()
522522

523523
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")
525525

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")
527527

528528
err = framework.WaitForPodNameRunningInNamespace(m.cs, pod.Name, pod.Namespace)
529529
framework.ExpectNoError(err, "Failed to start pod1: %v", err)
530530

531-
By("Expanding current pvc")
531+
ginkgo.By("Expanding current pvc")
532532
newSize := resource.MustParse("6Gi")
533533
pvc, err = expandPVCSize(pvc, newSize, m.cs)
534534
framework.ExpectNoError(err, "While updating pvc for more size")
535-
Expect(pvc).NotTo(BeNil())
535+
gomega.Expect(pvc).NotTo(gomega.BeNil())
536536

537537
pvcSize := pvc.Spec.Resources.Requests[v1.ResourceStorage]
538538
if pvcSize.Cmp(newSize) != 0 {
539539
framework.Failf("error updating pvc size %q", pvc.Name)
540540
}
541541

542-
By("Waiting for persistent volume resize to finish")
542+
ginkgo.By("Waiting for persistent volume resize to finish")
543543
err = waitForControllerVolumeResize(pvc, m.cs, csiResizeWaitPeriod)
544544
framework.ExpectNoError(err, "While waiting for PV resize to finish")
545545

546-
By("Waiting for PVC resize to finish")
546+
ginkgo.By("Waiting for PVC resize to finish")
547547
pvc, err = waitForFSResize(pvc, m.cs)
548548
framework.ExpectNoError(err, "while waiting for PVC to finish")
549549

550550
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")
552552

553553
})
554554
}
@@ -801,7 +801,7 @@ func getVolumeHandle(cs clientset.Interface, claim *v1.PersistentVolumeClaim) st
801801
return ""
802802
}
803803
if pv.Spec.CSI == nil {
804-
Expect(pv.Spec.CSI).NotTo(BeNil())
804+
gomega.Expect(pv.Spec.CSI).NotTo(gomega.BeNil())
805805
return ""
806806
}
807807
return pv.Spec.CSI.VolumeHandle

0 commit comments

Comments
 (0)