gharris1727 commented on code in PR #15101:
URL: https://github.com/apache/kafka/pull/15101#discussion_r1440917179


##########
core/src/test/java/kafka/test/junit/LeakTestingExtension.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package kafka.test.junit;
+
+import kafka.utils.TestUtils;
+import org.junit.jupiter.api.extension.AfterEachCallback;
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
+import org.junit.jupiter.api.extension.ExtensionContext.Store;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+import scala.Tuple2;
+
+import static org.apache.kafka.test.TestUtils.DEFAULT_MAX_WAIT_MS;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class LeakTestingExtension implements BeforeEachCallback, 
AfterEachCallback {
+    private static final Set<String> EXPECTED_THREAD_NAMES = new HashSet<>(

Review Comment:
   Oh I didn't notice that this is a set of threads that are allowed to leak, 
where the original TestUtils.verifyNoUnexpectedThreads was a set of threads 
which weren't allowed to leak. I assumed the mechanism was copy-pasted.
   
    I don't know if this set needs to exist, especially now that the assertion 
is stateful. Perhaps we can empty this set completely to see what the effect 
is, and then add in what is necessary. I did see some flakiness with an early 
prototype of #14783 which sometimes detected the gradle runner opening sockets. 
Perhaps there are similar things which create background threads.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to