Skip to content

Commit b69d23d

Browse files
authored
[Test] Flush response body for progress (#115177) (#115209)
In JDK23, response headers are no longer always immediately sent. See also https://bugs.openjdk.org/browse/JDK-8331847 This PR adds flush call for the response body to make progress. Resolves: #115145 Resolves: #115164 (cherry picked from commit 8c23fd7)
1 parent cc05e6d commit b69d23d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3BlobContainerRetriesTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,16 +573,16 @@ public void handle(HttpExchange exchange) throws IOException {
573573
),
574574
-1
575575
);
576+
exchange.getResponseBody().flush();
576577
} else if (randomBoolean()) {
577578
final var bytesSent = sendIncompleteContent(exchange, bytes);
578579
if (bytesSent < meaningfulProgressBytes) {
579580
failuresWithoutProgress += 1;
580-
} else {
581-
exchange.getResponseBody().flush();
582581
}
583582
} else {
584583
failuresWithoutProgress += 1;
585584
}
585+
exchange.getResponseBody().flush();
586586
exchange.close();
587587
}
588588
}
@@ -627,6 +627,7 @@ public void handle(HttpExchange exchange) throws IOException {
627627
failureCount += 1;
628628
Streams.readFully(exchange.getRequestBody());
629629
sendIncompleteContent(exchange, bytes);
630+
exchange.getResponseBody().flush();
630631
exchange.close();
631632
}
632633
}

0 commit comments

Comments
 (0)