Skip to content

Commit aaf5001

Browse files
authored
misc: add integration test for empty S3 object (#1015)
1 parent 17733a9 commit aaf5001

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

services/s3/e2eTest/src/S3IntegrationTest.kt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,25 @@ class S3BucketOpsIntegrationTest {
110110
assertEquals(contents, roundTrippedContents)
111111
}
112112

113+
@Test
114+
fun testGetEmptyObject(): Unit = runBlocking {
115+
// See https://github.com/awslabs/aws-sdk-kotlin/issues/1014
116+
val keyName = "get-empty-obj.txt"
117+
118+
client.putObject {
119+
bucket = testBucket
120+
key = keyName
121+
body = ByteStream.fromBytes(byteArrayOf())
122+
}
123+
124+
val req = GetObjectRequest {
125+
bucket = testBucket
126+
key = keyName
127+
}
128+
val actualLength = client.getObject(req) { it.contentLength }
129+
assertEquals(0, actualLength)
130+
}
131+
113132
@Test
114133
fun testQueryParameterEncoding(): Unit = runBlocking {
115134
// see: https://github.com/awslabs/aws-sdk-kotlin/issues/448

0 commit comments

Comments
 (0)