From b40ca6a66fb96c4bff482b2fe1bd8212380d44de Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Sat, 5 Aug 2023 23:46:12 +0800 Subject: [PATCH] *: fix TestCaptureWildcardFilter Signed-off-by: Weizhen Wang --- bindinfo/capture_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bindinfo/capture_test.go b/bindinfo/capture_test.go index ed154c6e6461c..333e9b8c63cff 100644 --- a/bindinfo/capture_test.go +++ b/bindinfo/capture_test.go @@ -18,6 +18,7 @@ import ( "fmt" "strings" "testing" + "time" "github.com/pingcap/tidb/bindinfo" "github.com/pingcap/tidb/bindinfo/internal" @@ -736,8 +737,11 @@ func TestCaptureWildcardFilter(t *testing.T) { } tk.MustExec("admin capture bindings") - rows := tk.MustQuery("show global bindings").Sort().Rows() - require.Len(t, rows, len(dbTbls)) + var rows [][]interface{} + require.Eventually(t, func() bool { + rows = tk.MustQuery("show global bindings").Sort().Rows() + return len(rows) == len(dbTbls) + }, time.Second*2, time.Millisecond*100) for _, r := range rows { q := r[0].(string) if _, exist := m[q]; !exist { // encounter an unexpected binding