@@ -20,8 +20,8 @@ import (
20
20
"strconv"
21
21
"time"
22
22
23
- . "github.com/onsi/ginkgo"
24
- . "github.com/onsi/gomega"
23
+ "github.com/onsi/ginkgo"
24
+ "github.com/onsi/gomega"
25
25
v1 "k8s.io/api/core/v1"
26
26
apierrs "k8s.io/apimachinery/pkg/api/errors"
27
27
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -42,14 +42,14 @@ var _ = utils.SIGDescribe("PersistentVolumes [Feature:ReclaimPolicy]", func() {
42
42
nodeInfo * NodeInfo
43
43
)
44
44
45
- BeforeEach (func () {
45
+ ginkgo . BeforeEach (func () {
46
46
c = f .ClientSet
47
47
ns = f .Namespace .Name
48
48
framework .ExpectNoError (framework .WaitForAllNodesSchedulable (c , framework .TestContext .NodeSchedulableTimeout ))
49
49
})
50
50
51
51
utils .SIGDescribe ("persistentvolumereclaim:vsphere" , func () {
52
- BeforeEach (func () {
52
+ ginkgo . BeforeEach (func () {
53
53
framework .SkipUnlessProviderIs ("vsphere" )
54
54
Bootstrap (f )
55
55
nodeInfo = GetReadySchedulableRandomNodeInfo ()
@@ -58,7 +58,7 @@ var _ = utils.SIGDescribe("PersistentVolumes [Feature:ReclaimPolicy]", func() {
58
58
volumePath = ""
59
59
})
60
60
61
- AfterEach (func () {
61
+ ginkgo . AfterEach (func () {
62
62
testCleanupVSpherePersistentVolumeReclaim (c , nodeInfo , ns , volumePath , pv , pvc )
63
63
})
64
64
@@ -74,15 +74,15 @@ var _ = utils.SIGDescribe("PersistentVolumes [Feature:ReclaimPolicy]", func() {
74
74
5. Delete PVC
75
75
6. Verify PV is deleted automatically.
76
76
*/
77
- It ("should delete persistent volume when reclaimPolicy set to delete and associated claim is deleted" , func () {
77
+ ginkgo . It ("should delete persistent volume when reclaimPolicy set to delete and associated claim is deleted" , func () {
78
78
var err error
79
79
volumePath , pv , pvc , err = testSetupVSpherePersistentVolumeReclaim (c , nodeInfo , ns , v1 .PersistentVolumeReclaimDelete )
80
80
framework .ExpectNoError (err )
81
81
82
82
deletePVCAfterBind (c , ns , pvc , pv )
83
83
pvc = nil
84
84
85
- By ("verify pv is deleted" )
85
+ ginkgo . By ("verify pv is deleted" )
86
86
err = framework .WaitForPersistentVolumeDeleted (c , pv .Name , 3 * time .Second , 300 * time .Second )
87
87
framework .ExpectNoError (err )
88
88
@@ -102,43 +102,43 @@ var _ = utils.SIGDescribe("PersistentVolumes [Feature:ReclaimPolicy]", func() {
102
102
8. Delete the pod.
103
103
9. Verify PV should be detached from the node and automatically deleted.
104
104
*/
105
- It ("should not detach and unmount PV when associated pvc with delete as reclaimPolicy is deleted when it is in use by the pod" , func () {
105
+ ginkgo . It ("should not detach and unmount PV when associated pvc with delete as reclaimPolicy is deleted when it is in use by the pod" , func () {
106
106
var err error
107
107
108
108
volumePath , pv , pvc , err = testSetupVSpherePersistentVolumeReclaim (c , nodeInfo , ns , v1 .PersistentVolumeReclaimDelete )
109
109
framework .ExpectNoError (err )
110
110
// Wait for PV and PVC to Bind
111
111
framework .ExpectNoError (framework .WaitOnPVandPVC (c , ns , pv , pvc ))
112
112
113
- By ("Creating the Pod" )
113
+ ginkgo . By ("Creating the Pod" )
114
114
pod , err := framework .CreateClientPod (c , ns , pvc )
115
115
framework .ExpectNoError (err )
116
116
117
- By ("Deleting the Claim" )
117
+ ginkgo . By ("Deleting the Claim" )
118
118
framework .ExpectNoError (framework .DeletePersistentVolumeClaim (c , pvc .Name , ns ), "Failed to delete PVC " , pvc .Name )
119
119
pvc = nil
120
120
121
121
// Verify PV is Present, after PVC is deleted and PV status should be Failed.
122
122
pv , err := c .CoreV1 ().PersistentVolumes ().Get (pv .Name , metav1.GetOptions {})
123
123
framework .ExpectNoError (err )
124
- Expect (framework .WaitForPersistentVolumePhase (v1 .VolumeFailed , c , pv .Name , 1 * time .Second , 60 * time .Second )).NotTo (HaveOccurred ())
124
+ gomega . Expect (framework .WaitForPersistentVolumePhase (v1 .VolumeFailed , c , pv .Name , 1 * time .Second , 60 * time .Second )).NotTo (gomega . HaveOccurred ())
125
125
126
- By ("Verify the volume is attached to the node" )
126
+ ginkgo . By ("Verify the volume is attached to the node" )
127
127
isVolumeAttached , verifyDiskAttachedError := diskIsAttached (pv .Spec .VsphereVolume .VolumePath , pod .Spec .NodeName )
128
- Expect (verifyDiskAttachedError ).NotTo (HaveOccurred ())
129
- Expect (isVolumeAttached ).To (BeTrue ())
128
+ gomega . Expect (verifyDiskAttachedError ).NotTo (gomega . HaveOccurred ())
129
+ gomega . Expect (isVolumeAttached ).To (gomega . BeTrue ())
130
130
131
- By ("Verify the volume is accessible and available in the pod" )
131
+ ginkgo . By ("Verify the volume is accessible and available in the pod" )
132
132
verifyVSphereVolumesAccessible (c , pod , []* v1.PersistentVolume {pv })
133
133
e2elog .Logf ("Verified that Volume is accessible in the POD after deleting PV claim" )
134
134
135
- By ("Deleting the Pod" )
135
+ ginkgo . By ("Deleting the Pod" )
136
136
framework .ExpectNoError (framework .DeletePodWithWait (f , c , pod ), "Failed to delete pod " , pod .Name )
137
137
138
- By ("Verify PV is detached from the node after Pod is deleted" )
139
- Expect (waitForVSphereDiskToDetach (pv .Spec .VsphereVolume .VolumePath , pod .Spec .NodeName )).NotTo (HaveOccurred ())
138
+ ginkgo . By ("Verify PV is detached from the node after Pod is deleted" )
139
+ gomega . Expect (waitForVSphereDiskToDetach (pv .Spec .VsphereVolume .VolumePath , pod .Spec .NodeName )).NotTo (gomega . HaveOccurred ())
140
140
141
- By ("Verify PV should be deleted automatically" )
141
+ ginkgo . By ("Verify PV should be deleted automatically" )
142
142
framework .ExpectNoError (framework .WaitForPersistentVolumeDeleted (c , pv .Name , 1 * time .Second , 30 * time .Second ))
143
143
pv = nil
144
144
volumePath = ""
@@ -162,7 +162,7 @@ var _ = utils.SIGDescribe("PersistentVolumes [Feature:ReclaimPolicy]", func() {
162
162
11. Created POD using PVC created in Step 10 and verify volume content is matching.
163
163
*/
164
164
165
- It ("should retain persistent volume when reclaimPolicy set to retain when associated claim is deleted" , func () {
165
+ ginkgo . It ("should retain persistent volume when reclaimPolicy set to retain when associated claim is deleted" , func () {
166
166
var err error
167
167
var volumeFileContent = "hello from vsphere cloud provider, Random Content is :" + strconv .FormatInt (time .Now ().UnixNano (), 10 )
168
168
@@ -171,27 +171,27 @@ var _ = utils.SIGDescribe("PersistentVolumes [Feature:ReclaimPolicy]", func() {
171
171
172
172
writeContentToVSpherePV (c , pvc , volumeFileContent )
173
173
174
- By ("Delete PVC" )
174
+ ginkgo . By ("Delete PVC" )
175
175
framework .ExpectNoError (framework .DeletePersistentVolumeClaim (c , pvc .Name , ns ), "Failed to delete PVC " , pvc .Name )
176
176
pvc = nil
177
177
178
- By ("Verify PV is retained" )
178
+ ginkgo . By ("Verify PV is retained" )
179
179
e2elog .Logf ("Waiting for PV %v to become Released" , pv .Name )
180
180
err = framework .WaitForPersistentVolumePhase (v1 .VolumeReleased , c , pv .Name , 3 * time .Second , 300 * time .Second )
181
181
framework .ExpectNoError (err )
182
182
framework .ExpectNoError (framework .DeletePersistentVolume (c , pv .Name ), "Failed to delete PV " , pv .Name )
183
183
184
- By ("Creating the PV for same volume path" )
184
+ ginkgo . By ("Creating the PV for same volume path" )
185
185
pv = getVSpherePersistentVolumeSpec (volumePath , v1 .PersistentVolumeReclaimRetain , nil )
186
186
pv , err = c .CoreV1 ().PersistentVolumes ().Create (pv )
187
187
framework .ExpectNoError (err )
188
188
189
- By ("creating the pvc" )
189
+ ginkgo . By ("creating the pvc" )
190
190
pvc = getVSpherePersistentVolumeClaimSpec (ns , nil )
191
191
pvc , err = c .CoreV1 ().PersistentVolumeClaims (ns ).Create (pvc )
192
192
framework .ExpectNoError (err )
193
193
194
- By ("wait for the pv and pvc to bind" )
194
+ ginkgo . By ("wait for the pv and pvc to bind" )
195
195
framework .ExpectNoError (framework .WaitOnPVandPVC (c , ns , pv , pvc ))
196
196
verifyContentOfVSpherePV (c , pvc , volumeFileContent )
197
197
@@ -201,27 +201,27 @@ var _ = utils.SIGDescribe("PersistentVolumes [Feature:ReclaimPolicy]", func() {
201
201
202
202
// Test Setup for persistentvolumereclaim tests for vSphere Provider
203
203
func testSetupVSpherePersistentVolumeReclaim (c clientset.Interface , nodeInfo * NodeInfo , ns string , persistentVolumeReclaimPolicy v1.PersistentVolumeReclaimPolicy ) (volumePath string , pv * v1.PersistentVolume , pvc * v1.PersistentVolumeClaim , err error ) {
204
- By ("running testSetupVSpherePersistentVolumeReclaim" )
205
- By ("creating vmdk" )
204
+ ginkgo . By ("running testSetupVSpherePersistentVolumeReclaim" )
205
+ ginkgo . By ("creating vmdk" )
206
206
volumePath , err = nodeInfo .VSphere .CreateVolume (& VolumeOptions {}, nodeInfo .DataCenterRef )
207
207
if err != nil {
208
208
return
209
209
}
210
- By ("creating the pv" )
210
+ ginkgo . By ("creating the pv" )
211
211
pv = getVSpherePersistentVolumeSpec (volumePath , persistentVolumeReclaimPolicy , nil )
212
212
pv , err = c .CoreV1 ().PersistentVolumes ().Create (pv )
213
213
if err != nil {
214
214
return
215
215
}
216
- By ("creating the pvc" )
216
+ ginkgo . By ("creating the pvc" )
217
217
pvc = getVSpherePersistentVolumeClaimSpec (ns , nil )
218
218
pvc , err = c .CoreV1 ().PersistentVolumeClaims (ns ).Create (pvc )
219
219
return
220
220
}
221
221
222
222
// Test Cleanup for persistentvolumereclaim tests for vSphere Provider
223
223
func testCleanupVSpherePersistentVolumeReclaim (c clientset.Interface , nodeInfo * NodeInfo , ns string , volumePath string , pv * v1.PersistentVolume , pvc * v1.PersistentVolumeClaim ) {
224
- By ("running testCleanupVSpherePersistentVolumeReclaim" )
224
+ ginkgo . By ("running testCleanupVSpherePersistentVolumeReclaim" )
225
225
if len (volumePath ) > 0 {
226
226
err := nodeInfo .VSphere .DeleteVolume (volumePath , nodeInfo .DataCenterRef )
227
227
framework .ExpectNoError (err )
@@ -238,10 +238,10 @@ func testCleanupVSpherePersistentVolumeReclaim(c clientset.Interface, nodeInfo *
238
238
func deletePVCAfterBind (c clientset.Interface , ns string , pvc * v1.PersistentVolumeClaim , pv * v1.PersistentVolume ) {
239
239
var err error
240
240
241
- By ("wait for the pv and pvc to bind" )
241
+ ginkgo . By ("wait for the pv and pvc to bind" )
242
242
framework .ExpectNoError (framework .WaitOnPVandPVC (c , ns , pv , pvc ))
243
243
244
- By ("delete pvc" )
244
+ ginkgo . By ("delete pvc" )
245
245
framework .ExpectNoError (framework .DeletePersistentVolumeClaim (c , pvc .Name , ns ), "Failed to delete PVC " , pvc .Name )
246
246
pvc , err = c .CoreV1 ().PersistentVolumeClaims (ns ).Get (pvc .Name , metav1.GetOptions {})
247
247
if ! apierrs .IsNotFound (err ) {
0 commit comments