Skip to content

Commit

Permalink
Fix usage of randomIntBetween() in testWriteBlobWithRetries (#46380)
Browse files Browse the repository at this point in the history
This commit fixes the usage of randomIntBetween() in the test 
testWriteBlobWithRetries, when the test generates a random array  
of a single byte.
  • Loading branch information
tlrx committed Sep 6, 2019
1 parent ab3b5e0 commit a027f7c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public void testWriteBlobWithRetries() throws Exception {

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,
Expand Down

0 comments on commit a027f7c

Please sign in to comment.