alanlau28 commented on code in PR #23544:
URL: https://github.com/apache/kafka/pull/23544#discussion_r4106656212


##########
clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java:
##########
@@ -4488,4 +4491,28 @@ public static void resetCounters() {
             CLOSE_COUNT.set(0);
         }
     }
+
+    private Map<String, Object> clientInstanceIdConfigs(GroupProtocol 
groupProtocol) {
+        Map<String, Object> configs = new HashMap<>();
+        configs.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9999");
+        configs.put(ConsumerConfig.GROUP_ID_CONFIG, "group");
+        configs.put(ConsumerConfig.GROUP_PROTOCOL_CONFIG, 
groupProtocol.name().toLowerCase(Locale.ROOT));
+        return configs;
+    }
+
+    @Test
+    public void 
testClassicConsumerPassesTheClientInstanceIdToTheNetworkClient() {
+        Map<String, Object> configs = 
clientInstanceIdConfigs(GroupProtocol.CLASSIC);
+        ClientInstanceIdCapture.assertGenerated(
+            () -> new KafkaConsumer<>(configs, new StringDeserializer(), new 
StringDeserializer()));
+    }
+
+    @Test
+    public void testAsyncConsumerPassesTheClientInstanceIdToTheNetworkClient() 
{
+        Map<String, Object> configs = 
clientInstanceIdConfigs(GroupProtocol.CONSUMER);
+        ClientInstanceIdCapture.assertGenerated(NetworkClientDelegate.class,

Review Comment:
   I added a new class for callers that use `NetworkClientDelegate`, so there 
are now two helper classes that make the tests more clean.



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