-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #680 from snowflakedb/ignore405ForGetBucketAcceler…
…ateConfiguration Ignore 405 error when S3 Acceleration is disabled on the S3 bucket
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} | ||
} |