Fix usage of randomIntBetween() in testWriteBlobWithRetries (#46380)

This commit fixes the usage of randomIntBetween() in the test 
testWriteBlobWithRetries, when the test generates a random array  
of a single byte.
This commit is contained in:
Tanguy Leroux 2019-09-06 09:10:06 +02:00
parent 42ada88c5d
commit 2290865559

View File

@ -206,7 +206,7 @@ public class S3BlobContainerRetriesTests extends ESTestCase {
if (randomBoolean()) {
if (randomBoolean()) {
Streams.readFully(exchange.getRequestBody(), new byte[randomIntBetween(1, bytes.length - 1)]);
Streams.readFully(exchange.getRequestBody(), new byte[randomIntBetween(1, Math.max(1, bytes.length - 1))]);
} else {
Streams.readFully(exchange.getRequestBody());
exchange.sendResponseHeaders(randomFrom(HttpStatus.SC_INTERNAL_SERVER_ERROR, HttpStatus.SC_BAD_GATEWAY,