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

Ignore 405 error when S3 Acceleration is disabled on the S3 bucket #680

Merged
Merged
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
2 changes: 2 additions & 0 deletions file_transfer_agent.go
Original file line number Diff line number Diff line change
@@ -615,6 +615,8 @@ func (sfa *snowflakeFileTransferAgent) transferAccelerateConfig() error {
if errors.As(err, &ae) {
if ae.ErrorCode() == "AccessDenied" {
return nil
} else if ae.ErrorCode() == "MethodNotAllowed" {
return nil
}
}
return err
44 changes: 44 additions & 0 deletions file_transfer_agent_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright (c) 2022 Snowflake Computing Inc. All rights reserved.

package gosnowflake

import (
"context"
"errors"
"testing"

"github.com/aws/smithy-go"
)

func TestGetBucketAccelerateConfiguration(t *testing.T) {
if runningOnGithubAction() {
t.Skip("Should be run against an account in AWS EU North1 region.")
}
config, err := ParseDSN(dsn)
if err != nil {
t.Error(err)
}
sc, err := buildSnowflakeConn(context.Background(), *config)
if err != nil {
t.Fatal(err)
}
if err = authenticateWithConfig(sc); err != nil {
t.Fatal(err)
}
sfa := &snowflakeFileTransferAgent{
sc: sc,
commandType: uploadCommand,
srcFiles: make([]string, 0),
data: &execResponseData{
SrcLocations: make([]string, 0),
},
}
if err = sfa.transferAccelerateConfig(); err != nil {
var ae smithy.APIError
if errors.As(err, &ae) {
if ae.ErrorCode() == "MethodNotAllowed" {
t.Fatalf("should have ignored 405 error: %v", err)
}
}
}
}