Skip to content

Commit 01ff83f

Browse files
committed
Fix cursor fetch error flacky test
Signed-off-by: Yang Keao <[email protected]>
1 parent ba77807 commit 01ff83f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/server/tests/cursor/cursor_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,16 @@ func TestCursorFetchErrorInFetch(t *testing.T) {
6767

6868
tk.MustExec(fmt.Sprintf("set tidb_mem_quota_query=%d", 1))
6969

70+
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/util/chunk/get-chunk-error", "return(true)"))
71+
defer func() {
72+
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/util/chunk/get-chunk-error"))
73+
}()
74+
7075
require.NoError(t, c.Dispatch(ctx, append(
7176
appendUint32([]byte{tmysql.ComStmtExecute}, uint32(stmt.ID())),
7277
tmysql.CursorTypeReadOnly, 0x1, 0x0, 0x0, 0x0,
7378
)))
7479

75-
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/util/chunk/get-chunk-error", "return(true)"))
76-
defer func() {
77-
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/util/chunk/get-chunk-error"))
78-
}()
7980
require.ErrorContains(t, c.Dispatch(ctx, appendUint32(appendUint32([]byte{tmysql.ComStmtFetch}, uint32(stmt.ID())), 1024)), "fail to get chunk for test")
8081
// after getting a failed FETCH, the cursor should have been reseted
8182
require.False(t, stmt.GetCursorActive())

0 commit comments

Comments
 (0)