Skip to content

Commit

Permalink
enable
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkingrei committed Aug 7, 2022
1 parent 094a001 commit a688e28
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
6 changes: 2 additions & 4 deletions ddl/column_modify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ import (
testddlutil "github.com/pingcap/tidb/ddl/testutil"
"github.com/pingcap/tidb/domain"
"github.com/pingcap/tidb/errno"
"github.com/pingcap/tidb/infoschema"
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/parser/ast"
"github.com/pingcap/tidb/parser/model"
"github.com/pingcap/tidb/parser/mysql"
"github.com/pingcap/tidb/sessionctx"
"github.com/pingcap/tidb/sessiontxn"
"github.com/pingcap/tidb/store/mockstore"
"github.com/pingcap/tidb/table"
Expand Down Expand Up @@ -447,7 +445,7 @@ func TestVirtualColumnDDL(t *testing.T) {
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec(`create global temporary table test_gv_ddl(a int, b int as (a+8) virtual, c int as (b + 2) stored) on commit delete rows;`)
is := tk.Session().(sessionctx.Context).GetInfoSchema().(infoschema.InfoSchema)
is := sessiontxn.GetTxnManager(tk.Session()).GetTxnInfoSchema()
tbl, err := is.TableByName(model.NewCIStr("test"), model.NewCIStr("test_gv_ddl"))
require.NoError(t, err)
testCases := []struct {
Expand All @@ -471,7 +469,7 @@ func TestVirtualColumnDDL(t *testing.T) {

// for local temporary table
tk.MustExec(`create temporary table test_local_gv_ddl(a int, b int as (a+8) virtual, c int as (b + 2) stored);`)
is = tk.Session().(sessionctx.Context).GetInfoSchema().(infoschema.InfoSchema)
is = sessiontxn.GetTxnManager(tk.Session()).GetTxnInfoSchema()
tbl, err = is.TableByName(model.NewCIStr("test"), model.NewCIStr("test_local_gv_ddl"))
require.NoError(t, err)
for i, column := range tbl.Meta().Columns {
Expand Down
8 changes: 4 additions & 4 deletions ddl/column_type_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ var mockTerrorMap = make(map[string]*terror.Error)

func init() {
// Since terror new action will cause data race with other test suite (getTerrorCode) in parallel, we init it all here.
mockTerrorMap[model.StateNone.String()] = dbterror.ClassDDL.New(1, "MockRollingBackInCallBack-"+model.StateNone.String())
mockTerrorMap[model.StateDeleteOnly.String()] = dbterror.ClassDDL.New(1, "MockRollingBackInCallBack-"+model.StateDeleteOnly.String())
mockTerrorMap[model.StateWriteOnly.String()] = dbterror.ClassDDL.New(1, "MockRollingBackInCallBack-"+model.StateWriteOnly.String())
mockTerrorMap[model.StateWriteReorganization.String()] = dbterror.ClassDDL.New(1, "MockRollingBackInCallBack-"+model.StateWriteReorganization.String())
mockTerrorMap[model.StateNone.String()] = dbterror.ClassDDL.NewStdErr(1, mysql.Message("MockRollingBackInCallBack-"+model.StateNone.String(), nil))
mockTerrorMap[model.StateDeleteOnly.String()] = dbterror.ClassDDL.NewStdErr(1, mysql.Message("MockRollingBackInCallBack-"+model.StateDeleteOnly.String(), nil))
mockTerrorMap[model.StateWriteOnly.String()] = dbterror.ClassDDL.NewStdErr(1, mysql.Message("MockRollingBackInCallBack-"+model.StateWriteOnly.String(), nil))
mockTerrorMap[model.StateWriteReorganization.String()] = dbterror.ClassDDL.NewStdErr(1, mysql.Message("MockRollingBackInCallBack-"+model.StateWriteReorganization.String(), nil))
}

func TestColumnTypeChangeFromIntegerToOthers(t *testing.T) {
Expand Down
7 changes: 4 additions & 3 deletions ddl/serial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/pingcap/tidb/planner/core"
"github.com/pingcap/tidb/session"
"github.com/pingcap/tidb/sessionctx/variable"
"github.com/pingcap/tidb/sessiontxn"
"github.com/pingcap/tidb/store/mockstore"
"github.com/pingcap/tidb/tablecodec"
"github.com/pingcap/tidb/testkit"
Expand Down Expand Up @@ -271,7 +272,7 @@ func TestCreateTableWithLikeAtTemporaryMode(t *testing.T) {
tk.MustExec(`create table test_gv_ddl(a int, b int as (a+8) virtual, c int as (b + 2) stored)`)
tk.MustExec(`create global temporary table test_gv_ddl_temp like test_gv_ddl on commit delete rows;`)
defer tk.MustExec("drop table if exists test_gv_ddl_temp, test_gv_ddl")
is := tk.Session().GetInfoSchema().(infoschema.InfoSchema)
is := sessiontxn.GetTxnManager(tk.Session()).GetTxnInfoSchema()
table, err := is.TableByName(model.NewCIStr("test"), model.NewCIStr("test_gv_ddl"))
require.NoError(t, err)
testCases := []struct {
Expand Down Expand Up @@ -300,7 +301,7 @@ func TestCreateTableWithLikeAtTemporaryMode(t *testing.T) {
tk.MustExec("create table test_foreign_key (c int,d int,foreign key (d) references t1 (b))")
defer tk.MustExec("drop table if exists test_foreign_key, t1")
tk.MustExec("create global temporary table test_foreign_key_temp like test_foreign_key on commit delete rows")
is = tk.Session().GetInfoSchema().(infoschema.InfoSchema)
is = sessiontxn.GetTxnManager(tk.Session()).GetTxnInfoSchema()
table, err = is.TableByName(model.NewCIStr("test"), model.NewCIStr("test_foreign_key_temp"))
require.NoError(t, err)
tableInfo := table.Meta()
Expand Down Expand Up @@ -384,7 +385,7 @@ func TestCreateTableWithLikeAtTemporaryMode(t *testing.T) {
tk.MustExec("create table foreign_key_table1 (a int, b int)")
tk.MustExec("create table foreign_key_table2 (c int,d int,foreign key (d) references foreign_key_table1 (b))")
tk.MustExec("create temporary table foreign_key_tmp like foreign_key_table2")
is = tk.Session().GetInfoSchema().(infoschema.InfoSchema)
is = sessiontxn.GetTxnManager(tk.Session()).GetTxnInfoSchema()
table, err = is.TableByName(model.NewCIStr("test"), model.NewCIStr("foreign_key_tmp"))
require.NoError(t, err)
tableInfo = table.Meta()
Expand Down

0 comments on commit a688e28

Please sign in to comment.