@@ -888,7 +888,15 @@ func newClaimArray(name, claimUID, capacity, boundToVolume string, phase v1.Pers
888
888
}
889
889
890
890
// newVolume returns a new volume with given attributes
891
- func newVolume (name , volumeUID , volumeHandle , capacity , boundToClaimUID , boundToClaimName string , phase v1.PersistentVolumePhase , reclaimPolicy v1.PersistentVolumeReclaimPolicy , class string , annotations ... string ) * v1.PersistentVolume {
891
+ 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 {
892
+ inDriverName := mockDriverName
893
+ if driver != "" {
894
+ inDriverName = driver
895
+ }
896
+ inNamespace := testNamespace
897
+ if namespace != "" {
898
+ inNamespace = namespace
899
+ }
892
900
volume := v1.PersistentVolume {
893
901
ObjectMeta : metav1.ObjectMeta {
894
902
Name : name ,
@@ -902,7 +910,7 @@ func newVolume(name, volumeUID, volumeHandle, capacity, boundToClaimUID, boundTo
902
910
},
903
911
PersistentVolumeSource : v1.PersistentVolumeSource {
904
912
CSI : & v1.CSIPersistentVolumeSource {
905
- Driver : mockDriverName ,
913
+ Driver : inDriverName ,
906
914
VolumeHandle : volumeHandle ,
907
915
},
908
916
},
@@ -920,7 +928,7 @@ func newVolume(name, volumeUID, volumeHandle, capacity, boundToClaimUID, boundTo
920
928
Kind : "PersistentVolumeClaim" ,
921
929
APIVersion : "v1" ,
922
930
UID : types .UID (boundToClaimUID ),
923
- Namespace : testNamespace ,
931
+ Namespace : inNamespace ,
924
932
Name : boundToClaimName ,
925
933
}
926
934
}
@@ -930,9 +938,9 @@ func newVolume(name, volumeUID, volumeHandle, capacity, boundToClaimUID, boundTo
930
938
931
939
// newVolumeArray returns array with a single volume that would be returned by
932
940
// newVolume() with the same parameters.
933
- func newVolumeArray (name , volumeUID , volumeHandle , capacity , boundToClaimUID , boundToClaimName string , phase v1.PersistentVolumePhase , reclaimPolicy v1.PersistentVolumeReclaimPolicy , class string ) []* v1.PersistentVolume {
941
+ func newVolumeArray (name , volumeUID , volumeHandle , capacity , boundToClaimUID , boundToClaimName string , phase v1.PersistentVolumePhase , reclaimPolicy v1.PersistentVolumeReclaimPolicy , class string , driver string , namespace string ) []* v1.PersistentVolume {
934
942
return []* v1.PersistentVolume {
935
- newVolume (name , volumeUID , volumeHandle , capacity , boundToClaimUID , boundToClaimName , phase , reclaimPolicy , class ),
943
+ newVolume (name , volumeUID , volumeHandle , capacity , boundToClaimUID , boundToClaimName , phase , reclaimPolicy , class , driver , namespace ),
936
944
}
937
945
}
938
946
0 commit comments