diff --git a/tidb_test.go b/tidb_test.go index a433c2da5d..e2fd6dee60 100644 --- a/tidb_test.go +++ b/tidb_test.go @@ -477,23 +477,19 @@ func checkAutocommit(c *C, se Session, stmt string, isNil, expect bool) { func (s *testSessionSuite) TestAutocommit(c *C) { store := newStore(c, s.dbName) se := newSession(c, store, s.dbName) - mustExecSQL(c, se, "drop table if exists t") - c.Assert(se.(*session).txn, IsNil) + checkAutocommit(c, se, "drop table if exists t", true, false) checkAutocommit(c, se, "create table t (id BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL)", true, false) checkAutocommit(c, se, "insert t values ()", true, false) checkAutocommit(c, se, "begin", false, true) checkAutocommit(c, se, "insert t values ()", false, true) - se.Execute("drop table if exists t;") - c.Assert(se.(*session).txn, IsNil) - c.Assert(variable.GetSessionVars(se.(*session)).DisableAutocommit, IsTrue) + checkAutocommit(c, se, "drop table if exists t;", true, true) checkAutocommit(c, se, "create table t (id BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL)", true, true) checkAutocommit(c, se, "insert t values ()", false, true) checkAutocommit(c, se, "commit", true, false) checkAutocommit(c, se, "insert t values ()", true, false) - se.Execute("drop table if exists t;") - mustExecSQL(c, se, "create table t (id BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL)") - c.Assert(variable.GetSessionVars(se.(*session)).DisableAutocommit, IsFalse) + checkAutocommit(c, se, "drop table if exists t;", true, false) + checkAutocommit(c, se, "create table t (id BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL)", true, false) checkAutocommit(c, se, "begin", false, true) checkAutocommit(c, se, "insert t values ()", false, true) checkAutocommit(c, se, "rollback", true, false)