Skip to content

Commit 97c5956

Browse files
ywangdsalvatore-campagna
authored andcommitted
[Test] Flush response body for progress (elastic#115177)
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: elastic#115145 Resolves: elastic#115164
1 parent 797007d commit 97c5956

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
@@ -586,16 +586,16 @@ public void handle(HttpExchange exchange) throws IOException {
586586
),
587587
-1
588588
);
589+
exchange.getResponseBody().flush();
589590
} else if (randomBoolean()) {
590591
final var bytesSent = sendIncompleteContent(exchange, bytes);
591592
if (bytesSent < meaningfulProgressBytes) {
592593
failuresWithoutProgress += 1;
593-
} else {
594-
exchange.getResponseBody().flush();
595594
}
596595
} else {
597596
failuresWithoutProgress += 1;
598597
}
598+
exchange.getResponseBody().flush();
599599
exchange.close();
600600
}
601601
}
@@ -640,6 +640,7 @@ public void handle(HttpExchange exchange) throws IOException {
640640
failureCount += 1;
641641
Streams.readFully(exchange.getRequestBody());
642642
sendIncompleteContent(exchange, bytes);
643+
exchange.getResponseBody().flush();
643644
exchange.close();
644645
}
645646
}

0 commit comments

Comments
 (0)