Skip to content

Commit a98f5d6

Browse files
authored
Merge branch 'scaleway:master' into master
2 parents 65b22b9 + 6fd860d commit a98f5d6

File tree

169 files changed

+147819
-135287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+147819
-135287
lines changed

core/testing.go

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,23 @@ func createTestClient(
306306
// because they will be executed without waiting.
307307
var DefaultRetryInterval *time.Duration
308308

309+
var foldersUsingVCRv4 = []string{
310+
"instance",
311+
}
312+
313+
func folderUsesVCRv4(fullFolderPath string) bool {
314+
fullPathSplit := strings.Split(fullFolderPath, "/")
315+
316+
folder := fullPathSplit[len(fullPathSplit)-1]
317+
for _, migratedFolder := range foldersUsingVCRv4 {
318+
if migratedFolder == folder {
319+
return true
320+
}
321+
}
322+
323+
return false
324+
}
325+
309326
// Run a CLI integration test. See TestConfig for configuration option
310327
func Test(config *TestConfig) func(t *testing.T) {
311328
return func(t *testing.T) {
@@ -348,7 +365,23 @@ func Test(config *TestConfig) func(t *testing.T) {
348365
ctx = interactive.InjectMockResponseToContext(ctx, config.PromptResponseMocks)
349366
}
350367

351-
httpClient, cleanup, err := getHTTPRecoder(t, *UpdateCassettes)
368+
folder, err := os.Getwd()
369+
if err != nil {
370+
t.Fatalf("cannot detect working directory for testing")
371+
}
372+
373+
// Create an HTTP client with recording capabilities
374+
var (
375+
httpClient *http.Client
376+
cleanup func()
377+
)
378+
379+
if folderUsesVCRv4(folder) {
380+
httpClient, cleanup, err = newHTTPRecorder(t, folder, *UpdateCassettes)
381+
} else {
382+
httpClient, cleanup, err = getHTTPRecoder(t, *UpdateCassettes)
383+
}
384+
352385
require.NoError(t, err)
353386
defer cleanup()
354387

core/testing_recorder.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
"github.com/dnaeon/go-vcr/cassette"
1414
"github.com/dnaeon/go-vcr/recorder"
15+
"github.com/scaleway/scaleway-sdk-go/vcr"
1516
"github.com/stretchr/testify/assert"
1617
)
1718

@@ -155,3 +156,16 @@ func getHTTPRecoder(t *testing.T, update bool) (client *http.Client, cleanup fun
155156
assert.NoError(t, r.Stop()) // Make sure recorder is stopped once done with it
156157
}, nil
157158
}
159+
160+
func newHTTPRecorder(t *testing.T, folder string, update bool) (*http.Client, func(), error) {
161+
t.Helper()
162+
163+
r, err := vcr.NewHTTPRecorder(t, folder, update, &SocketPassthroughTransport{})
164+
if err != nil {
165+
return nil, nil, err
166+
}
167+
168+
return &http.Client{Transport: &retryableHTTPTransport{transport: r}}, func() {
169+
assert.NoError(t, r.Stop()) // Make sure recorder is stopped once done with it
170+
}, nil
171+
}

go.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.25.0
44

55
require (
66
github.com/aws/aws-sdk-go-v2 v1.39.4
7-
github.com/aws/aws-sdk-go-v2/service/s3 v1.88.7
7+
github.com/aws/aws-sdk-go-v2/service/s3 v1.89.0
88
github.com/buildpacks/pack v0.38.2
99
github.com/c-bata/go-prompt v0.2.6
1010
github.com/charmbracelet/bubbletea v1.3.10
@@ -14,7 +14,7 @@ require (
1414
github.com/docker/docker v28.5.1+incompatible
1515
github.com/dustin/go-humanize v1.0.1
1616
github.com/fatih/color v1.18.0
17-
github.com/getsentry/sentry-go v0.36.1
17+
github.com/getsentry/sentry-go v0.36.2
1818
github.com/ghodss/yaml v1.0.0
1919
github.com/gorilla/websocket v1.5.3
2020
github.com/hashicorp/go-version v1.7.0
@@ -119,6 +119,7 @@ require (
119119
github.com/go-logr/logr v1.4.3 // indirect
120120
github.com/go-logr/stdr v1.2.2 // indirect
121121
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
122+
github.com/goccy/go-yaml v1.18.0 // indirect
122123
github.com/gofrs/flock v0.12.1 // indirect
123124
github.com/gogo/protobuf v1.3.2 // indirect
124125
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
@@ -207,6 +208,7 @@ require (
207208
google.golang.org/genproto/googleapis/rpc v0.0.0-20250721164621-a45f3dfb1074 // indirect
208209
google.golang.org/grpc v1.74.2 // indirect
209210
google.golang.org/protobuf v1.36.9 // indirect
211+
gopkg.in/dnaeon/go-vcr.v4 v4.0.5 // indirect
210212
gopkg.in/warnings.v0 v0.1.2 // indirect
211213
gopkg.in/yaml.v2 v2.4.0 // indirect
212214
gotest.tools/gotestsum v1.12.3 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.11 h1:GpMf3z2K
9191
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.11/go.mod h1:6MZP3ZI4QQsgUCFTwMZA2V0sEriNQ8k2hmoHF3qjimQ=
9292
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.11 h1:weapBOuuFIBEQ9OX/NVW3tFQCvSutyjZYk/ga5jDLPo=
9393
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.11/go.mod h1:3C1gN4FmIVLwYSh8etngUS+f1viY6nLCDVtZmrFbDy0=
94-
github.com/aws/aws-sdk-go-v2/service/s3 v1.88.7 h1:Wer3W0GuaedWT7dv/PiWNZGSQFSTcBY2rZpbiUp5xcA=
95-
github.com/aws/aws-sdk-go-v2/service/s3 v1.88.7/go.mod h1:UHKgcRSx8PVtvsc1Poxb/Co3PD3wL7P+f49P0+cWtuY=
94+
github.com/aws/aws-sdk-go-v2/service/s3 v1.89.0 h1:JbCUlVDEjmhpvpIgXP9QN+/jW61WWWj99cGmxMC49hM=
95+
github.com/aws/aws-sdk-go-v2/service/s3 v1.89.0/go.mod h1:UHKgcRSx8PVtvsc1Poxb/Co3PD3wL7P+f49P0+cWtuY=
9696
github.com/aws/aws-sdk-go-v2/service/sso v1.29.1 h1:8OLZnVJPvjnrxEwHFg9hVUof/P4sibH+Ea4KKuqAGSg=
9797
github.com/aws/aws-sdk-go-v2/service/sso v1.29.1/go.mod h1:27M3BpVi0C02UiQh1w9nsBEit6pLhlaH3NHna6WUbDE=
9898
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.34.2 h1:gKWSTnqudpo8dAxqBqZnDoDWCiEh/40FziUjr/mo6uA=
@@ -231,8 +231,8 @@ github.com/gdamore/encoding v1.0.1 h1:YzKZckdBL6jVt2Gc+5p82qhrGiqMdG/eNs6Wy0u3Uh
231231
github.com/gdamore/encoding v1.0.1/go.mod h1:0Z0cMFinngz9kS1QfMjCP8TY7em3bZYeeklsSDPivEo=
232232
github.com/gdamore/tcell/v2 v2.9.0 h1:N6t+eqK7/xwtRPwxzs1PXeRWnm0H9l02CrgJ7DLn1ys=
233233
github.com/gdamore/tcell/v2 v2.9.0/go.mod h1:8/ZoqM9rxzYphT9tH/9LnunhV9oPBqwS8WHGYm5nrmo=
234-
github.com/getsentry/sentry-go v0.36.1 h1:kMJt0WWsxWATUxkvFgVBZdIeHSk/Oiv5P0jZ9e5m/Lw=
235-
github.com/getsentry/sentry-go v0.36.1/go.mod h1:p5Im24mJBeruET8Q4bbcMfCQ+F+Iadc4L48tB1apo2c=
234+
github.com/getsentry/sentry-go v0.36.2 h1:uhuxRPTrUy0dnSzTd0LrYXlBYygLkKY0hhlG5LXarzM=
235+
github.com/getsentry/sentry-go v0.36.2/go.mod h1:p5Im24mJBeruET8Q4bbcMfCQ+F+Iadc4L48tB1apo2c=
236236
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
237237
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
238238
github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=

internal/namespaces/instance/v1/custom_server_action_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func Test_ServerTerminate(t *testing.T) {
7474
_, err := api.GetIP(&instanceSDK.GetIPRequest{
7575
IP: server.PublicIP.ID,
7676
})
77-
require.ErrorAs(t, err, new(*scw.PermissionsDeniedError))
77+
require.ErrorAs(t, err, new(*scw.ResourceNotFoundError))
7878
},
7979
),
8080
DisableParallel: true,

0 commit comments

Comments
 (0)