Skip to content

Commit e4c3100

Browse files
authored
Merge pull request #286 from gibizer/deployment-pvc-fix
[test]Fix PVC handling in SimulateDeployment
2 parents d886a78 + c88ae3f commit e4c3100

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

modules/test/helpers/deployment.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ func (tc *TestHelper) SimulateDeploymentReadyWithPods(name types.NamespacedName,
9292
// with a missing volume. So to avoid that we remove every mount and
9393
// volume from the pod we create here.
9494
pod.Spec.Volumes = []corev1.Volume{}
95-
pod.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{}
95+
for i := range pod.Spec.Containers {
96+
pod.Spec.Containers[i].VolumeMounts = []corev1.VolumeMount{}
97+
}
9698

9799
var netStatus []networkv1.NetworkStatus
98100
for network, IPs := range networkIPs {

modules/test/helpers/statefulset.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ func (tc *TestHelper) SimulateStatefulSetReplicaReadyWithPods(name types.Namespa
7979
// with a missing volume. So to avoid that we remove every mount and
8080
// volume from the pod we create here.
8181
pod.Spec.Volumes = []corev1.Volume{}
82-
pod.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{}
82+
for i := range pod.Spec.Containers {
83+
pod.Spec.Containers[i].VolumeMounts = []corev1.VolumeMount{}
84+
}
8385

8486
var netStatus []networkv1.NetworkStatus
8587
for network, IPs := range networkIPs {

0 commit comments

Comments
 (0)