Skip to content

Commit 8ccbfe2

Browse files
committed
fix tests
1 parent cb1ffde commit 8ccbfe2

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

pkg/cloudprovider/aws/builder.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package aws
22

33
import (
44
"fmt"
5+
"net/http"
56
"time"
67

78
"github.com/atlassian-labs/cyclops/pkg/cloudprovider"
@@ -59,6 +60,10 @@ func NewCloudProviderWithRetryConfig(logger logr.Logger, retryConfig RetryConfig
5960
var creds *credentials.Credentials
6061

6162
// Configure AWS SDK with retry logic and timeouts
63+
httpClient := &http.Client{
64+
Timeout: 30 * time.Second,
65+
}
66+
6267
config := &aws.Config{
6368
Credentials: creds,
6469
// Maximum number of retries for API calls
@@ -73,9 +78,7 @@ func NewCloudProviderWithRetryConfig(logger logr.Logger, retryConfig RetryConfig
7378
},
7479
},
7580
// HTTP client timeout (increased from default to handle slow networks)
76-
HTTPClient: &aws.HTTPClient{
77-
Timeout: 30 * time.Second,
78-
},
81+
HTTPClient: httpClient,
7982
}
8083

8184
ec2Service := ec2.New(sess, config)

pkg/cloudprovider/aws/errors.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,12 @@ func retryOnTransientErrorWithConfig(fn func() error, logger logr.Logger, config
160160
lastErr = err
161161

162162
// Log the transient error and retry attempt
163-
if logger != nil {
164-
logger.Info("Transient AWS error, retrying",
165-
"attempt", attempt+1,
166-
"maxRetries", config.MaxRetries,
167-
"delayMs", delayMs,
168-
"retryEnabled", config.Enabled,
169-
"error", err.Error())
170-
}
163+
logger.Info("Transient AWS error, retrying",
164+
"attempt", attempt+1,
165+
"maxRetries", config.MaxRetries,
166+
"delayMs", delayMs,
167+
"retryEnabled", config.Enabled,
168+
"error", err.Error())
171169

172170
// Don't sleep on the last attempt
173171
if attempt < config.MaxRetries-1 {

0 commit comments

Comments
 (0)