From 9b491858a53533a8df77fd367aa1d5c5fa6851ea Mon Sep 17 00:00:00 2001 From: yah01 Date: Wed, 1 Feb 2023 18:19:50 +0800 Subject: [PATCH] Fix datanode unit test not stable (#21911) Signed-off-by: yah01 --- internal/datanode/data_node_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/datanode/data_node_test.go b/internal/datanode/data_node_test.go index b633f2d99a..02a60cc9ee 100644 --- a/internal/datanode/data_node_test.go +++ b/internal/datanode/data_node_test.go @@ -293,11 +293,11 @@ func TestWatchChannel(t *testing.T) { err = kv.RemoveWithPrefix(fmt.Sprintf("%s/%d", Params.CommonCfg.DataCoordWatchSubPath.GetValue(), paramtable.GetNodeID())) assert.Nil(t, err) - //TODO there is not way to sync Release done, use sleep for now - time.Sleep(100 * time.Millisecond) - exist = node.flowgraphManager.exist(ch) - assert.False(t, exist) + assert.Eventually(t, func() bool { + exist = node.flowgraphManager.exist(ch) + return !exist + }, 3*time.Second, 100*time.Millisecond) }) t.Run("Test release channel", func(t *testing.T) {