Skip to content

Commit

Permalink
Run all tests with the NettyLeak detector.
Browse files Browse the repository at this point in the history
Fixes: kroxylicious#202

rh-pre-commit.version: 2.0.1
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
SamBarker committed Jun 20, 2024
1 parent 4cb64e4 commit 1fa3db6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
import org.apache.kafka.common.message.ApiVersionsResponseData;
import org.apache.kafka.common.protocol.ApiKeys;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;

import io.kroxylicious.test.Request;
import io.kroxylicious.test.Response;
Expand All @@ -35,6 +38,7 @@
* a new ApiKey that this version of Kroxylicious is unaware of)
* TODO check if this is still sensible behaviour, potentially a RequestFilter would attempt to decode these and fail.
*/
@ExtendWith(NettyLeakDetectorExtension.class)
public class ApiVersionsIT {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@
import org.apache.kafka.common.TopicCollection;
import org.junit.jupiter.api.extension.ExtendWith;

import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;

import io.kroxylicious.test.tester.KroxyliciousTester;
import io.kroxylicious.testing.kafka.junit5ext.KafkaClusterExtension;

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

@ExtendWith(KafkaClusterExtension.class)
@ExtendWith(NettyLeakDetectorExtension.class)
public abstract class BaseIT {

protected CreateTopicsResult createTopics(Admin admin, NewTopic... topics) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;
import io.micrometer.core.instrument.Metrics;
import io.netty.handler.codec.http.HttpResponseStatus;

Expand All @@ -34,6 +35,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

@ExtendWith(KafkaClusterExtension.class)
@ExtendWith(NettyLeakDetectorExtension.class)
class MetricsIT {

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
import org.apache.kafka.common.protocol.ApiKeys;
import org.apache.kafka.common.protocol.Errors;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;

import io.kroxylicious.proxy.config.FilterDefinition;
import io.kroxylicious.proxy.config.FilterDefinitionBuilder;
Expand Down Expand Up @@ -47,6 +50,7 @@
* <li>A can not filter X or the response to X, the flow was terminated.</li>
* </ol>
*/
@ExtendWith(NettyLeakDetectorExtension.class)
public class OutOfBandRequestIT {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;

import io.kroxylicious.proxy.config.FilterDefinitionBuilder;
import io.kroxylicious.proxy.filter.FixedClientIdFilterFactory;
import io.kroxylicious.test.ApiMessageSampleGenerator;
Expand All @@ -42,6 +45,7 @@
import static org.apache.kafka.common.protocol.ApiKeys.METADATA;
import static org.junit.jupiter.api.Assertions.assertEquals;

@ExtendWith(NettyLeakDetectorExtension.class)
public class ProxyRpcTest {
private static MockServerKroxyliciousTester mockTester;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import io.github.nettyplus.leakdetector.junit.NettyLeakDetectorExtension;

import io.kroxylicious.proxy.config.FilterDefinitionBuilder;
import io.kroxylicious.test.tester.MockServerKroxyliciousTester;

import static io.kroxylicious.test.tester.KroxyliciousConfigUtils.proxy;
import static io.kroxylicious.test.tester.KroxyliciousTesters.mockKafkaKroxyliciousTester;

@ExtendWith(NettyLeakDetectorExtension.class)
public class SingleFilterFactoryInstanceTest {
public static final String INITIALISATION_COUNTER = "configInstanceId";
private MockServerKroxyliciousTester mockTester;
Expand Down

0 comments on commit 1fa3db6

Please sign in to comment.