@@ -875,7 +875,15 @@ func newClaimArray(name, claimUID, capacity, boundToVolume string, phase v1.Pers
875
875
}
876
876
877
877
// newVolume returns a new volume with given attributes
878
- func newVolume (name , volumeUID , volumeHandle , capacity , boundToClaimUID , boundToClaimName string , phase v1.PersistentVolumePhase , reclaimPolicy v1.PersistentVolumeReclaimPolicy , class string , annotations ... string ) * v1.PersistentVolume {
878
+ func newVolume (name , volumeUID , volumeHandle , capacity , boundToClaimUID , boundToClaimName string , phase v1.PersistentVolumePhase , reclaimPolicy v1.PersistentVolumeReclaimPolicy , class string , driver string , namespace string , annotations ... string ) * v1.PersistentVolume {
879
+ inDriverName := mockDriverName
880
+ if driver != "" {
881
+ inDriverName = driver
882
+ }
883
+ inNamespace := testNamespace
884
+ if namespace != "" {
885
+ inNamespace = namespace
886
+ }
879
887
volume := v1.PersistentVolume {
880
888
ObjectMeta : metav1.ObjectMeta {
881
889
Name : name ,
@@ -889,7 +897,7 @@ func newVolume(name, volumeUID, volumeHandle, capacity, boundToClaimUID, boundTo
889
897
},
890
898
PersistentVolumeSource : v1.PersistentVolumeSource {
891
899
CSI : & v1.CSIPersistentVolumeSource {
892
- Driver : mockDriverName ,
900
+ Driver : inDriverName ,
893
901
VolumeHandle : volumeHandle ,
894
902
},
895
903
},
@@ -907,7 +915,7 @@ func newVolume(name, volumeUID, volumeHandle, capacity, boundToClaimUID, boundTo
907
915
Kind : "PersistentVolumeClaim" ,
908
916
APIVersion : "v1" ,
909
917
UID : types .UID (boundToClaimUID ),
910
- Namespace : testNamespace ,
918
+ Namespace : inNamespace ,
911
919
Name : boundToClaimName ,
912
920
}
913
921
}
@@ -917,9 +925,9 @@ func newVolume(name, volumeUID, volumeHandle, capacity, boundToClaimUID, boundTo
917
925
918
926
// newVolumeArray returns array with a single volume that would be returned by
919
927
// newVolume() with the same parameters.
920
- func newVolumeArray (name , volumeUID , volumeHandle , capacity , boundToClaimUID , boundToClaimName string , phase v1.PersistentVolumePhase , reclaimPolicy v1.PersistentVolumeReclaimPolicy , class string ) []* v1.PersistentVolume {
928
+ func newVolumeArray (name , volumeUID , volumeHandle , capacity , boundToClaimUID , boundToClaimName string , phase v1.PersistentVolumePhase , reclaimPolicy v1.PersistentVolumeReclaimPolicy , class string , driver string , namespace string ) []* v1.PersistentVolume {
921
929
return []* v1.PersistentVolume {
922
- newVolume (name , volumeUID , volumeHandle , capacity , boundToClaimUID , boundToClaimName , phase , reclaimPolicy , class ),
930
+ newVolume (name , volumeUID , volumeHandle , capacity , boundToClaimUID , boundToClaimName , phase , reclaimPolicy , class , driver , namespace ),
923
931
}
924
932
}
925
933
0 commit comments