add some unit tests

This commit is contained in:
Arthur Passos 2024-04-03 10:11:56 -03:00
parent 15dd5ce5f6
commit f6a240b7be
2 changed files with 21 additions and 0 deletions

View File

@ -17,6 +17,7 @@ namespace DB::S3
* The following patterns are allowed:
* s3://bucket/key
* http(s)://endpoint/bucket/key
* TODO specify aws private link
*/
struct URI
{

View File

@ -74,6 +74,26 @@ const TestCase TestCases[] = {
"data",
"",
true},
{S3::URI("https://bucket.vpce-07a1cd78f1bd55c5f-j3a3vg6w.s3.us-east-1.vpce.amazonaws.com/root/nested/file.txt"),
"https://bucket.vpce-07a1cd78f1bd55c5f-j3a3vg6w.s3.us-east-1.vpce.amazonaws.com",
"root",
"nested/file.txt",
"",
true},
// Test with a file with no extension
{S3::URI("https://bucket.vpce-03b2c987f1bd55c5f-j3b4vg7w.s3.ap-southeast-2.vpce.amazonaws.com/some_bucket/document"),
"https://bucket.vpce-03b2c987f1bd55c5f-j3b4vg7w.s3.ap-southeast-2.vpce.amazonaws.com",
"some_bucket",
"document",
"",
true},
// Test with a deeply nested file path
{S3::URI("https://bucket.vpce-0242cd56f1bd55c5f-l5b7vg8x.s3.sa-east-1.vpce.amazonaws.com/some_bucket/b/c/d/e/f/g/h/i/j/data.json"),
"https://bucket.vpce-0242cd56f1bd55c5f-l5b7vg8x.s3.sa-east-1.vpce.amazonaws.com",
"some_bucket",
"b/c/d/e/f/g/h/i/j/data.json",
"",
true},
};
class S3UriTest : public testing::TestWithParam<std::string>