Skip to content

Commit 5caa8cf

Browse files
committed
Added gtest to test s3 uri with bucket name in key
1 parent 357fbb3 commit 5caa8cf

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/Storages/ObjectStorage/tests/gtest_scheme_authority_key.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,18 @@ TEST(ResolveObjectStorageForPathKey, VirtualHostedHttpsKeyMayStartWithBucketName
132132
assertResolveReturnsBaseKey("s3://bucket/warehouse", path, std::move(base_uri), "bucket/nested/file.parquet");
133133
}
134134

135+
TEST(ResolveObjectStorageForPathKey, S3SchemeKeyMayStartWithBucketNamePrefix)
136+
{
137+
const char * path = "s3://bucket/bucket/nested/file.parquet";
138+
S3::URI target(path);
139+
ASSERT_TRUE(target.is_virtual_hosted_style)
140+
<< "Requires s3:// -> virtual-hosted mapping (global context); use HTTPS test if this fails";
141+
142+
S3::URI base_uri;
143+
base_uri.bucket = target.bucket;
144+
base_uri.endpoint = target.endpoint;
145+
146+
assertResolveReturnsBaseKey("s3://bucket/warehouse", path, std::move(base_uri), "bucket/nested/file.parquet");
147+
}
148+
135149
#endif

0 commit comments

Comments
 (0)