@@ -126,7 +126,7 @@ func describe() {
126126 podSpec := createPodSpec ([]string {"test" }, "aesmd" )
127127 podSpec .Spec .Volumes = make ([]v1.Volume , 0 )
128128 podSpec .Spec .Volumes = append (podSpec .Spec .Volumes , v1.Volume {
129- Name : "/var/run/ aesmd" ,
129+ Name : "aesmd-socket " ,
130130 VolumeSource : v1.VolumeSource {
131131 EmptyDir : & v1.EmptyDirVolumeSource {
132132 Medium : v1 .StorageMediumMemory ,
@@ -139,14 +139,14 @@ func describe() {
139139 MountPath : "/var/run/aesmd" ,
140140 })
141141 pod := submitCustomPod (f , podSpec )
142- ginkgo .By ("checking Volumes in the pod" )
143- gomega .Expect (len (pod .Spec .Volumes )).To (gomega .Equal (1 ))
144- ginkgo .By ("checking VolumeMounts in the container" )
145- gomega .Expect (len (pod .Spec .Containers [0 ].VolumeMounts )).To (gomega .Equal (1 ))
142+ ginkgo .By ("checking the container volumes have been not mutated" )
143+ checkMutatedVolumes (f , pod , "aesmd-socket" , v1.EmptyDirVolumeSource {})
146144 })
147145}
148146
149147func checkMutatedVolumes (f * framework.Framework , pod * v1.Pod , volumeName string , volumeType interface {}) {
148+ gomega .Expect (len (pod .Spec .Volumes )).To (gomega .Equal (1 ))
149+
150150 switch reflect .TypeOf (volumeType ).String () {
151151 case "v1.HostPathVolumeSource" :
152152 gomega .Expect (pod .Spec .Volumes [0 ].HostPath ).NotTo (gomega .BeNil ())
@@ -157,6 +157,7 @@ func checkMutatedVolumes(f *framework.Framework, pod *v1.Pod, volumeName string,
157157 }
158158
159159 for _ , c := range pod .Spec .Containers {
160+ gomega .Expect (len (c .VolumeMounts )).To (gomega .Equal (1 ))
160161 gomega .Expect (c .VolumeMounts [0 ].Name ).To (gomega .Equal (volumeName ))
161162 }
162163}
0 commit comments