diff --git a/api/baremetal/v1alpha1/server_utils.go b/api/baremetal/v1alpha1/server_utils.go index 48604ae10..51151fc7f 100644 --- a/api/baremetal/v1alpha1/server_utils.go +++ b/api/baremetal/v1alpha1/server_utils.go @@ -8,6 +8,16 @@ import ( "github.com/scaleway/scaleway-sdk-go/scw" ) +var ( + // RetryInterval is needed when running recorded tests (e.g. on scaleway-cli) + // it allows to execute the WaitFor funcs immediately + RetryInterval = defaultRetryInterval +) + +const ( + defaultRetryInterval = 15 * time.Second +) + // WaitForServerRequest is used by WaitForServer method. type WaitForServerRequest struct { ServerID string @@ -40,7 +50,7 @@ func (s *API) WaitForServer(req *WaitForServerRequest) (*Server, error) { return res, isTerminal, err }, Timeout: req.Timeout, - IntervalStrategy: async.LinearIntervalStrategy(5 * time.Second), + IntervalStrategy: async.LinearIntervalStrategy(RetryInterval), }) if err != nil { return nil, errors.Wrap(err, "waiting for server failed") @@ -84,7 +94,7 @@ func (s *API) WaitForServerInstall(req *WaitForServerInstallRequest) (*Server, e return res, isTerminal, err }, Timeout: req.Timeout, - IntervalStrategy: async.LinearIntervalStrategy(15 * time.Second), + IntervalStrategy: async.LinearIntervalStrategy(RetryInterval), }) if err != nil { return nil, errors.Wrap(err, "waiting for server installation failed")