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

AndrewJSchofield 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 5589d25736b MINOR: Speed up 
ShareConsumerTest.testAcquisitionLockTimeoutOnConsumer (#22537)
5589d25736b is described below

commit 5589d25736b130bc2c2b341aa8f64cba9cc4144e
Author: Russole Chen <[email protected]>
AuthorDate: Tue Jun 16 17:21:40 2026 +0800

    MINOR: Speed up ShareConsumerTest.testAcquisitionLockTimeoutOnConsumer 
(#22537)
    
    ## Summary
    
    Speed up `ShareConsumerTest.testAcquisitionLockTimeoutOnConsumer` by
    overriding the broker-side share record lock duration for this test.
    
    The test previously relied on the class-level
    `group.share.record.lock.duration.ms=15000` and waited `20000ms` for the
    acquisition lock to expire. This PR lowers the test-specific lock
    duration to `5000ms` and reduces the sleep to `8000ms`.
    
    Both `group.share.min.record.lock.duration.ms` and
    `group.share.record.lock.duration.ms` are set because the actual lock
    duration must be greater than or equal to the configured minimum.
    
    Reviewers: Chia-Ping Tsai
     [[email protected]](mailto:[email protected])
    
    ## Testing
    
    Ran the target test repeatedly to check for flakiness:
    
    ```bash
    ./gradlew :clients:clients-integration-tests:test --tests
    
org.apache.kafka.clients.consumer.ShareConsumerTest.testAcquisitionLockTimeoutOnConsumer
    --rerun-tasks
    Result: 10/10 passed.
    ```
    
    Reviewers: Andrew Schofield <[email protected]>
---
 .../org/apache/kafka/clients/consumer/ShareConsumerTest.java     | 9 ++++++---
 1 file changed, 6 insertions(+), 3 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 6f188c6d1ea..a9f45bf73b1 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
@@ -1439,7 +1439,10 @@ public class ShareConsumerTest extends 
ShareConsumerTestBase {
         verifyShareGroupStateTopicRecordsProduced();
     }
 
-    @ClusterTest
+    @ClusterTest(serverProperties = {
+        @ClusterConfigProperty(key = 
"group.share.min.record.lock.duration.ms", value = "5000"),
+        @ClusterConfigProperty(key = "group.share.record.lock.duration.ms", 
value = "5000")
+    })
     public void testAcquisitionLockTimeoutOnConsumer() throws 
InterruptedException {
         alterShareAutoOffsetReset("group1", "earliest");
         try (Producer<byte[], byte[]> producer = createProducer();
@@ -1483,7 +1486,7 @@ public class ShareConsumerTest extends 
ShareConsumerTestBase {
             assertEquals(1, consumerRecords.count());
 
             // Allow the acquisition lock to time out.
-            Thread.sleep(20000);
+            Thread.sleep(8000);
 
             consumerRecords = shareConsumer.poll(Duration.ofMillis(5000));
             consumerRecord = consumerRecords.records(tp).get(0);
@@ -2030,4 +2033,4 @@ public class ShareConsumerTest extends 
ShareConsumerTestBase {
             throw new RuntimeException(e);
         }
     }
-}
\ No newline at end of file
+}

Reply via email to