chia7712 commented on code in PR #23489:
URL: https://github.com/apache/kafka/pull/23489#discussion_r4645362360


##########
core/src/test/scala/unit/kafka/network/SocketServerTest.scala:
##########
@@ -1125,6 +1125,28 @@ class SocketServerTest {
     
overrideServer.testableSelector.waitForOperations(SelectorOperation.CloseSelector,
 1)
   }
 
+  @Test
+  def testChannelBuilderRemovedOnProcessorClose(): Unit = {

Review Comment:
   Maybe we could use integration test instead?
   ```java
       @ClusterTest(types = {Type.KRAFT},
               brokerSecurityProtocol = SecurityProtocol.SASL_PLAINTEXT,
               controllerSecurityProtocol = SecurityProtocol.SASL_PLAINTEXT,
               serverProperties = @ClusterConfigProperty(key = 
"num.network.threads", value = "4"))
       public void 
testChannelBuildersRemovedOnNetworkThreadShrink(ClusterInstance cluster) throws 
Exception {
           var broker = cluster.brokers().get(0);
           Supplier<Long> count = () -> 
broker.config().dynamicConfig().reconfigurables().stream()
                   .filter(r -> r instanceof ChannelBuilder).count();
           long before = count.get();
   
           try (Admin admin = cluster.admin()) {
               admin.incrementalAlterConfigs(Map.of(
                       new ConfigResource(ConfigResource.Type.BROKER, "0"),
                       List.of(new AlterConfigOp(new 
ConfigEntry("num.network.threads", "2"), AlterConfigOp.OpType.SET))
               )).all().get();
           }
           TestUtils.waitForCondition(() -> count.get() == before - 2, "Channel 
builders not removed");
       }
   ```



-- 
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