This is an automated email from the ASF dual-hosted git repository.

chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 8eb84399f68 MINOR: rackId is Optional#empty if input string is empty 
(#19906)
8eb84399f68 is described below

commit 8eb84399f68ce4f527dee2268fa58bf7762a04a0
Author: PoAn Yang <[email protected]>
AuthorDate: Thu Jun 5 14:41:40 2025 +0800

    MINOR: rackId is Optional#empty if input string is empty (#19906)
    
    Add test case `testRackIdIsEmptyIfValueIsEmptyString`.
    
    Reviewers: Chia-Ping Tsai <[email protected]>
---
 .../org/apache/kafka/clients/GroupRebalanceConfigTest.java | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git 
a/clients/src/test/java/org/apache/kafka/clients/GroupRebalanceConfigTest.java 
b/clients/src/test/java/org/apache/kafka/clients/GroupRebalanceConfigTest.java
index bd9bc225205..7f02204d4c4 100644
--- 
a/clients/src/test/java/org/apache/kafka/clients/GroupRebalanceConfigTest.java
+++ 
b/clients/src/test/java/org/apache/kafka/clients/GroupRebalanceConfigTest.java
@@ -40,6 +40,20 @@ public class GroupRebalanceConfigTest {
         );
         assertTrue(groupRebalanceConfig.rackId.isEmpty());
     }
+    
+    @ParameterizedTest
+    @EnumSource(value = GroupRebalanceConfig.ProtocolType.class, names = 
{"CONSUMER", "SHARE"})
+    void 
testRackIdIsEmptyIfValueIsEmptyString(GroupRebalanceConfig.ProtocolType 
protocolType) {
+        GroupRebalanceConfig groupRebalanceConfig = new GroupRebalanceConfig(
+            new ConsumerConfig(Map.of(
+                ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, 
"org.apache.kafka.common.serialization.StringDeserializer",
+                ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, 
"org.apache.kafka.common.serialization.StringDeserializer",
+                ConsumerConfig.CLIENT_RACK_CONFIG, ""
+            )),
+            protocolType
+        );
+        assertTrue(groupRebalanceConfig.rackId.isEmpty());
+    }
 
     @ParameterizedTest
     @EnumSource(value = GroupRebalanceConfig.ProtocolType.class, names = 
{"CONSUMER", "SHARE"})

Reply via email to