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

yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new 984c535c987 branch-4.1: [fix](feut) fix flakey MetaServiceProxyTest 
#66219 (#66852)
984c535c987 is described below

commit 984c535c98710a115b795be278710a1d987c67a5
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Aug 18 11:12:41 2026 +0800

    branch-4.1: [fix](feut) fix flakey MetaServiceProxyTest #66219 (#66852)
    
    Cherry-picked from #66219
    
    Co-authored-by: meiyi <[email protected]>
---
 .../apache/doris/cloud/rpc/MetaServiceProxyTest.java   | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/cloud/rpc/MetaServiceProxyTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/cloud/rpc/MetaServiceProxyTest.java
index a9f25586bee..e5084575a4b 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/cloud/rpc/MetaServiceProxyTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/cloud/rpc/MetaServiceProxyTest.java
@@ -22,6 +22,7 @@ import org.apache.doris.common.Config;
 import org.apache.doris.common.jmockit.Deencapsulation;
 import org.apache.doris.rpc.RpcException;
 
+import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.SettableFuture;
 import com.google.protobuf.DescriptorProtos;
 import com.google.protobuf.Descriptors;
@@ -474,11 +475,18 @@ public class MetaServiceProxyTest {
 
     @Test
     public void testGetVisibleVersionAsyncRateLimitedBeforeRpc() throws 
RpcException {
-        enableRateLimit(1, "", 1, 0);
+        // Consume limitForPeriod = qpsPerCore * CPU_CORES * burstSeconds in 
one weighted request.
+        // A long burst window also prevents a refresh before the assertion if 
the scheduler stalls.
+        int qpsPerCore = 1;
+        int rateLimitBurstSeconds = 60;
+        int limitForPeriod = qpsPerCore * CPU_CORES * rateLimitBurstSeconds;
+        enableRateLimit(qpsPerCore, "", rateLimitBurstSeconds, 0);
         MetaServiceProxy proxy = new MetaServiceProxy();
         MetaServiceClient client = mockNormalClient();
         putClient(proxy, client);
-        consumeRateLimitPermits(proxy, "getPartitionVersion");
+        Mockito.when(client.getVisibleVersionAsync(Mockito.any()))
+                .thenReturn(Futures.immediateFuture(okGetVersionResponse()));
+        
proxy.getVisibleVersionAsync(buildBatchPartitionVersionRequest(limitForPeriod));
 
         try {
             
proxy.getVisibleVersionAsync(Cloud.GetVersionRequest.newBuilder().build());
@@ -487,7 +495,7 @@ public class MetaServiceProxyTest {
             Assert.assertTrue(e.getMessage().contains("meta service rpc rate 
limited"));
         }
 
-        Mockito.verify(client, 
Mockito.never()).getVisibleVersionAsync(Mockito.any());
+        Mockito.verify(client, 
Mockito.times(1)).getVisibleVersionAsync(Mockito.any());
         Mockito.verify(client, Mockito.never()).shutdown(Mockito.anyBoolean());
     }
 
@@ -497,8 +505,8 @@ public class MetaServiceProxyTest {
         MetaServiceProxy proxy = new MetaServiceProxy();
         MetaServiceClient client = mockNormalClient();
         putClient(proxy, client);
-        SettableFuture<Cloud.GetVersionResponse> future = 
SettableFuture.create();
-        
Mockito.when(client.getVisibleVersionAsync(Mockito.any())).thenReturn(future);
+        Mockito.when(client.getVisibleVersionAsync(Mockito.any()))
+                .thenReturn(Futures.immediateFuture(okGetVersionResponse()));
 
         proxy.getVisibleVersionAsync(buildBatchTableVersionRequest(CPU_CORES));
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to