@@ -239,7 +239,7 @@ func TestMergeContainer(t *testing.T) {
239239
240240 t .Run ("Volume Mounts are overridden" , func (t * testing.T ) {
241241 volumeMounts := mergedContainer .VolumeMounts
242- assert .Len (t , volumeMounts , 2 )
242+ assert .Len (t , volumeMounts , 3 , "volume mounts can have the same name, the uniqueness is the combination of name, path and subpath" )
243243 t .Run ("First VolumeMount is still present" , func (t * testing.T ) {
244244 vm0 := volumeMounts [0 ]
245245 assert .Equal (t , "volume-mount-0" , vm0 .Name )
@@ -249,12 +249,9 @@ func TestMergeContainer(t *testing.T) {
249249 assert .Equal (t , "original-sub-path-expr" , vm0 .SubPathExpr )
250250 })
251251 t .Run ("Second VolumeMount has merged values" , func (t * testing.T ) {
252- vm1 := volumeMounts [1 ]
253- assert .Equal (t , "volume-mount-1" , vm1 .Name )
254- assert .True (t , vm1 .ReadOnly )
255- assert .Equal (t , "override-mount-path-1" , vm1 .MountPath )
256- assert .Equal (t , "override-sub-path-1" , vm1 .SubPath )
257- assert .Equal (t , "override-sub-path-expr-1" , vm1 .SubPathExpr )
252+ assert .Equal (t , volumeMounts [0 ], defaultContainer .VolumeMounts [0 ])
253+ assert .Equal (t , volumeMounts [1 ], defaultContainer .VolumeMounts [1 ])
254+ assert .Equal (t , volumeMounts [2 ], overrideContainer .VolumeMounts [0 ])
258255 })
259256 })
260257 })
@@ -588,20 +585,6 @@ func TestMergeVolumeAddVolume(t *testing.T) {
588585 assert .Equal (t , corev1.EmptyDirVolumeSource {}, * volume1 .EmptyDir )
589586}
590587
591- func TestMergeVolumeMounts (t * testing.T ) {
592- vol0 := corev1.VolumeMount {Name : "container-0.volume-mount-0" }
593- vol1 := corev1.VolumeMount {Name : "another-mount" }
594- volumeMounts := []corev1.VolumeMount {vol1 , vol0 }
595-
596- mergedVolumeMounts := VolumeMounts (nil , volumeMounts )
597- assert .Equal (t , []corev1.VolumeMount {vol1 , vol0 }, mergedVolumeMounts )
598-
599- vol2 := vol1
600- vol2 .MountPath = "/somewhere"
601- mergedVolumeMounts = VolumeMounts ([]corev1.VolumeMount {vol2 }, []corev1.VolumeMount {vol0 , vol1 })
602- assert .Equal (t , []corev1.VolumeMount {vol2 , vol0 }, mergedVolumeMounts )
603- }
604-
605588func TestMergeHostAliases (t * testing.T ) {
606589 ha0 := []corev1.HostAlias {
607590 {
0 commit comments