diff --git a/session/pessimistic_test.go b/session/pessimistic_test.go index f8eb7ed0bb..7fa2bcbbd3 100644 --- a/session/pessimistic_test.go +++ b/session/pessimistic_test.go @@ -523,6 +523,10 @@ func (s *testPessimisticSuite) TestAsyncRollBackNoWait(c *C) { // the txn correctness should be ensured c.Assert(failpoint.Enable("github.com/pingcap/tidb/executor/ExecStmtGetTsError", "return"), IsNil) c.Assert(failpoint.Enable("github.com/pingcap/tidb/store/tikv/AsyncRollBackSleep", "return"), IsNil) + defer func() { + c.Assert(failpoint.Disable("github.com/pingcap/tidb/executor/ExecStmtGetTsError"), IsNil) + c.Assert(failpoint.Disable("github.com/pingcap/tidb/store/tikv/AsyncRollBackSleep"), IsNil) + }() tk.MustExec("begin pessimistic") tk.MustExec("select * from tk where c1 > 0 for update nowait") tk2.MustExec("begin pessimistic") @@ -549,8 +553,6 @@ func (s *testPessimisticSuite) TestAsyncRollBackNoWait(c *C) { tk3.MustQuery("select * from tk where c1 = 4 for update nowait").Check(testkit.Rows("4 4")) tk3.MustQuery("select * from tk where c1 = 3 for update nowait").Check(testkit.Rows("3 3")) tk3.MustExec("commit") - c.Assert(failpoint.Disable("github.com/pingcap/tidb/executor/ExecStmtGetTsError"), IsNil) - c.Assert(failpoint.Disable("github.com/pingcap/tidb/store/tikv/AsyncRollBackSleep"), IsNil) } func (s *testPessimisticSuite) TestWaitLockKill(c *C) {