@@ -265,7 +265,7 @@ public void testWriteBlobWithRetries() throws Exception {
265265 final int maxRetries = randomInt (5 );
266266 final CountDown countDown = new CountDown (maxRetries + 1 );
267267
268- final BlobContainer blobContainer = createBlobContainer ( maxRetries , null , true , null , null , null );
268+ final BlobContainer blobContainer = blobContainerBuilder (). maxRetries ( maxRetries ). disableChunkedEncoding ( true ). build ( );
269269
270270 final byte [] bytes = randomBlobContent ();
271271 httpServer .createContext (downloadStorageEndpoint (blobContainer , "write_blob_max_retries" ), exchange -> {
@@ -313,7 +313,10 @@ public void testWriteBlobWithRetries() throws Exception {
313313 public void testWriteBlobWithReadTimeouts () {
314314 final byte [] bytes = randomByteArrayOfLength (randomIntBetween (10 , 128 ));
315315 final TimeValue readTimeout = TimeValue .timeValueMillis (randomIntBetween (100 , 500 ));
316- final BlobContainer blobContainer = createBlobContainer (1 , readTimeout , true , null , null , null );
316+ final BlobContainer blobContainer = blobContainerBuilder ().maxRetries (1 )
317+ .readTimeout (readTimeout )
318+ .disableChunkedEncoding (true )
319+ .build ();
317320
318321 // HTTP server does not send a response
319322 httpServer .createContext (downloadStorageEndpoint (blobContainer , "write_blob_timeout" ), exchange -> {
@@ -347,7 +350,11 @@ public void testWriteLargeBlob() throws Exception {
347350 final boolean useTimeout = rarely ();
348351 final TimeValue readTimeout = useTimeout ? TimeValue .timeValueMillis (randomIntBetween (100 , 500 )) : null ;
349352 final ByteSizeValue bufferSize = ByteSizeValue .of (5 , ByteSizeUnit .MB );
350- final BlobContainer blobContainer = createBlobContainer (null , readTimeout , true , bufferSize , null , null );
353+ final BlobContainer blobContainer = blobContainerBuilder ().maxRetries (null )
354+ .readTimeout (readTimeout )
355+ .disableChunkedEncoding (true )
356+ .bufferSize (bufferSize )
357+ .build ();
351358
352359 final int parts = randomIntBetween (1 , 5 );
353360 final long lastPartSize = randomLongBetween (10 , 512 );
@@ -443,7 +450,11 @@ public void testWriteLargeBlobStreaming() throws Exception {
443450 final boolean useTimeout = rarely ();
444451 final TimeValue readTimeout = useTimeout ? TimeValue .timeValueMillis (randomIntBetween (100 , 500 )) : null ;
445452 final ByteSizeValue bufferSize = ByteSizeValue .of (5 , ByteSizeUnit .MB );
446- final BlobContainer blobContainer = createBlobContainer (null , readTimeout , true , bufferSize , null , null );
453+ final BlobContainer blobContainer = blobContainerBuilder ().maxRetries (null )
454+ .readTimeout (readTimeout )
455+ .disableChunkedEncoding (true )
456+ .bufferSize (bufferSize )
457+ .build ();
447458
448459 final int parts = randomIntBetween (1 , 5 );
449460 final long lastPartSize = randomLongBetween (10 , 512 );
@@ -552,7 +563,10 @@ public void testReadRetriesAfterMeaningfulProgress() throws Exception {
552563 0 ,
553564 randomFrom (1000 , Math .toIntExact (S3Repository .BUFFER_SIZE_SETTING .get (Settings .EMPTY ).getBytes ()))
554565 );
555- final BlobContainer blobContainer = createBlobContainer (maxRetries , null , true , ByteSizeValue .ofBytes (bufferSizeBytes ), null , null );
566+ final BlobContainer blobContainer = blobContainerBuilder ().maxRetries (maxRetries )
567+ .disableChunkedEncoding (true )
568+ .bufferSize (ByteSizeValue .ofBytes (bufferSizeBytes ))
569+ .build ();
556570 final int meaningfulProgressBytes = Math .max (1 , bufferSizeBytes / 100 );
557571
558572 final byte [] bytes = randomBlobContent ();
@@ -625,7 +639,10 @@ public void testReadDoesNotRetryForRepositoryAnalysis() {
625639 0 ,
626640 randomFrom (1000 , Math .toIntExact (S3Repository .BUFFER_SIZE_SETTING .get (Settings .EMPTY ).getBytes ()))
627641 );
628- final BlobContainer blobContainer = createBlobContainer (maxRetries , null , true , ByteSizeValue .ofBytes (bufferSizeBytes ), null , null );
642+ final BlobContainer blobContainer = blobContainerBuilder ().maxRetries (maxRetries )
643+ .disableChunkedEncoding (true )
644+ .bufferSize (ByteSizeValue .ofBytes (bufferSizeBytes ))
645+ .build ();
629646
630647 final byte [] bytes = randomBlobContent ();
631648
@@ -663,7 +680,10 @@ public void testReadWithIndicesPurposeRetriesForever() throws IOException {
663680 0 ,
664681 randomFrom (1000 , Math .toIntExact (S3Repository .BUFFER_SIZE_SETTING .get (Settings .EMPTY ).getBytes ()))
665682 );
666- final BlobContainer blobContainer = createBlobContainer (maxRetries , null , true , ByteSizeValue .ofBytes (bufferSizeBytes ), null , null );
683+ final BlobContainer blobContainer = blobContainerBuilder ().maxRetries (maxRetries )
684+ .disableChunkedEncoding (true )
685+ .bufferSize (ByteSizeValue .ofBytes (bufferSizeBytes ))
686+ .build ();
667687 final int meaningfulProgressBytes = Math .max (1 , bufferSizeBytes / 100 );
668688
669689 final byte [] bytes = randomBlobContent (512 );
@@ -756,7 +776,7 @@ public void handle(HttpExchange exchange) throws IOException {
756776
757777 public void testDoesNotRetryOnNotFound () {
758778 final int maxRetries = between (3 , 5 );
759- final BlobContainer blobContainer = createBlobContainer ( maxRetries , null , true , null , null , null );
779+ final BlobContainer blobContainer = blobContainerBuilder (). maxRetries ( maxRetries ). disableChunkedEncoding ( true ). build ( );
760780
761781 final AtomicInteger numberOfReads = new AtomicInteger (0 );
762782 @ SuppressForbidden (reason = "use a http server" )
@@ -787,8 +807,11 @@ public void handle(HttpExchange exchange) throws IOException {
787807 }
788808
789809 public void testSnapshotDeletesRetryOnThrottlingError () throws IOException {
790- // disable AWS-client retries
791- final BlobContainer blobContainer = createBlobContainer (0 , null , true , null , null , null );
810+ final BlobContainer blobContainer = blobContainerBuilder ()
811+ // disable AWS-client retries
812+ .maxRetries (0 )
813+ .disableChunkedEncoding (true )
814+ .build ();
792815
793816 int numBlobsToDelete = randomIntBetween (500 , 3000 );
794817 List <String > blobsToDelete = new ArrayList <>();
@@ -807,8 +830,11 @@ public void testSnapshotDeletesRetryOnThrottlingError() throws IOException {
807830 }
808831
809832 public void testSnapshotDeletesAbortRetriesWhenThreadIsInterrupted () {
810- // disable AWS-client retries
811- final BlobContainer blobContainer = createBlobContainer (0 , null , true , null , null , null );
833+ final BlobContainer blobContainer = blobContainerBuilder ()
834+ // disable AWS-client retries
835+ .maxRetries (0 )
836+ .disableChunkedEncoding (true )
837+ .build ();
812838
813839 int numBlobsToDelete = randomIntBetween (500 , 3000 );
814840 List <String > blobsToDelete = new ArrayList <>();
@@ -844,8 +870,11 @@ public void testSnapshotDeletesAbortRetriesWhenThreadIsInterrupted() {
844870 }
845871
846872 public void testNonSnapshotDeletesAreNotRetried () {
847- // disable AWS-client retries
848- final BlobContainer blobContainer = createBlobContainer (0 , null , true , null , null , null );
873+ final BlobContainer blobContainer = blobContainerBuilder ()
874+ // disable AWS-client retries
875+ .maxRetries (0 )
876+ .disableChunkedEncoding (true )
877+ .build ();
849878
850879 int numBlobsToDelete = randomIntBetween (500 , 3000 );
851880 List <String > blobsToDelete = new ArrayList <>();
@@ -873,8 +902,11 @@ public void testNonSnapshotDeletesAreNotRetried() {
873902 }
874903
875904 public void testNonThrottlingErrorsAreNotRetried () {
876- // disable AWS-client retries
877- final BlobContainer blobContainer = createBlobContainer (0 , null , true , null , null , null );
905+ final BlobContainer blobContainer = blobContainerBuilder ()
906+ // disable AWS-client retries
907+ .maxRetries (0 )
908+ .disableChunkedEncoding (true )
909+ .build ();
878910
879911 int numBlobsToDelete = randomIntBetween (500 , 3000 );
880912 List <String > blobsToDelete = new ArrayList <>();
@@ -953,7 +985,7 @@ private Set<OperationPurpose> operationPurposesThatRetryOnDelete() {
953985
954986 public void testGetRegisterRetries () {
955987 final var maxRetries = between (0 , 3 );
956- final BlobContainer blobContainer = createBlobContainer ( maxRetries , null , null , null , null , null );
988+ final BlobContainer blobContainer = blobContainerBuilder (). maxRetries ( maxRetries ). build ( );
957989
958990 interface FailingHandlerFactory {
959991 void addHandler (String blobName , Integer ... responseCodes );
@@ -1023,7 +1055,11 @@ interface FailingHandlerFactory {
10231055 public void testSuppressedDeletionErrorsAreCapped () {
10241056 final TimeValue readTimeout = TimeValue .timeValueMillis (randomIntBetween (100 , 500 ));
10251057 int maxBulkDeleteSize = randomIntBetween (1 , 10 );
1026- final BlobContainer blobContainer = createBlobContainer (1 , readTimeout , true , null , maxBulkDeleteSize , null );
1058+ final BlobContainer blobContainer = blobContainerBuilder ().maxRetries (1 )
1059+ .readTimeout (readTimeout )
1060+ .disableChunkedEncoding (true )
1061+ .maxBulkDeletes (maxBulkDeleteSize )
1062+ .build ();
10271063 httpServer .createContext ("/" , exchange -> {
10281064 if (isMultiDeleteRequest (exchange )) {
10291065 exchange .sendResponseHeaders (
@@ -1055,7 +1091,11 @@ public void testSuppressedDeletionErrorsAreCapped() {
10551091 public void testTrimmedLogAndCappedSuppressedErrorOnMultiObjectDeletionException () {
10561092 final TimeValue readTimeout = TimeValue .timeValueMillis (randomIntBetween (100 , 500 ));
10571093 int maxBulkDeleteSize = randomIntBetween (10 , 30 );
1058- final BlobContainer blobContainer = createBlobContainer (1 , readTimeout , true , null , maxBulkDeleteSize , null );
1094+ final BlobContainer blobContainer = blobContainerBuilder ().maxRetries (1 )
1095+ .readTimeout (readTimeout )
1096+ .disableChunkedEncoding (true )
1097+ .maxBulkDeletes (maxBulkDeleteSize )
1098+ .build ();
10591099
10601100 final Pattern pattern = Pattern .compile ("<Key>(.+?)</Key>" );
10611101 httpServer .createContext ("/" , exchange -> {
0 commit comments