showuon commented on a change in pull request #11800:
URL: https://github.com/apache/kafka/pull/11800#discussion_r814419358



##########
File path: 
clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java
##########
@@ -2866,6 +2866,25 @@ public void testUnknownConfigs() {
         }
     }
 
+    @Test
+    public void testUnusedAndUnknownConfigs() {
+        Map<String, Object> props = new HashMap<>();
+        props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9999");
+        props.put(SslConfigs.SSL_PROTOCOL_CONFIG, "TLS");
+        props.put(unknownTestConfig, "my_value");
+        ConsumerConfig config = new 
ConsumerConfig(ConsumerConfig.appendDeserializerToConfig(props, new 
StringDeserializer(), new StringDeserializer()));
+
+        assertTrue(config.unused().contains(SslConfigs.SSL_PROTOCOL_CONFIG));
+        assertTrue(config.unknown().contains(unknownTestConfig));
+        assertEquals(1, config.unknown().size());

Review comment:
       We should also assert the unUsed().size() == 1.

##########
File path: 
clients/src/test/java/org/apache/kafka/common/config/AbstractConfigTest.java
##########
@@ -102,21 +104,21 @@ public void testValuesWithPrefixOverride() {
         Map<String, Object> valuesWithPrefixOverride = 
config.valuesWithPrefixOverride(prefix);
 
         // prefix overrides global
-        assertTrue(config.unused().contains("prefix.sasl.mechanism"));
+        assertTrue(config.unknown().contains("prefix.sasl.mechanism"));
         assertTrue(config.unused().contains("sasl.mechanism"));
         assertEquals("GSSAPI", valuesWithPrefixOverride.get("sasl.mechanism"));
         assertFalse(config.unused().contains("sasl.mechanism"));
         assertFalse(config.unused().contains("prefix.sasl.mechanism"));

Review comment:
       here, we should change to assert `unknown`, right? 
   Same as below.




-- 
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-unsubscr...@kafka.apache.org

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


Reply via email to