From 2a5fb55194c1b4cf9378403d2c64a00a0b240dab Mon Sep 17 00:00:00 2001 From: wjHuang Date: Thu, 16 Jul 2020 12:52:18 +0800 Subject: [PATCH] session: stabilize test TestBatchCommit (#18625) Signed-off-by: wjhuang2016 --- session/pessimistic_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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) {