Skip to content

Commit b564de2

Browse files
committed
Test changes
1 parent e64bbd3 commit b564de2

File tree

3 files changed

+39
-11
lines changed

3 files changed

+39
-11
lines changed

hadoop-tools/hadoop-aws/src/site/markdown/tools/hadoop-aws/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ before 2021.
3131
Consult [S3A and Directory Markers](directory_markers.html) for
3232
full details.
3333

34+
### <a name="bucket-name-compatibility"></a> S3 Bucket Name Compatibility
35+
36+
This release adds support for S3 bucket names containing dots followed by numbers
37+
(e.g., `my-bucket-v1.1`, `data-store.v2.3`). Previous versions of the Hadoop S3A
38+
client failed to initialize such buckets due to URI parsing limitations.
39+
3440
## <a name="documents"></a> Documents
3541

3642
* [Connecting](./connecting.html)

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AConfiguration.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -606,17 +606,6 @@ public void testConfOptionPropagationToFS() throws Exception {
606606
assertOptionEquals(updated, "fs.s3a.propagation", "propagated");
607607
}
608608

609-
@Test
610-
public void testBucketNameWithDotAndNumber() throws Exception {
611-
Configuration config = new Configuration();
612-
Path path = new Path("s3a://test-bucket-v1.1");
613-
try (FileSystem fs = path.getFileSystem(config)) {
614-
assertThat(fs instanceof S3AFileSystem)
615-
.describedAs("FileSystem should be S3AFileSystem instance")
616-
.isTrue();
617-
}
618-
}
619-
620609
@Test
621610
@Timeout(10)
622611
public void testS3SpecificSignerOverride() throws Exception {

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestBucketConfiguration.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.junit.jupiter.api.io.TempDir;
2929

3030
import org.apache.hadoop.conf.Configuration;
31+
import org.apache.hadoop.fs.FileSystem;
3132
import org.apache.hadoop.fs.s3a.auth.delegation.EncryptionSecrets;
3233
import org.apache.hadoop.fs.s3native.S3xLoginHelper;
3334
import org.apache.hadoop.security.ProviderUtils;
@@ -94,6 +95,38 @@ public void testS3xLoginHelperWithDotInBucketName() throws Throwable {
9495
assertEquals("s3a://bucket.v1.2.test", multiDotResult.toString());
9596
}
9697

98+
@Test
99+
public void testBucketNameWithDotAndNumber() throws Exception {
100+
Configuration config = new Configuration();
101+
URI uri = URI.create("s3a://test-bucket-v1.1");
102+
String bucket = uri.getHost();
103+
if (bucket == null) {
104+
bucket = uri.getAuthority();
105+
}
106+
assertThat(bucket)
107+
.describedAs("Bucket name should be extracted correctly")
108+
.isEqualTo("test-bucket-v1.1");
109+
}
110+
111+
@Test
112+
public void testFileSystemCacheForBucketWithDotAndNumber() throws Exception {
113+
Configuration config = new Configuration();
114+
URI uri1 = URI.create("s3a://test-bucket-v1.1");
115+
URI uri2 = URI.create("s3a://test-bucket-v1.2");
116+
117+
FileSystem fs1a = FileSystem.get(uri1, config);
118+
FileSystem fs1b = FileSystem.get(uri1, config);
119+
FileSystem fs2 = FileSystem.get(uri2, config);
120+
121+
assertThat(fs1a)
122+
.describedAs("FileSystem.get should return same cached instance for same URI")
123+
.isSameAs(fs1b);
124+
125+
assertThat(fs1a)
126+
.describedAs("FileSystem.get should return different instance for different bucket")
127+
.isNotSameAs(fs2);
128+
}
129+
97130
@Test
98131
public void testBucketConfigurationPropagation() throws Throwable {
99132
Configuration config = new Configuration(false);

0 commit comments

Comments
 (0)