Merge pull request #8369 from brendandburns/e2e

Fix some races/multi-thread access in the reboot test.
This commit is contained in:
Brendan Burns 2015-05-15 20:31:58 -07:00
commit fce749b048

View File

@ -112,7 +112,7 @@ func rebootNode(c *client.Client, provider, name string, result chan bool) {
Logf("Getting %s", name) Logf("Getting %s", name)
node, err := c.Nodes().Get(name) node, err := c.Nodes().Get(name)
if err != nil { if err != nil {
Logf("Gouldn't get node %s", name) Logf("Couldn't get node %s", name)
result <- false result <- false
return return
} }
@ -215,15 +215,13 @@ func checkPodsRunning(c *client.Client, podNames []string, timeout time.Duration
desc := "running and ready" desc := "running and ready"
Logf("Waiting up to %v for the following pods to be %s: %s", timeout, desc, podNames) Logf("Waiting up to %v for the following pods to be %s: %s", timeout, desc, podNames)
result := make(chan bool, len(podNames)) result := make(chan bool, len(podNames))
for _, podName := range podNames { for ix := range podNames {
// Don't you just love Go?
podName := podName
// Launch off pod readiness checkers. // Launch off pod readiness checkers.
go func() { go func(name string) {
err := waitForPodCondition(c, api.NamespaceDefault, podName, desc, err := waitForPodCondition(c, api.NamespaceDefault, name, desc,
poll, timeout, podRunningReady) poll, timeout, podRunningReady)
result <- err == nil result <- err == nil
}() }(podNames[ix])
} }
// Wait for them all to finish. // Wait for them all to finish.
success := true success := true