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

schofielaj 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 c0beea0ec97 MINOR: Flaky testDynamicPartitionMaxRecordLocks (#21733)
c0beea0ec97 is described below

commit c0beea0ec97ca50117f8f70df11f876847c122f0
Author: Andrew Schofield <[email protected]>
AuthorDate: Thu Mar 12 19:53:39 2026 +0000

    MINOR: Flaky testDynamicPartitionMaxRecordLocks (#21733)
    
    `ShareConsumerTest.textDynamicPartitionMaxRecordLocks` fails
    occasionally due to slow propagate of dynamic group configs. This PR
    introduces some tolerance of propagation delays in the hope of making
    the test reliable.
    
    Reviewers: Lianet Magrans <[email protected]>
---
 .../kafka/clients/consumer/ShareConsumerTest.java  | 37 +++++++++++++---------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git 
a/clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ShareConsumerTest.java
 
b/clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ShareConsumerTest.java
index eba324b1304..d915e70b831 100644
--- 
a/clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ShareConsumerTest.java
+++ 
b/clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ShareConsumerTest.java
@@ -121,7 +121,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;
@@ -4044,13 +4043,17 @@ public class ShareConsumerTest {
         // Verify the config is readable via describe configs.
         try (Admin adminClient = createAdminClient()) {
             ConfigResource configResource = new 
ConfigResource(ConfigResource.Type.GROUP, "group1");
-            Map<ConfigResource, Config> configs = assertDoesNotThrow(() ->
-                
adminClient.describeConfigs(List.of(configResource)).all().get(60, 
TimeUnit.SECONDS));
-            Config config = configs.get(configResource);
-            assertNotNull(config);
-            ConfigEntry entry = 
config.get(GroupConfig.SHARE_PARTITION_MAX_RECORD_LOCKS_CONFIG);
-            assertNotNull(entry);
-            assertEquals("500", entry.value());
+            assertDoesNotThrow(() ->
+                TestUtils.waitForCondition(() -> {
+                    try {
+                        Map<ConfigResource, Config> configs = 
adminClient.describeConfigs(List.of(configResource)).all().get(60, 
TimeUnit.SECONDS);
+                        Config config = configs.get(configResource);
+                        ConfigEntry entry = 
config.get(GroupConfig.SHARE_PARTITION_MAX_RECORD_LOCKS_CONFIG);
+                        return entry != null && entry.value().equals("500");
+                    } catch (Exception e) {
+                        return false;
+                    }
+                }, 10000L, 100L, () -> "New config value did not propagate"), 
"Failed to describe configs");
         }
 
         // Verify the config can be updated dynamically.
@@ -4058,13 +4061,17 @@ public class ShareConsumerTest {
 
         try (Admin adminClient = createAdminClient()) {
             ConfigResource configResource = new 
ConfigResource(ConfigResource.Type.GROUP, "group1");
-            Map<ConfigResource, Config> configs = assertDoesNotThrow(() ->
-                
adminClient.describeConfigs(List.of(configResource)).all().get(60, 
TimeUnit.SECONDS));
-            Config config = configs.get(configResource);
-            assertNotNull(config);
-            ConfigEntry entry = 
config.get(GroupConfig.SHARE_PARTITION_MAX_RECORD_LOCKS_CONFIG);
-            assertNotNull(entry);
-            assertEquals("1000", entry.value());
+            assertDoesNotThrow(() ->
+                TestUtils.waitForCondition(() -> {
+                    try {
+                        Map<ConfigResource, Config> configs = 
adminClient.describeConfigs(List.of(configResource)).all().get(60, 
TimeUnit.SECONDS);
+                        Config config = configs.get(configResource);
+                        ConfigEntry entry = 
config.get(GroupConfig.SHARE_PARTITION_MAX_RECORD_LOCKS_CONFIG);
+                        return entry != null && entry.value().equals("1000");
+                    } catch (Exception e) {
+                        return false;
+                    }
+                }, 10000L, 100L, () -> "New config value did not propagate"), 
"Failed to describe configs");
         }
     }
 

Reply via email to