You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/12/01 02:51:35 UTC
[james-project] 01/03: JAMES-3676 S3 blob store should not fail upon many partial reads
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch 3.6.x
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 8fd9fc087954143b28fd540bacd2e239b03a41c5
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu Nov 25 14:20:27 2021 +0700
JAMES-3676 S3 blob store should not fail upon many partial reads
---
.../blob/objectstorage/aws/S3BlobStoreDAOTest.java | 33 ++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java b/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java
index e426926..80e8e6a 100644
--- a/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java
+++ b/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java
@@ -18,13 +18,27 @@
****************************************************************/
package org.apache.james.blob.objectstorage.aws;
+import static org.apache.james.blob.api.BlobStoreDAOFixture.ELEVEN_KILOBYTES;
+import static org.apache.james.blob.api.BlobStoreDAOFixture.TEST_BUCKET_NAME;
+import static org.assertj.core.api.Assertions.assertThatCode;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.stream.IntStream;
+
import org.apache.james.blob.api.BlobStoreDAO;
import org.apache.james.blob.api.BlobStoreDAOContract;
+import org.apache.james.blob.api.TestBlobId;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
+import com.google.common.io.ByteSource;
+
+import reactor.core.publisher.Mono;
+
@ExtendWith(DockerAwsS3Extension.class)
public class S3BlobStoreDAOTest implements BlobStoreDAOContract {
private static S3BlobStoreDAO testee;
@@ -59,4 +73,23 @@ public class S3BlobStoreDAOTest implements BlobStoreDAOContract {
public BlobStoreDAO testee() {
return testee;
}
+
+ @Test
+ void readShouldNotLeakHttpConnexionsForUnclosedStreams() {
+ BlobStoreDAO store = testee();
+
+ TestBlobId blobId = new TestBlobId("id");
+ Mono.from(store.save(TEST_BUCKET_NAME, blobId, ByteSource.wrap(ELEVEN_KILOBYTES))).block();
+
+ assertThatCode(() -> IntStream.range(0, 256)
+ .forEach(i -> {
+ InputStream inputStream = store.read(TEST_BUCKET_NAME, blobId);
+ // Close the stream without reading it
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ })).doesNotThrowAnyException();
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org