Skip to content

Commit dcacfdb

Browse files
authored
Merge pull request #168 from rostilos/1.5.5-rc
test: Enhance VCS client error handling tests with improved timeout a…
2 parents 91ae236 + 8b42247 commit dcacfdb

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

java-ecosystem/libs/vcs-client/src/it/java/org/rostilos/codecrow/vcsclient/VcsClientErrorHandlingIT.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ void shouldTimeoutOnSlowResponse() {
4646

4747
String url = mockServer.url("/slow-endpoint").toString();
4848
assertThatThrownBy(() -> {
49-
try (okhttp3.Response ignored = httpClient.newCall(
49+
try (okhttp3.Response response = httpClient.newCall(
5050
new okhttp3.Request.Builder().url(url).build()).execute()) {
51+
response.body().string(); // Force reading body to trigger read timeout
5152
}
5253
}).isInstanceOf(SocketTimeoutException.class);
5354
}
@@ -107,7 +108,7 @@ void shouldHandle502() throws Exception {
107108
void shouldHandleConnectionClose() throws Exception {
108109
mockServer.enqueue(new MockResponse()
109110
.setResponseCode(200)
110-
.setBody("{")
111+
.setBody("x".repeat(1024 * 1024))
111112
.setSocketPolicy(okhttp3.mockwebserver.SocketPolicy.DISCONNECT_DURING_RESPONSE_BODY));
112113

113114
String url = mockServer.url("/repos/owner/repo").toString();
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<failsafe-summary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/failsafe-summary.xsd" result="254" timeout="false">
3+
<completed>0</completed>
4+
<errors>0</errors>
5+
<failures>0</failures>
6+
<skipped>0</skipped>
7+
<failureMessage xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
8+
</failsafe-summary>

0 commit comments

Comments
 (0)