This is an automated email from the ASF dual-hosted git repository.
git-hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new 1512515ff perf(test): poll is_compacting instead of a fixed sleep in
replication test (#3561)
1512515ff is described below
commit 1512515ff72ffbfc3311cf650c3900e9f46c947d
Author: Ishita Tyagi <[email protected]>
AuthorDate: Mon Jul 20 18:37:12 2026 +0530
perf(test): poll is_compacting instead of a fixed sleep in replication test
(#3561)
### What this does
`TestReplicationShareCheckpoint` runs `COMPACT` and then blindly
`time.Sleep(time.Second)` before starting the replicas. That is slower
than necessary and potentially flaky — on a loaded CI runner one second
may not be enough for the manual compaction to finish, so the test can
proceed while compaction is still running.
This replaces the fixed sleep with the same `is_compacting` poll already
used elsewhere in the same file (`TestReplicationWithHole`), returning
as
soon as compaction completes:
```go
require.Eventually(t, func() bool {
return util.FindInfoEntry(masterClient, "is_compacting") == "no"
}, 10*time.Second, 100*time.Millisecond)
```
### Related
Part of #3524, addresses #3527.
### Note on testing
I was not able to run the full Go integration suite locally for this
change; it mirrors an existing, already-tested pattern in the same file
rather than introducing new behavior. Happy to adjust if maintainers
prefer a different approach.
Co-authored-by: Claude Opus 4.8 <[email protected]>
Co-authored-by: 纪华裕 <[email protected]>
---
tests/gocase/integration/replication/replication_test.go | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/gocase/integration/replication/replication_test.go
b/tests/gocase/integration/replication/replication_test.go
index 1914d334c..70a2706a5 100644
--- a/tests/gocase/integration/replication/replication_test.go
+++ b/tests/gocase/integration/replication/replication_test.go
@@ -389,7 +389,9 @@ func TestReplicationShareCheckpoint(t *testing.T) {
ctx := context.Background()
require.NoError(t, masterClient.Set(ctx, "a", "b", 0).Err())
require.NoError(t, masterClient.Do(ctx, "compact").Err())
- time.Sleep(time.Second)
+ require.Eventually(t, func() bool {
+ return util.FindInfoEntry(masterClient, "is_compacting") == "no"
+ }, 10*time.Second, 100*time.Millisecond)
slave1 := util.StartServer(t, map[string]string{})
defer slave1.Close()