From 7432c77fd1f0bc197d432b36f5b6e71670029e9f Mon Sep 17 00:00:00 2001 From: xhe Date: Fri, 2 Jun 2023 14:58:34 +0800 Subject: [PATCH] proxy: use require.Eventually Signed-off-by: xhe --- pkg/proxy/backend/backend_conn_mgr_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/proxy/backend/backend_conn_mgr_test.go b/pkg/proxy/backend/backend_conn_mgr_test.go index dd52f458..7f626643 100644 --- a/pkg/proxy/backend/backend_conn_mgr_test.go +++ b/pkg/proxy/backend/backend_conn_mgr_test.go @@ -673,7 +673,9 @@ func TestGracefulCloseWhenActive(t *testing.T) { proxy: func(_, _ *pnet.PacketIO) error { ts.mp.GracefulClose() time.Sleep(300 * time.Millisecond) - require.Equal(t, statusNotifyClose, ts.mp.closeStatus.Load()) + require.Eventually(t, func() bool { + return statusNotifyClose == ts.mp.closeStatus.Load() + }, time.Second, 100*time.Millisecond) return nil }, },