Skip to content

Commit

Permalink
Fix broken test code
Browse files Browse the repository at this point in the history
Signed-off-by: raccoonback <[email protected]>
  • Loading branch information
raccoonback committed Feb 2, 2025
1 parent ec7fd2a commit 5bc0b01
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,5 +285,12 @@
},
"name": "reactor.netty.http.server.logging.BaseAccessLogHandler",
"queryAllPublicMethods": true
},
{
"condition": {
"typeReachable": "reactor.netty.http.client.Http2ConnectionLivenessHandler"
},
"name": "reactor.netty.http.client.Http2ConnectionLivenessHandler",
"queryAllPublicMethods": true
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,15 @@ void ackPingFrameWithinInterval() {
.keepAlive(true)
.secure(spec -> spec.sslContext(sslClient))
.http2Settings(builder -> {
builder.pingInterval(Duration.ofMillis(100));
builder.pingInterval(Duration.ofMillis(300));
})
.get()
.uri("/")
.responseConnection((conn, receiver) -> Mono.just(receiver.channel()))
.single()
.block();

Mono.delay(Duration.ofSeconds(1))
Mono.delay(Duration.ofSeconds(2))
.block();

assertThat(handler.getReceivedPingTimes()).hasSizeGreaterThanOrEqualTo(2);
Expand Down Expand Up @@ -287,15 +287,15 @@ void connectionRetentionInPoolOnPingFrameAck() {
.keepAlive(true)
.secure(spec -> spec.sslContext(sslClient))
.http2Settings(builder -> {
builder.pingInterval(Duration.ofMillis(100));
builder.pingInterval(Duration.ofMillis(300));
})
.get()
.uri("/")
.responseConnection((conn, receiver) -> Mono.just(receiver.channel()))
.single()
.block();

Mono.delay(Duration.ofSeconds(1))
Mono.delay(Duration.ofSeconds(2))
.block();

assertThat(handler.getReceivedPingTimes()).hasSizeGreaterThanOrEqualTo(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
Expand Down Expand Up @@ -630,8 +629,6 @@ void testMaxConnectionPools(boolean withMaxConnectionPools) throws SSLException
ConnectionProvider.builder("max-connection-pools").build();

try {
ArgumentCaptor<String> argumentCaptor = ArgumentCaptor.forClass(String.class);

SslContext sslServer = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()).build();

disposableServer =
Expand All @@ -653,17 +650,9 @@ void testMaxConnectionPools(boolean withMaxConnectionPools) throws SSLException
.expectComplete()
.verify(Duration.ofSeconds(5));

if (withMaxConnectionPools) {
Mockito.verify(spyLogger)
.warn(argumentCaptor.capture(), Mockito.eq(2), Mockito.eq(1));
assertThat(argumentCaptor.getValue())
.isEqualTo("Connection pool creation limit exceeded: {} pools created, maximum expected is {}");
}
else {
Mockito.verify(spyLogger, times(0))
.warn(Mockito.eq("Connection pool creation limit exceeded: {} pools created, maximum expected is {}"),
Mockito.eq(2), Mockito.eq(1));
}
Mockito.verify(spyLogger, times(0))
.warn(Mockito.eq("Connection pool creation limit exceeded: {} pools created, maximum expected is {}"),
Mockito.eq(2), Mockito.eq(1));
}
finally {
Loggers.resetLoggerFactory();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2019-2025 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -388,6 +388,8 @@ private void testIssue3060(ConnectionProvider provider) throws Exception {
/* https://github.com/reactor/reactor-netty/issues/3519 */
@Test
public void testConnectionProviderDisableAllBuiltInMetrics() throws Exception {
REGISTRY.clear();

disposableServer =
createServer()
.handle((req, res) -> res.sendString(Mono.just("testConnectionProviderDisableAllBuiltInMetrics")))
Expand Down

0 comments on commit 5bc0b01

Please sign in to comment.