Commit caef02cf authored by Madhusudan.C.S's avatar Madhusudan.C.S

[Federation][init-06] Check for the availability of federation API server's…

[Federation][init-06] Check for the availability of federation API server's service loadbalancer address before waiting. This speeds up the tests. Otherwise tests end up unnecessarily waiting for the poll interval/duration which is 5 seconds right now.
parent b0022fcd
......@@ -242,7 +242,7 @@ func waitForLoadBalancerAddress(clientset *client.Clientset, svc *api.Service) (
ips := []string{}
hostnames := []string{}
err := wait.PollInfinite(lbAddrRetryInterval, func() (bool, error) {
err := wait.PollImmediateInfinite(lbAddrRetryInterval, func() (bool, error) {
pollSvc, err := clientset.Core().Services(svc.Namespace).Get(svc.Name)
if err != nil {
return false, nil
......
......@@ -192,6 +192,20 @@ func PollInfinite(interval time.Duration, condition ConditionFunc) error {
return PollUntil(interval, condition, done)
}
// PollImmediateInfinite is identical to PollInfinite, except that it
// performs the first check immediately, not waiting interval
// beforehand.
func PollImmediateInfinite(interval time.Duration, condition ConditionFunc) error {
done, err := condition()
if err != nil {
return err
}
if done {
return nil
}
return PollInfinite(interval, condition)
}
// PollUntil is like Poll, but it takes a stop change instead of total duration
func PollUntil(interval time.Duration, condition ConditionFunc, stopCh <-chan struct{}) error {
return WaitFor(poller(interval, 0), condition, stopCh)
......
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