Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce total duration of clusterctl tests by switching from wait.Poll to wait.PollImmediate(...) #331

Merged
merged 1 commit into from
Jun 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions clusterctl/clusterdeployer/clusterclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (c *clusterClient) kubectlApply(manifest string) error {
}

func (c *clusterClient) waitForKubectlApply(manifest string) error {
err := util.Poll(RetryIntervalKubectlApply, TimeoutKubectlApply, func() (bool, error) {
err := util.PollImmediate(RetryIntervalKubectlApply, TimeoutKubectlApply, func() (bool, error) {
glog.V(2).Infof("Waiting for kubectl apply...")
err := c.kubectlApply(manifest)
if err != nil {
Expand All @@ -201,7 +201,7 @@ func (c *clusterClient) waitForKubectlApply(manifest string) error {
}

func waitForClusterResourceReady(cs clientset.Interface) error {
err := util.Poll(RetryIntervalResourceReady, TimeoutResourceReady, func() (bool, error) {
err := util.PollImmediate(RetryIntervalResourceReady, TimeoutResourceReady, func() (bool, error) {
glog.V(2).Info("Waiting for Cluster v1alpha resources to become available...")
_, err := cs.Discovery().ServerResourcesForGroupVersion("cluster.k8s.io/v1alpha1")
if err == nil {
Expand All @@ -214,7 +214,7 @@ func waitForClusterResourceReady(cs clientset.Interface) error {
}

func waitForMachineReady(cs clientset.Interface, machine *clusterv1.Machine) error {
err := util.Poll(RetryIntervalResourceReady, TimeoutMachineReady, func() (bool, error) {
err := util.PollImmediate(RetryIntervalResourceReady, TimeoutMachineReady, func() (bool, error) {
glog.V(2).Infof("Waiting for Machine %v to become ready...", machine.Name)
m, err := cs.ClusterV1alpha1().Machines(apiv1.NamespaceDefault).Get(machine.Name, metav1.GetOptions{})
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion clusterctl/clusterdeployer/clusterdeployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func (d *ClusterDeployer) writeKubeconfig(kubeconfig string) error {

func waitForKubeconfigReady(provider ProviderDeployer, cluster *clusterv1.Cluster, machine *clusterv1.Machine) (string, error) {
kubeconfig := ""
err := util.Poll(5*time.Second, 10*time.Minute, func() (bool, error) {
err := util.PollImmediate(5*time.Second, 10*time.Minute, func() (bool, error) {
glog.V(2).Infof("Waiting for kubeconfig on %v to become ready...", machine.Name)
k, err := provider.GetKubeConfig(cluster, machine)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions util/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ func Retry(fn wait.ConditionFunc, initialBackoffSec int) error {

func Poll(interval, timeout time.Duration, condition wait.ConditionFunc) error {
return wait.Poll(interval, timeout, condition)
}

func PollImmediate(interval, timeout time.Duration, condition wait.ConditionFunc) error {
return wait.PollImmediate(interval, timeout, condition)
}