Skip to content

Commit d51384c

Browse files
git-hulkclaude
andauthored
fix(test): extend the replication wait time to prevent the flaky test (#3531)
Currently, WaitForSync only allows 5s for master_link_status to reach "up", which is not enough under loaded CI runners (e.g. SonarCloud coverage builds); Reproduced locally by running 16 background CPU burners and looping the test: ``` for i in $(seq 1 6); do go test -count=1 -run TestReplicationWithLimitSpeed$ \ ./integration/replication/... \ -binPath=.../build/kvrocks -workspace=/tmp/kvrocks-test-ws done ``` Before the fix: 1/6 runs failed with the same trace as the CI flake ("Condition never satisfied" at client.go:50, called from replication_test.go:362). After the fix: 8/8 runs pass under the same CPU load (run times 34-51s vs. an unloaded baseline of ~28s, confirming load was active). Related flaky run: https://github.com/apache/kvrocks/actions/runs/27660686644/job/81804342125 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 812386c commit d51384c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/gocase/integration/replication/replication_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,9 @@ func TestReplicationWithLimitSpeed(t *testing.T) {
359359
require.Eventually(t, func() bool {
360360
return slave.LogFileMatches(t, ".*skip count: 1.*")
361361
}, 50*time.Second, 1000*time.Millisecond)
362-
util.WaitForSync(t, slaveClient)
362+
require.Eventually(t, func() bool {
363+
return util.FindInfoEntry(slaveClient, "master_link_status") == "up"
364+
}, 30*time.Second, 100*time.Millisecond)
363365
require.Equal(t, "b", slaveClient.Get(ctx, "a").Val())
364366
})
365367
}

0 commit comments

Comments
 (0)