e2e scheduling priorities: do not reference control loop variable

Otherwise, nodeNameToPodList[nodeName] list will have all its references
identical (corresponding to the control variable reference).
Thus, making all the pods in the list identical.
This commit is contained in:
Jan Chaloupka 2021-09-23 13:08:02 +02:00
parent 9462ca2312
commit b3249a1b39

View File

@ -485,9 +485,9 @@ func podListForEachNode(cs clientset.Interface) map[string][]*v1.Pod {
if err != nil {
framework.Failf("Expect error of invalid, got : %v", err)
}
for _, pod := range allPods.Items {
for i, pod := range allPods.Items {
nodeName := pod.Spec.NodeName
nodeNameToPodList[nodeName] = append(nodeNameToPodList[nodeName], &pod)
nodeNameToPodList[nodeName] = append(nodeNameToPodList[nodeName], &allPods.Items[i])
}
return nodeNameToPodList
}