Merge pull request #3702 from towca/jtuznik/simulator-fix
Fix an out-of-bound array access in simulator.TestClear()
This commit is contained in:
		
						commit
						1b6716c98c
					
				|  | @ -53,6 +53,10 @@ func createTestPods(n int) []*apiv1.Pod { | |||
| } | ||||
| 
 | ||||
| func assignPodsToNodes(pods []*apiv1.Pod, nodes []*apiv1.Node) { | ||||
| 	if len(nodes) == 0 { | ||||
| 		return | ||||
| 	} | ||||
| 
 | ||||
| 	j := 0 | ||||
| 	for i := 0; i < len(pods); i++ { | ||||
| 		if j >= len(nodes) { | ||||
|  |  | |||
|  | @ -240,8 +240,8 @@ func TestClear(t *testing.T) { | |||
| 	// Run with -count=1 to avoid caching.
 | ||||
| 	localRand := rand.New(rand.NewSource(time.Now().Unix())) | ||||
| 
 | ||||
| 	nodeCount := localRand.Intn(100) | ||||
| 	podCount := localRand.Intn(1000) | ||||
| 	nodeCount := localRand.Intn(99) + 1 | ||||
| 	podCount := localRand.Intn(999) + 1 | ||||
| 	extraNodeCount := localRand.Intn(100) | ||||
| 	extraPodCount := localRand.Intn(1000) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue