@@ -24,8 +24,8 @@ import (
24
24
)
25
25
26
26
func TestController (t * testing.T ) {
27
- basePVC := createTestPVC (pvcName , testVac /*vacName*/ , testVac /*curVacName*/ , testVac /*targetVacName*/ )
28
- basePV := createTestPV (1 , pvcName , pvcNamespace , "foobaz" /*pvcUID*/ , & fsVolumeMode , testVac )
27
+ basePVC := createTestPVC (pvcName , & testVac /*vacName*/ , & testVac /*curVacName*/ , testVac /*targetVacName*/ , "" /*modifyVolumeStatus */ )
28
+ basePV := createTestPV (1 , pvcName , pvcNamespace , "foobaz" /*pvcUID*/ , & fsVolumeMode , & testVac )
29
29
firstTimePV := basePV .DeepCopy ()
30
30
firstTimePV .Spec .VolumeAttributesClassName = nil
31
31
firstTimePVC := basePVC .DeepCopy ()
@@ -41,7 +41,7 @@ func TestController(t *testing.T) {
41
41
}{
42
42
{
43
43
name : "Modify called" ,
44
- pvc : createTestPVC (pvcName , targetVac /*vacName*/ , testVac /*curVacName*/ , testVac /*targetVacName*/ ),
44
+ pvc : createTestPVC (pvcName , & targetVac /*vacName*/ , & testVac /*curVacName*/ , testVac /*targetVacName*/ , "" /*modifyVolumeStatus */ ),
45
45
pv : basePV ,
46
46
vacExists : true ,
47
47
callCSIModify : true ,
@@ -89,7 +89,7 @@ func TestController(t *testing.T) {
89
89
}
90
90
91
91
func TestModifyPVC (t * testing.T ) {
92
- basePV := createTestPV (1 , pvcName , pvcNamespace , "foobaz" /*pvcUID*/ , & fsVolumeMode , testVac )
92
+ basePV := createTestPV (1 , pvcName , pvcNamespace , "foobaz" /*pvcUID*/ , & fsVolumeMode , & testVac )
93
93
94
94
tests := []struct {
95
95
name string
@@ -100,14 +100,14 @@ func TestModifyPVC(t *testing.T) {
100
100
}{
101
101
{
102
102
name : "Modify succeeded" ,
103
- pvc : createTestPVC (pvcName , targetVac /*vacName*/ , testVac /*curVacName*/ , testVac /*targetVacName*/ ),
103
+ pvc : createTestPVC (pvcName , & targetVac /*vacName*/ , & testVac /*curVacName*/ , testVac /*targetVacName*/ , "" /*modifyVolumeStatus */ ),
104
104
pv : basePV ,
105
105
modifyFailure : false ,
106
106
expectFailure : false ,
107
107
},
108
108
{
109
109
name : "Modify failed" ,
110
- pvc : createTestPVC (pvcName , targetVac /*vacName*/ , testVac /*curVacName*/ , testVac /*targetVacName*/ ),
110
+ pvc : createTestPVC (pvcName , & targetVac /*vacName*/ , & testVac /*curVacName*/ , testVac /*targetVacName*/ , "" /*modifyVolumeStatus */ ),
111
111
pv : basePV ,
112
112
modifyFailure : true ,
113
113
expectFailure : true ,
@@ -140,16 +140,16 @@ func TestModifyPVC(t *testing.T) {
140
140
}
141
141
142
142
func TestSyncPVC (t * testing.T ) {
143
- basePVC := createTestPVC (pvcName , targetVac /*vacName*/ , testVac /*curVacName*/ , testVac /*targetVacName*/ )
144
- basePV := createTestPV (1 , pvcName , pvcNamespace , "foobaz" /*pvcUID*/ , & fsVolumeMode , testVac )
143
+ basePVC := createTestPVC (pvcName , & targetVac /*vacName*/ , & testVac /*curVacName*/ , testVac /*targetVacName*/ , "" /*modifyVolumeStatus */ )
144
+ basePV := createTestPV (1 , pvcName , pvcNamespace , "foobaz" /*pvcUID*/ , & fsVolumeMode , & testVac )
145
145
146
- otherDriverPV := createTestPV (1 , pvcName , pvcNamespace , "foobaz" /*pvcUID*/ , & fsVolumeMode , testVac )
146
+ otherDriverPV := createTestPV (1 , pvcName , pvcNamespace , "foobaz" /*pvcUID*/ , & fsVolumeMode , & testVac )
147
147
otherDriverPV .Spec .PersistentVolumeSource .CSI .Driver = "some-other-driver"
148
148
149
- unboundPVC := createTestPVC (pvcName , targetVac /*vacName*/ , testVac /*curVacName*/ , testVac /*targetVacName*/ )
149
+ unboundPVC := createTestPVC (pvcName , & targetVac /*vacName*/ , & testVac /*curVacName*/ , testVac /*targetVacName*/ , "" /*modifyVolumeStatus */ )
150
150
unboundPVC .Status .Phase = v1 .ClaimPending
151
151
152
- pvcWithUncreatedPV := createTestPVC (pvcName , targetVac /*vacName*/ , testVac /*curVacName*/ , testVac /*targetVacName*/ )
152
+ pvcWithUncreatedPV := createTestPVC (pvcName , & targetVac /*vacName*/ , & testVac /*curVacName*/ , testVac /*targetVacName*/ , "" /*modifyVolumeStatus */ )
153
153
pvcWithUncreatedPV .Spec .VolumeName = ""
154
154
155
155
nonCSIPVC := & v1.PersistentVolumeClaim {
@@ -191,7 +191,7 @@ func TestSyncPVC(t *testing.T) {
191
191
},
192
192
{
193
193
name : "Should NOT modify if PVC has empty Spec.VACName" ,
194
- pvc : createTestPVC (pvcName , "" /*vacName*/ , testVac /*curVacName*/ , testVac /*targetVacName*/ ),
194
+ pvc : createTestPVC (pvcName , & emptyString /*vacName*/ , & testVac /*curVacName*/ , testVac /*targetVacName*/ , "" /*modifyVolumeStatus */ ),
195
195
pv : basePV ,
196
196
callCSIModify : false ,
197
197
},
@@ -241,8 +241,8 @@ func TestSyncPVC(t *testing.T) {
241
241
242
242
// TestInfeasibleRetry tests that sidecar doesn't spam plugin upon infeasible error code (e.g. invalid VAC parameter)
243
243
func TestInfeasibleRetry (t * testing.T ) {
244
- basePVC := createTestPVC (pvcName , targetVac /*vacName*/ , testVac /*curVacName*/ , testVac /*targetVacName*/ )
245
- basePV := createTestPV (1 , pvcName , pvcNamespace , "foobaz" /*pvcUID*/ , & fsVolumeMode , testVac )
244
+ basePVC := createTestPVC (pvcName , & targetVac /*vacName*/ , & testVac /*curVacName*/ , testVac /*targetVacName*/ , "" /*modifyVolumeStatus */ )
245
+ basePV := createTestPV (1 , pvcName , pvcNamespace , "foobaz" /*pvcUID*/ , & fsVolumeMode , & testVac )
246
246
247
247
tests := []struct {
248
248
name string
0 commit comments