From 42d18d2ee06d296f5c15d33837fa8c0c886b2ef0 Mon Sep 17 00:00:00 2001 From: husharp Date: Mon, 15 Apr 2024 18:38:29 +0800 Subject: [PATCH] fix Signed-off-by: husharp --- server/cluster/cluster_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/cluster/cluster_test.go b/server/cluster/cluster_test.go index d3da21ab3dd..b53780695db 100644 --- a/server/cluster/cluster_test.go +++ b/server/cluster/cluster_test.go @@ -3476,10 +3476,11 @@ func TestStoreOverloadedWithReplace(t *testing.T) { re.False(oc.AddOperator(op3)) ops, _ := lb.Schedule(tc, false /* dryRun */) re.Empty(ops) - // sleep 2 seconds to make sure that token is filled up - time.Sleep(2 * time.Second) - ops, _ = lb.Schedule(tc, false /* dryRun */) - re.NotEmpty(ops) + // make sure that token is filled up + testutil.Eventually(re, func() bool { + ops, _ = lb.Schedule(tc, false /* dryRun */) + return len(ops) != 0 + }) } func TestDownStoreLimit(t *testing.T) {