@@ -36,23 +36,23 @@ import (
36
36
----------
37
37
1. Create VMDK.
38
38
2. Create pv with label volume-type:ssd, volume path set to vmdk created in previous step, and PersistentVolumeReclaimPolicy is set to Delete.
39
- 3. Create PVC (pvc_vvol ) with label selector to match with volume-type:vvol
40
- 4. Create PVC (pvc_ssd ) with label selector to match with volume-type:ssd
41
- 5. Wait and verify pvc_ssd is bound with PV.
42
- 6. Verify Status of pvc_vvol is still pending.
43
- 7. Delete pvc_ssd .
39
+ 3. Create PVC (pvcVvol ) with label selector to match with volume-type:vvol
40
+ 4. Create PVC (pvcSsd ) with label selector to match with volume-type:ssd
41
+ 5. Wait and verify pvSsd is bound with PV.
42
+ 6. Verify Status of pvcVvol is still pending.
43
+ 7. Delete pvcSsd .
44
44
8. verify associated pv is also deleted.
45
- 9. delete pvc_vvol
45
+ 9. delete pvcVvol
46
46
47
47
*/
48
48
var _ = utils .SIGDescribe ("PersistentVolumes [Feature:LabelSelector]" , func () {
49
49
f := framework .NewDefaultFramework ("pvclabelselector" )
50
50
var (
51
51
c clientset.Interface
52
52
ns string
53
- pv_ssd * v1.PersistentVolume
54
- pvc_ssd * v1.PersistentVolumeClaim
55
- pvc_vvol * v1.PersistentVolumeClaim
53
+ pvSsd * v1.PersistentVolume
54
+ pvcSsd * v1.PersistentVolumeClaim
55
+ pvcVvol * v1.PersistentVolumeClaim
56
56
volumePath string
57
57
ssdlabels map [string ]string
58
58
vvollabels map [string ]string
@@ -77,35 +77,35 @@ var _ = utils.SIGDescribe("PersistentVolumes [Feature:LabelSelector]", func() {
77
77
ginkgo .AfterEach (func () {
78
78
ginkgo .By ("Running clean up actions" )
79
79
if framework .ProviderIs ("vsphere" ) {
80
- testCleanupVSpherePVClabelselector (c , ns , nodeInfo , volumePath , pv_ssd , pvc_ssd , pvc_vvol )
80
+ testCleanupVSpherePVClabelselector (c , ns , nodeInfo , volumePath , pvSsd , pvcSsd , pvcVvol )
81
81
}
82
82
})
83
83
ginkgo .It ("should bind volume with claim for given label" , func () {
84
- volumePath , pv_ssd , pvc_ssd , pvc_vvol , err = testSetupVSpherePVClabelselector (c , nodeInfo , ns , ssdlabels , vvollabels )
84
+ volumePath , pvSsd , pvcSsd , pvcVvol , err = testSetupVSpherePVClabelselector (c , nodeInfo , ns , ssdlabels , vvollabels )
85
85
framework .ExpectNoError (err )
86
86
87
- ginkgo .By ("wait for the pvc_ssd to bind with pv_ssd " )
88
- framework .ExpectNoError (e2epv .WaitOnPVandPVC (c , ns , pv_ssd , pvc_ssd ))
87
+ ginkgo .By ("wait for the pvcSsd to bind with pvSsd " )
88
+ framework .ExpectNoError (e2epv .WaitOnPVandPVC (c , ns , pvSsd , pvcSsd ))
89
89
90
- ginkgo .By ("Verify status of pvc_vvol is pending" )
91
- err = e2epv .WaitForPersistentVolumeClaimPhase (v1 .ClaimPending , c , ns , pvc_vvol .Name , 3 * time .Second , 300 * time .Second )
90
+ ginkgo .By ("Verify status of pvcVvol is pending" )
91
+ err = e2epv .WaitForPersistentVolumeClaimPhase (v1 .ClaimPending , c , ns , pvcVvol .Name , 3 * time .Second , 300 * time .Second )
92
92
framework .ExpectNoError (err )
93
93
94
- ginkgo .By ("delete pvc_ssd " )
95
- framework .ExpectNoError (e2epv .DeletePersistentVolumeClaim (c , pvc_ssd .Name , ns ), "Failed to delete PVC " , pvc_ssd .Name )
94
+ ginkgo .By ("delete pvcSsd " )
95
+ framework .ExpectNoError (e2epv .DeletePersistentVolumeClaim (c , pvcSsd .Name , ns ), "Failed to delete PVC " , pvcSsd .Name )
96
96
97
- ginkgo .By ("verify pv_ssd is deleted" )
98
- err = framework .WaitForPersistentVolumeDeleted (c , pv_ssd .Name , 3 * time .Second , 300 * time .Second )
97
+ ginkgo .By ("verify pvSsd is deleted" )
98
+ err = framework .WaitForPersistentVolumeDeleted (c , pvSsd .Name , 3 * time .Second , 300 * time .Second )
99
99
framework .ExpectNoError (err )
100
100
volumePath = ""
101
101
102
- ginkgo .By ("delete pvc_vvol " )
103
- framework .ExpectNoError (e2epv .DeletePersistentVolumeClaim (c , pvc_vvol .Name , ns ), "Failed to delete PVC " , pvc_vvol .Name )
102
+ ginkgo .By ("delete pvcVvol " )
103
+ framework .ExpectNoError (e2epv .DeletePersistentVolumeClaim (c , pvcVvol .Name , ns ), "Failed to delete PVC " , pvcVvol .Name )
104
104
})
105
105
})
106
106
})
107
107
108
- func testSetupVSpherePVClabelselector (c clientset.Interface , nodeInfo * NodeInfo , ns string , ssdlabels map [string ]string , vvollabels map [string ]string ) (volumePath string , pv_ssd * v1.PersistentVolume , pvc_ssd * v1.PersistentVolumeClaim , pvc_vvol * v1.PersistentVolumeClaim , err error ) {
108
+ func testSetupVSpherePVClabelselector (c clientset.Interface , nodeInfo * NodeInfo , ns string , ssdlabels map [string ]string , vvollabels map [string ]string ) (volumePath string , pvSsd * v1.PersistentVolume , pvcSsd * v1.PersistentVolumeClaim , pvcVvol * v1.PersistentVolumeClaim , err error ) {
109
109
ginkgo .By ("creating vmdk" )
110
110
volumePath = ""
111
111
volumePath , err = nodeInfo .VSphere .CreateVolume (& VolumeOptions {}, nodeInfo .DataCenterRef )
@@ -114,37 +114,37 @@ func testSetupVSpherePVClabelselector(c clientset.Interface, nodeInfo *NodeInfo,
114
114
}
115
115
116
116
ginkgo .By ("creating the pv with label volume-type:ssd" )
117
- pv_ssd = getVSpherePersistentVolumeSpec (volumePath , v1 .PersistentVolumeReclaimDelete , ssdlabels )
118
- pv_ssd , err = c .CoreV1 ().PersistentVolumes ().Create (pv_ssd )
117
+ pvSsd = getVSpherePersistentVolumeSpec (volumePath , v1 .PersistentVolumeReclaimDelete , ssdlabels )
118
+ pvSsd , err = c .CoreV1 ().PersistentVolumes ().Create (pvSsd )
119
119
if err != nil {
120
120
return
121
121
}
122
122
123
123
ginkgo .By ("creating pvc with label selector to match with volume-type:vvol" )
124
- pvc_vvol = getVSpherePersistentVolumeClaimSpec (ns , vvollabels )
125
- pvc_vvol , err = c .CoreV1 ().PersistentVolumeClaims (ns ).Create (pvc_vvol )
124
+ pvcVvol = getVSpherePersistentVolumeClaimSpec (ns , vvollabels )
125
+ pvcVvol , err = c .CoreV1 ().PersistentVolumeClaims (ns ).Create (pvcVvol )
126
126
if err != nil {
127
127
return
128
128
}
129
129
130
130
ginkgo .By ("creating pvc with label selector to match with volume-type:ssd" )
131
- pvc_ssd = getVSpherePersistentVolumeClaimSpec (ns , ssdlabels )
132
- pvc_ssd , err = c .CoreV1 ().PersistentVolumeClaims (ns ).Create (pvc_ssd )
131
+ pvcSsd = getVSpherePersistentVolumeClaimSpec (ns , ssdlabels )
132
+ pvcSsd , err = c .CoreV1 ().PersistentVolumeClaims (ns ).Create (pvcSsd )
133
133
return
134
134
}
135
135
136
- func testCleanupVSpherePVClabelselector (c clientset.Interface , ns string , nodeInfo * NodeInfo , volumePath string , pv_ssd * v1.PersistentVolume , pvc_ssd * v1.PersistentVolumeClaim , pvc_vvol * v1.PersistentVolumeClaim ) {
136
+ func testCleanupVSpherePVClabelselector (c clientset.Interface , ns string , nodeInfo * NodeInfo , volumePath string , pvSsd * v1.PersistentVolume , pvcSsd * v1.PersistentVolumeClaim , pvcVvol * v1.PersistentVolumeClaim ) {
137
137
ginkgo .By ("running testCleanupVSpherePVClabelselector" )
138
138
if len (volumePath ) > 0 {
139
139
nodeInfo .VSphere .DeleteVolume (volumePath , nodeInfo .DataCenterRef )
140
140
}
141
- if pvc_ssd != nil {
142
- framework .ExpectNoError (e2epv .DeletePersistentVolumeClaim (c , pvc_ssd .Name , ns ), "Failed to delete PVC " , pvc_ssd .Name )
141
+ if pvcSsd != nil {
142
+ framework .ExpectNoError (e2epv .DeletePersistentVolumeClaim (c , pvcSsd .Name , ns ), "Failed to delete PVC " , pvcSsd .Name )
143
143
}
144
- if pvc_vvol != nil {
145
- framework .ExpectNoError (e2epv .DeletePersistentVolumeClaim (c , pvc_vvol .Name , ns ), "Failed to delete PVC " , pvc_vvol .Name )
144
+ if pvcVvol != nil {
145
+ framework .ExpectNoError (e2epv .DeletePersistentVolumeClaim (c , pvcVvol .Name , ns ), "Failed to delete PVC " , pvcVvol .Name )
146
146
}
147
- if pv_ssd != nil {
148
- framework .ExpectNoError (e2epv .DeletePersistentVolume (c , pv_ssd .Name ), "Failed to delete PV " , pv_ssd .Name )
147
+ if pvSsd != nil {
148
+ framework .ExpectNoError (e2epv .DeletePersistentVolume (c , pvSsd .Name ), "Failed to delete PV " , pvSsd .Name )
149
149
}
150
150
}
0 commit comments