Skip to content

Commit

Permalink
Fix Build tests failure in s3 due to deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
khrm committed Nov 12, 2024
1 parent 533ea6f commit a67ad1b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 12 deletions.
4 changes: 2 additions & 2 deletions pkg/api/server/v1alpha2/log/gcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func NewRecordReplayClient(t *testing.T, modReq func(r *httpreplay.Recorder), po
if err != nil {
t.Fatal(err)
}
rep.IgnoreHeader("X-Goog-Gcs-Idempotency-Token")

recState := new(time.Time)
if err := recState.UnmarshalBinary(rep.Initial()); err != nil {
Expand All @@ -98,7 +99,6 @@ func NewTestGCPClient(ctx context.Context, port int, t *testing.T) (client *gcp.
r.ClearQueryParams("Signature")
r.ClearHeaders("Expires")
r.ClearHeaders("Signature")
r.ClearHeaders("X-Goog-Gcs-Idempotency-Token")
r.ClearHeaders("User-Agent")
}, port)
if *Record {
Expand Down Expand Up @@ -142,7 +142,7 @@ func TestGCSWriteTo(t *testing.T) {
},
key: gcsTestKey,
}
client, done := NewTestGCPClient(ctx, 8081, t)
client, done := NewTestGCPClient(ctx, 8082, t)
defer done()
gcs.client = client
var w bytes.Buffer
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/server/v1alpha2/log/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ func initConfig(ctx context.Context, cfg *server.Config) (*s3.Client, error) {
var awsConfig aws.Config
var err error
if len(cfg.S3_ENDPOINT) > 0 {
customResolver := aws.EndpointResolverWithOptionsFunc(func(_, region string, _ ...any) (aws.Endpoint, error) {
customResolver := aws.EndpointResolverWithOptionsFunc(func(_, region string, _ ...any) (aws.Endpoint, error) { //nolint:staticcheck
if region == cfg.S3_REGION {
return aws.Endpoint{
return aws.Endpoint{ //nolint:staticcheck
URL: cfg.S3_ENDPOINT,
SigningRegion: cfg.S3_REGION,
HostnameImmutable: cfg.S3_HOSTNAME_IMMUTABLE,
}, nil
}
return aws.Endpoint{}, &aws.EndpointNotFoundError{}
return aws.Endpoint{}, &aws.EndpointNotFoundError{} //nolint:staticcheck
})
awsConfig, err = config.LoadDefaultConfig(ctx, config.WithRegion(cfg.S3_REGION), credentialsOpt, config.WithEndpointResolverWithOptions(customResolver))
awsConfig, err = config.LoadDefaultConfig(ctx, config.WithRegion(cfg.S3_REGION), credentialsOpt, config.WithEndpointResolverWithOptions(customResolver)) //nolint:staticcheck
} else {
awsConfig, err = config.LoadDefaultConfig(ctx, config.WithRegion(cfg.S3_REGION), credentialsOpt)
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/api/server/v1alpha2/log/testdata/TestGCSDelete.replay
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"^X-Goog-.*Encryption-Key$",
"^Expires$",
"^Signature$",
"^X-Goog-Gcs-Idempotency-Token$",
"^User-Agent$"
],
"RemoveRequestHeaders": [
Expand Down Expand Up @@ -47,9 +46,6 @@
],
"User-Agent": [
"CLEARED"
],
"X-Goog-Gcs-Idempotency-Token": [
"CLEARED"
]
},
"MediaType": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"^X-Goog-.*Encryption-Key$",
"^Expires$",
"^Signature$",
"^X-Goog-Gcs-Idempotency-Token$",
"^User-Agent$"
],
"RemoveRequestHeaders": [
Expand Down
1 change: 0 additions & 1 deletion pkg/api/server/v1alpha2/log/testdata/TestGCSWriteTo.replay
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"^X-Goog-.*Encryption-Key$",
"^Expires$",
"^Signature$",
"^X-Goog-Gcs-Idempotency-Token$",
"^User-Agent$"
],
"RemoveRequestHeaders": [
Expand Down

0 comments on commit a67ad1b

Please sign in to comment.