Skip to content

Commit

Permalink
use NettyLeakDetectorExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
sullis committed May 14, 2024
1 parent b7d0a66 commit a0a3017
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 5 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ ext {
awaitilityVersion = '4.2.1'
hoverflyJavaVersion = '0.18.1'
tomcatVersion = '9.0.89'
nettyLeakDetectorJunitExtensionVersion = "0.0.5"
boringSslVersion = '2.0.65.Final'
junitVersion = '5.10.2'
junitPlatformLauncherVersion = '1.10.2'
Expand Down
1 change: 1 addition & 0 deletions reactor-netty-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ dependencies {
testImplementation "org.awaitility:awaitility:$awaitilityVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
testImplementation "io.github.nettyplus:netty-leak-detector-junit-extension:$nettyLeakDetectorJunitExtensionVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "ch.qos.logback:logback-classic:$logbackVersion"
testImplementation "io.projectreactor.tools:blockhound-junit-platform:$blockHoundVersion"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2022 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2017-2024 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 All @@ -15,10 +15,12 @@
*/
package reactor.netty;

import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;
import io.netty.buffer.ByteBuf;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
Expand All @@ -38,6 +40,7 @@

import static org.assertj.core.api.Assertions.assertThat;

@ExtendWith(NettyLeakDetectorExtension.class)
class ByteBufFluxTest {

private static File temporaryDirectory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2020-2024 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 All @@ -15,7 +15,9 @@
*/
package reactor.netty;

import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
Expand All @@ -24,6 +26,7 @@
import java.nio.charset.Charset;
import java.time.Duration;

@ExtendWith(NettyLeakDetectorExtension.class)
class ByteBufMonoTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2023 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2017-2024 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 All @@ -20,6 +20,7 @@
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BiConsumer;

import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerAdapter;
Expand All @@ -30,6 +31,7 @@
import io.netty.handler.codec.http.websocketx.Utf8FrameValidator;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import reactor.core.Disposable;
import reactor.core.publisher.Mono;

Expand All @@ -42,6 +44,7 @@
* @author Simon Baslé
* @author Violeta Georgieva
*/
@ExtendWith(NettyLeakDetectorExtension.class)
class ConnectionTest {

static final BiConsumer<? super ChannelHandlerContext, Object> ADD_EXTRACTOR = ChannelHandlerContext::fireChannelRead;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.function.Predicate;
import javax.net.ssl.SSLException;

import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelFuture;
Expand All @@ -52,11 +53,13 @@
import io.netty.util.ReferenceCountUtil;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Mono;

import static org.assertj.core.api.Assertions.assertThat;

@ExtendWith(NettyLeakDetectorExtension.class)
class NettyOutboundTest {

static SelfSignedCertificate ssc;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2023 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2021-2024 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 All @@ -15,6 +15,7 @@
*/
package reactor.netty;

import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;
import io.netty.channel.AbstractChannel;
import io.netty.channel.Channel;
import io.netty.channel.ChannelConfig;
Expand All @@ -23,6 +24,7 @@
import io.netty.channel.EventLoop;
import io.netty.channel.embedded.EmbeddedChannel;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import reactor.util.annotation.Nullable;

import java.net.InetSocketAddress;
Expand All @@ -35,6 +37,7 @@
*
* @author Violeta Georgieva
*/
@ExtendWith(NettyLeakDetectorExtension.class)
class ReactorNettyTest {

/*
Expand Down
1 change: 1 addition & 0 deletions reactor-netty-http/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ dependencies {

testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "io.specto:hoverfly-java-junit5:$hoverflyJavaVersion"
testImplementation "io.github.nettyplus:netty-leak-detector-junit-extension:$nettyLeakDetectorJunitExtensionVersion"
testImplementation "org.apache.tomcat.embed:tomcat-embed-core:$tomcatVersion"
testImplementation "io.projectreactor:reactor-test:$testAddonVersion"
testImplementation "org.assertj:assertj-core:$assertJVersion"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2021-2024 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 All @@ -15,7 +15,9 @@
*/
package reactor.netty;

import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.provider.Arguments;
import reactor.netty.http.HttpProtocol;
import reactor.netty.http.client.HttpClient;
Expand All @@ -34,6 +36,7 @@
* @author Violeta Georgieva
* @since 1.0.3
*/
@ExtendWith(NettyLeakDetectorExtension.class)
public class BaseHttpTest {

protected DisposableServer disposableServer;
Expand Down

0 comments on commit a0a3017

Please sign in to comment.