e2e test for addon update

This commit is contained in:
Marek Biskup
2015-06-15 16:31:17 +02:00
parent e1a03ed737
commit dcc4034d57
6 changed files with 449 additions and 4 deletions

View File

@@ -479,6 +479,34 @@ func waitForRCPodToDisappear(c *client.Client, ns, rcName, podName string) error
})
}
// waits until the service appears (exists == true), or disappears (exists == false)
func waitForService(c *client.Client, namespace, name string, exist bool, interval, timeout time.Duration) error {
return wait.Poll(interval, timeout, func() (bool, error) {
_, err := c.Services(namespace).Get(name)
if err != nil {
Logf("Get service %s in namespace %s failed (%v).", name, namespace, err)
return !exist, nil
} else {
Logf("Service %s in namespace %s found.", name, namespace)
return exist, nil
}
})
}
// waits until the RC appears (exists == true), or disappears (exists == false)
func waitForReplicationController(c *client.Client, namespace, name string, exist bool, interval, timeout time.Duration) error {
return wait.Poll(interval, timeout, func() (bool, error) {
_, err := c.ReplicationControllers(namespace).Get(name)
if err != nil {
Logf("Get ReplicationController %s in namespace %s failed (%v).", name, namespace, err)
return !exist, nil
} else {
Logf("ReplicationController %s in namespace %s found.", name, namespace)
return exist, nil
}
})
}
// Context for checking pods responses by issuing GETs to them and verifying if the answer with pod name.
type podResponseChecker struct {
c *client.Client