Skip to content

Commit

Permalink
server/tests/cursor: fix cursor fetch error flacky test (pingcap#50969)
Browse files Browse the repository at this point in the history
  • Loading branch information
YangKeao authored Feb 4, 2024
1 parent 9a0b6b6 commit e528b68
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/server/tests/cursor/cursor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,16 @@ func TestCursorFetchErrorInFetch(t *testing.T) {

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

require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/util/chunk/get-chunk-error", "return(true)"))
defer func() {
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/util/chunk/get-chunk-error"))
}()

require.NoError(t, c.Dispatch(ctx, append(
appendUint32([]byte{tmysql.ComStmtExecute}, uint32(stmt.ID())),
tmysql.CursorTypeReadOnly, 0x1, 0x0, 0x0, 0x0,
)))

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

0 comments on commit e528b68

Please sign in to comment.