Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky test #2892

Merged
merged 1 commit into from
Sep 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.publisher.SignalType;
import reactor.core.publisher.Sinks;
import reactor.netty.BaseHttpTest;
import reactor.netty.ByteBufFlux;
import reactor.netty.ChannelBindException;
Expand Down Expand Up @@ -2220,7 +2221,7 @@ void testSniSupportHandshakeTimeout() {
Http11SslContextSpec.forClient()
.configure(builder -> builder.trustManager(InsecureTrustManagerFactory.INSTANCE));

AtomicReference<Throwable> error = new AtomicReference<>();
Sinks.One<Throwable> error = Sinks.one();
disposableServer =
createServer()
.childOption(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(64))
Expand All @@ -2234,7 +2235,7 @@ void testSniSupportHandshakeTimeout() {
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
if (evt instanceof SniCompletionEvent) {
error.set(((SniCompletionEvent) evt).cause());
error.tryEmitValue(((SniCompletionEvent) evt).cause());
}
ctx.fireUserEventTriggered(evt);
}
Expand All @@ -2253,7 +2254,10 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
.expectError()
.verify(Duration.ofSeconds(5));

assertThat(error.get()).isNotNull().isInstanceOf(SslHandshakeTimeoutException.class);
StepVerifier.create(error.asMono())
.expectNextMatches(t -> t instanceof SslHandshakeTimeoutException)
.expectComplete()
.verify(Duration.ofSeconds(10));
}

@Test
Expand Down