Skip to content

Commit b0ae9f0

Browse files
authored
[Test] Flush response body for progress (#115177) (#116556)
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 19e87c2 commit b0ae9f0

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
@@ -572,16 +572,16 @@ public void handle(HttpExchange exchange) throws IOException {
572572
),
573573
-1
574574
);
575+
exchange.getResponseBody().flush();
575576
} else if (randomBoolean()) {
576577
final var bytesSent = sendIncompleteContent(exchange, bytes);
577578
if (bytesSent < meaningfulProgressBytes) {
578579
failuresWithoutProgress += 1;
579-
} else {
580-
exchange.getResponseBody().flush();
581580
}
582581
} else {
583582
failuresWithoutProgress += 1;
584583
}
584+
exchange.getResponseBody().flush();
585585
exchange.close();
586586
}
587587
}
@@ -626,6 +626,7 @@ public void handle(HttpExchange exchange) throws IOException {
626626
failureCount += 1;
627627
Streams.readFully(exchange.getRequestBody());
628628
sendIncompleteContent(exchange, bytes);
629+
exchange.getResponseBody().flush();
629630
exchange.close();
630631
}
631632
}

0 commit comments

Comments
 (0)