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/awsrulesfn/host_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/awsrulesfn/host_test.go')
-rw-r--r-- | vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/host_test.go | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/host_test.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/host_test.go new file mode 100644 index 0000000000..254c9fab4f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/host_test.go @@ -0,0 +1,75 @@ +package awsrulesfn + +import ( + "testing" +) + +func TestIsVirtualHostableS3Bucket(t *testing.T) { + cases := map[string]struct { + input string + allowSubDomains bool + expect bool + }{ + "single label no split": { + input: "abc123-", + expect: true, + }, + "single label no split too short": { + input: "a", + expect: false, + }, + "single label with split": { + input: "abc123-", + allowSubDomains: true, + expect: true, + }, + "multiple labels no split": { + input: "abc.123-", + expect: false, + }, + "multiple labels with split": { + input: "abc.123-", + allowSubDomains: true, + expect: true, + }, + "multiple labels with split invalid label": { + input: "abc.123-...", + allowSubDomains: true, + expect: false, + }, + "max length host label": { + input: "012345678901234567890123456789012345678901234567890123456789123", + expect: true, + }, + "too large host label": { + input: "0123456789012345678901234567890123456789012345678901234567891234", + expect: false, + }, + "too small host label": { + input: "", + expect: false, + }, + "lower case only": { + input: "AbC", + expect: false, + }, + "like IP address": { + input: "127.111.222.123", + expect: false, + }, + "multiple labels like IP address": { + input: "127.111.222.123", + allowSubDomains: true, + expect: false, + }, + } + + for name, c := range cases { + t.Run(name, func(t *testing.T) { + actual := IsVirtualHostableS3Bucket(c.input, c.allowSubDomains) + if e, a := c.expect, actual; e != a { + t.Fatalf("expect %v hostable bucket, got %v", e, a) + } + }) + } +} |