You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "unknowntpo (via GitHub)" <gi...@apache.org> on 2026/10/23 02:27:44 UTC

[PR] MINOR: Close leaked resources in tests [kafka]

unknowntpo opened a new pull request, #23929:
URL: https://github.com/apache/kafka/pull/23929

   Follow-up to #23604. Several tests create a client, metrics, or log manager that the cleanup method never closes, either because a local variable shadows the field closed in `@AfterEach`, or because the field set up in `@BeforeEach` is reassigned without closing the old instance. This fixes the same pattern in `KafkaConsumerTest`, `MetricsTest`, `LogManagerTest`, and `WorkerTaskTest`.
   
   
   Generated-by: Claude Opus 5.5


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Close leaked resources in tests [kafka]

Posted by "unknowntpo (via GitHub)" <gi...@apache.org>.
unknowntpo commented on code in PR #23929:
URL: https://github.com/apache/kafka/pull/23929#discussion_r4365180538


##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerTaskTest.java:
##########
@@ -67,7 +67,7 @@ public class WorkerTaskTest {
     @Mock private TaskStatus.Listener statusListener;
     @Mock private ClassLoader loader;
     @Mock private StatusBackingStore statusBackingStore;
-    private ConnectMetrics metrics;
+    private MockConnectMetrics metrics;

Review Comment:
   ok, fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Close leaked resources in tests [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 merged PR #23929:
URL: https://github.com/apache/kafka/pull/23929


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Close leaked resources in tests [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #23929:
URL: https://github.com/apache/kafka/pull/23929#discussion_r4365031202


##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerTaskTest.java:
##########
@@ -67,7 +67,7 @@ public class WorkerTaskTest {
     @Mock private TaskStatus.Listener statusListener;
     @Mock private ClassLoader loader;
     @Mock private StatusBackingStore statusBackingStore;
-    private ConnectMetrics metrics;
+    private MockConnectMetrics metrics;

Review Comment:
   Could you initialize it directly and then remove setup and the null check in tearDown?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org