Skip to content

Commit a3dcaab

Browse files
committed
add logging to CloseHandler tests
1 parent 4800935 commit a3dcaab

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/ConnectionCloseHeaderHandlingTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
import org.junit.jupiter.params.ParameterizedTest;
4141
import org.junit.jupiter.params.provider.Arguments;
4242
import org.junit.jupiter.params.provider.MethodSource;
43+
import org.slf4j.Logger;
44+
import org.slf4j.LoggerFactory;
4345

4446
import java.nio.channels.ClosedChannelException;
4547
import java.util.ArrayList;
@@ -88,6 +90,7 @@
8890
import static org.junit.jupiter.api.Assumptions.assumeTrue;
8991

9092
final class ConnectionCloseHeaderHandlingTest {
93+
private static final Logger LOGGER = LoggerFactory.getLogger(ConnectionCloseHeaderHandlingTest.class);
9194
private static final Collection<Boolean> TRUE_FALSE = asList(true, false);
9295
private static final String SERVER_SHOULD_CLOSE = "serverShouldClose";
9396

@@ -175,7 +178,10 @@ public Completable accept(final ConnectionContext context) {
175178
assert chunk != null;
176179
requestPayloadSize.addAndGet(chunk.readableBytes());
177180
}
178-
}).beforeOnError(cause -> PayloadWriterUtils.safeClose(writer, cause))
181+
}).beforeOnError(cause -> {
182+
LOGGER.error("failure while writing response", cause);
183+
PayloadWriterUtils.safeClose(writer, cause);
184+
})
179185
.afterFinally(requestPayloadReceived::countDown)
180186
.toFuture();
181187
if (awaitRequestPayload) {

servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/GracefulConnectionClosureHandlingTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
import org.junit.jupiter.params.ParameterizedTest;
5151
import org.junit.jupiter.params.provider.Arguments;
5252
import org.junit.jupiter.params.provider.MethodSource;
53+
import org.slf4j.Logger;
54+
import org.slf4j.LoggerFactory;
5355

5456
import java.io.IOException;
5557
import java.net.SocketAddress;
@@ -100,7 +102,7 @@
100102
import static org.junit.jupiter.api.Assertions.assertThrows;
101103

102104
class GracefulConnectionClosureHandlingTest {
103-
105+
private static final Logger LOGGER = LoggerFactory.getLogger(GracefulConnectionClosureHandlingTest.class);
104106
private static final Collection<Boolean> TRUE_FALSE = asList(true, false);
105107

106108
@RegisterExtension
@@ -199,6 +201,7 @@ public Completable accept(final ConnectionContext context) {
199201
}
200202
serverReceivedRequestPayload.add(receivedSize);
201203
}).beforeOnError(cause -> {
204+
LOGGER.error("failure while writing response", cause);
202205
serverReceivedRequestPayload.add(-1);
203206
PayloadWriterUtils.safeClose(writer, cause);
204207
}).toFuture();

0 commit comments

Comments
 (0)