From 341388479a514f400ae5c5034841608c1ba9cd72 Mon Sep 17 00:00:00 2001 From: Zhen Ye Date: Mon, 22 Dec 2025 16:19:17 +0800 Subject: [PATCH] fix: test flush rate failure because of config modification (#46497) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### **User description** issue: #46097 - the flush rate is modified into 4qps, so the testcase is fail. ___ ### **PR Type** Tests, Bug fix ___ ### **Description** - Replace sequential flush calls with concurrent requests to trigger rate limiting - Add sync.WaitGroup for concurrent goroutine execution - Check for rate limit errors across multiple concurrent flush operations - Remove hardcoded error message expectation for flexibility ___ ### Diagram Walkthrough ```mermaid flowchart LR A["Sequential Flush Calls"] -->|Replace with| B["Concurrent Flush Requests"] B -->|Use| C["sync.WaitGroup"] C -->|Validate| D["Rate Limit Errors"] ```

File Walkthrough

Relevant files
Tests
insert_test.go
Refactor flush rate test to use concurrent requests           

tests/go_client/testcases/insert_test.go
  • Added sync package import for concurrent goroutine synchronization
  • Replaced sequential flush calls with 10 concurrent flush operations
    using goroutines
  • Implemented WaitGroup to synchronize all concurrent flush requests
  • Modified error validation to check for rate limit errors across all
    concurrent attempts instead of expecting specific sequential behavior
  • Relaxed error message matching to only check for "rate limit exceeded"
    substring
+19/-4   
___ ## Summary by CodeRabbit ## Release Notes * **Tests** * Enhanced testing of concurrent flush operations to improve validation of system reliability under concurrent load scenarios. --- **Note:** This release contains internal testing improvements with no direct user-facing feature changes. ✏️ Tip: You can customize this high-level summary in your review settings. Signed-off-by: chyezh --- tests/go_client/testcases/insert_test.go | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/go_client/testcases/insert_test.go b/tests/go_client/testcases/insert_test.go index e1dfdfe2f0..0afb093437 100644 --- a/tests/go_client/testcases/insert_test.go +++ b/tests/go_client/testcases/insert_test.go @@ -3,6 +3,7 @@ package testcases import ( "math" "strconv" + "sync" "testing" "time" @@ -897,8 +898,22 @@ func TestFlushRate(t *testing.T) { _, err := mc.Insert(ctx, insertOpt) common.CheckErr(t, err, true) - _, err = mc.Flush(ctx, client.NewFlushOption(schema.CollectionName)) - common.CheckErr(t, err, true) - _, err = mc.Flush(ctx, client.NewFlushOption(schema.CollectionName)) - common.CheckErr(t, err, false, "request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]") + cnt := 10 + errs := make([]error, cnt) + wg := &sync.WaitGroup{} + wg.Add(cnt) + for i := 0; i < cnt; i++ { + go func(i int) { + defer wg.Done() + _, err := mc.Flush(ctx, client.NewFlushOption(schema.CollectionName)) + errs[i] = err + }(i) + } + wg.Wait() + + for _, err := range errs { + if err != nil { + common.CheckErr(t, err, false, "request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded") + } + } }