Skip to content

Commit e528b68

Browse files
authored
server/tests/cursor: fix cursor fetch error flacky test (#50969)
close #47029
1 parent 9a0b6b6 commit e528b68

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)