diff options
author | vitalyisaev <vitalyisaev@ydb.tech> | 2023-12-12 21:55:07 +0300 |
---|---|---|
committer | vitalyisaev <vitalyisaev@ydb.tech> | 2023-12-12 22:25:10 +0300 |
commit | 4967f99474a4040ba150eb04995de06342252718 (patch) | |
tree | c9c118836513a8fab6e9fcfb25be5d404338bca7 /vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/endpoints_test.go | |
parent | 2ce9cccb9b0bdd4cd7a3491dc5cbf8687cda51de (diff) | |
download | ydb-4967f99474a4040ba150eb04995de06342252718.tar.gz |
YQ Connector: prepare code base for S3 integration
1. Кодовая база Коннектора переписана с помощью Go дженериков так, чтобы добавление нового источника данных (в частности S3 + csv) максимально переиспользовало имеющийся код (чтобы сохранялась логика нарезания на блоки данных, учёт трафика и пр.)
2. API Connector расширено для работы с S3, но ещё пока не протестировано.
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/endpoints_test.go')
-rw-r--r-- | vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/endpoints_test.go | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/endpoints_test.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/endpoints_test.go new file mode 100644 index 0000000000..f107b5a92a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/endpoints_test.go @@ -0,0 +1,70 @@ +package endpoints + +import ( + "reflect" + "testing" +) + +func TestEndpointResolve(t *testing.T) { + defs := Endpoint{ + Hostname: "service.{region}.amazonaws.com", + SignatureVersions: []string{"v4"}, + } + + e := Endpoint{ + Protocols: []string{"http", "https"}, + SignatureVersions: []string{"v4"}, + CredentialScope: CredentialScope{ + Region: "us-west-2", + Service: "service", + }, + } + + resolved, err := e.resolve("aws", "us-west-2", defs, Options{}) + if err != nil { + t.Errorf("expect no error, got %v", err) + } + + if e, a := "https://service.us-west-2.amazonaws.com", resolved.URL; e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := "aws", resolved.PartitionID; e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := "service", resolved.SigningName; e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := "us-west-2", resolved.SigningRegion; e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := "v4", resolved.SigningMethod; e != a { + t.Errorf("expect %v, got %v", e, a) + } +} + +func TestEndpointMergeIn(t *testing.T) { + expected := Endpoint{ + Hostname: "other hostname", + Protocols: []string{"http"}, + SignatureVersions: []string{"v4"}, + CredentialScope: CredentialScope{ + Region: "region", + Service: "service", + }, + } + + actual := Endpoint{} + actual.mergeIn(Endpoint{ + Hostname: "other hostname", + Protocols: []string{"http"}, + SignatureVersions: []string{"v4"}, + CredentialScope: CredentialScope{ + Region: "region", + Service: "service", + }, + }) + + if e, a := expected, actual; !reflect.DeepEqual(e, a) { + t.Errorf("expect %v, got %v", e, a) + } +} |