Commit f57f3178 authored by Marek Grabowski's avatar Marek Grabowski

Merge pull request #8306 from lvlv/master

Fix a potential bug in TestControllerBurstReplicas
parents a91a7bfe 433a2496
...@@ -889,9 +889,9 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int) ...@@ -889,9 +889,9 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int)
// This simulates the watch events for all but 1 of the expected pods. // This simulates the watch events for all but 1 of the expected pods.
// None of these should wake the controller because it has expectations==BurstReplicas. // None of these should wake the controller because it has expectations==BurstReplicas.
for _, pod := range pods.Items[:expectedPods-1] { for i := 0; i < expectedPods-1; i++ {
manager.podStore.Store.Add(&pod) manager.podStore.Store.Add(&pods.Items[i])
manager.addPod(&pod) manager.addPod(&pods.Items[i])
} }
podExp, exists, err := manager.expectations.GetExpectations(controllerSpec) podExp, exists, err := manager.expectations.GetExpectations(controllerSpec)
...@@ -907,9 +907,9 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int) ...@@ -907,9 +907,9 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int)
expectedPods = burstReplicas expectedPods = burstReplicas
} }
validateSyncReplication(t, &fakePodControl, 0, expectedPods) validateSyncReplication(t, &fakePodControl, 0, expectedPods)
for _, pod := range pods.Items[:expectedPods-1] { for i := 0; i < expectedPods-1; i++ {
manager.podStore.Store.Delete(&pod) manager.podStore.Store.Delete(&pods.Items[i])
manager.deletePod(&pod) manager.deletePod(&pods.Items[i])
} }
podExp, exists, err := manager.expectations.GetExpectations(controllerSpec) podExp, exists, err := manager.expectations.GetExpectations(controllerSpec)
if !exists || err != nil { if !exists || err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment