[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.
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Madhusudan.C.S
					Madhusudan.C.S