diff --git a/ddl/column_change_test.go b/ddl/column_change_test.go index 67e3927860346..2a79e91d1e9d5 100644 --- a/ddl/column_change_test.go +++ b/ddl/column_change_test.go @@ -48,12 +48,12 @@ type testColumnChangeSuite struct { func (s *testColumnChangeSuite) SetUpSuite(c *C) { SetWaitTimeWhenErrorOccurred(1 * time.Microsecond) s.store = testCreateStore(c, "test_column_change") - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -67,12 +67,12 @@ func (s *testColumnChangeSuite) TearDownSuite(c *C) { } func (s *testColumnChangeSuite) TestColumnChange(c *C) { - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -80,7 +80,7 @@ func (s *testColumnChangeSuite) TestColumnChange(c *C) { // create table t (c1 int, c2 int); tblInfo := testTableInfo(c, d, "t", 2) ctx := testNewContext(d) - err := ctx.NewTxn(context.Background()) + err = ctx.NewTxn(context.Background()) c.Assert(err, IsNil) testCreateTable(c, ctx, d, s.dbInfo, tblInfo) // insert t values (1, 2); @@ -163,12 +163,12 @@ func (s *testColumnChangeSuite) TestColumnChange(c *C) { } func (s *testColumnChangeSuite) TestModifyAutoRandColumnWithMetaKeyChanged(c *C) { - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) diff --git a/ddl/column_test.go b/ddl/column_test.go index acf98bb26fc87..d92199ecc0e5e 100644 --- a/ddl/column_test.go +++ b/ddl/column_test.go @@ -46,12 +46,12 @@ type testColumnSuite struct { func (s *testColumnSuite) SetUpSuite(c *C) { s.store = testCreateStore(c, "test_column") - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) s.dbInfo = testSchemaInfo(c, d, "test_column") testCreateSchema(c, testNewContext(d), d, s.dbInfo) @@ -185,12 +185,12 @@ func testDropColumns(c *C, ctx sessionctx.Context, d *ddl, dbInfo *model.DBInfo, } func (s *testColumnSuite) TestColumnBasic(c *C) { - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -208,7 +208,7 @@ func (s *testColumnSuite) TestColumnBasic(c *C) { c.Assert(err, IsNil) } - err := ctx.NewTxn(context.Background()) + err = ctx.NewTxn(context.Background()) c.Assert(err, IsNil) i := int64(0) @@ -836,16 +836,16 @@ func (s *testColumnSuite) testGetColumn(t table.Table, name string, isExist bool } func (s *testColumnSuite) TestAddColumn(c *C) { - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) tblInfo := testTableInfo(c, d, "t", 3) ctx := testNewContext(d) - err := ctx.NewTxn(context.Background()) + err = ctx.NewTxn(context.Background()) c.Assert(err, IsNil) testCreateTable(c, ctx, d, s.dbInfo, tblInfo) @@ -924,16 +924,16 @@ func (s *testColumnSuite) TestAddColumn(c *C) { } func (s *testColumnSuite) TestAddColumns(c *C) { - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) tblInfo := testTableInfo(c, d, "t", 3) ctx := testNewContext(d) - err := ctx.NewTxn(context.Background()) + err = ctx.NewTxn(context.Background()) c.Assert(err, IsNil) testCreateTable(c, ctx, d, s.dbInfo, tblInfo) @@ -1009,16 +1009,16 @@ func (s *testColumnSuite) TestAddColumns(c *C) { } func (s *testColumnSuite) TestDropColumn(c *C) { - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) tblInfo := testTableInfo(c, d, "t2", 4) ctx := testNewContext(d) - err := ctx.NewTxn(context.Background()) + err = ctx.NewTxn(context.Background()) c.Assert(err, IsNil) testCreateTable(c, ctx, d, s.dbInfo, tblInfo) @@ -1085,16 +1085,16 @@ func (s *testColumnSuite) TestDropColumn(c *C) { } func (s *testColumnSuite) TestDropColumns(c *C) { - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) tblInfo := testTableInfo(c, d, "t2", 4) ctx := testNewContext(d) - err := ctx.NewTxn(context.Background()) + err = ctx.NewTxn(context.Background()) c.Assert(err, IsNil) testCreateTable(c, ctx, d, s.dbInfo, tblInfo) @@ -1154,12 +1154,12 @@ func (s *testColumnSuite) TestDropColumns(c *C) { } func (s *testColumnSuite) TestModifyColumn(c *C) { - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) ctx := testNewContext(d) defer func() { @@ -1222,12 +1222,12 @@ func (s *testColumnSuite) TestFieldCase(c *C) { } func (s *testColumnSuite) TestAutoConvertBlobTypeByLength(c *C) { - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) // Close the customized ddl(worker goroutine included) after the test is finished, otherwise, it will // cause go routine in TiDB leak test. defer func() { diff --git a/ddl/ddl_test.go b/ddl/ddl_test.go index 9ac70a5ccb124..f158c3203abd3 100644 --- a/ddl/ddl_test.go +++ b/ddl/ddl_test.go @@ -96,16 +96,14 @@ func TestT(t *testing.T) { testleak.AfterTestT(t)() } -func testNewDDLAndStart(ctx context.Context, c *C, options ...Option) *ddl { +func testNewDDLAndStart(ctx context.Context, options ...Option) (*ddl, error) { // init infoCache and a stub infoSchema ic := infoschema.NewCache(2) ic.Insert(infoschema.MockInfoSchemaWithSchemaVer(nil, 0), 0) options = append(options, WithInfoCache(ic)) d := newDDL(ctx, options...) err := d.Start(nil) - c.Assert(err, IsNil) - - return d + return d, err } func testCreateStore(c *C, name string) kv.Storage { diff --git a/ddl/ddl_worker_test.go b/ddl/ddl_worker_test.go index 90fb4604650a7..de2b6061286f7 100644 --- a/ddl/ddl_worker_test.go +++ b/ddl/ddl_worker_test.go @@ -62,12 +62,12 @@ func (s *testDDLSuite) TestCheckOwner(c *C) { c.Assert(err, IsNil) }() - d1 := testNewDDLAndStart( + d1, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d1.Stop() c.Assert(err, IsNil) @@ -95,12 +95,12 @@ func (s *testDDLSuite) TestNotifyDDLJob(c *C) { } } - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -139,12 +139,12 @@ func (s *testDDLSuite) TestNotifyDDLJob(c *C) { // Test the notification mechanism that the owner and the server receiving the DDL request are not on the same TiDB. // And the etcd client is nil. - d1 := testNewDDLAndStart( + d1, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d1.Stop() c.Assert(err, IsNil) @@ -178,12 +178,12 @@ func (s *testDDLSerialSuite) testRunWorker(c *C) { }() RunWorker = false - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) testCheckOwner(c, d, false) defer func() { err := d.Stop() @@ -195,12 +195,12 @@ func (s *testDDLSerialSuite) testRunWorker(c *C) { c.Assert(worker, IsNil) // Make sure the DDL job can be done and exit that goroutine. RunWorker = true - d1 := testNewDDLAndStart( + d1, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) testCheckOwner(c, d1, true) defer func() { err := d1.Stop() @@ -217,12 +217,12 @@ func (s *testDDLSuite) TestSchemaError(c *C) { c.Assert(err, IsNil) }() - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -239,12 +239,12 @@ func (s *testDDLSuite) TestTableError(c *C) { c.Assert(err, IsNil) }() - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -261,7 +261,7 @@ func (s *testDDLSuite) TestTableError(c *C) { // Table ID or schema ID is wrong, so getting table is failed. tblInfo := testTableInfo(c, d, "t", 3) testCreateTable(c, ctx, d, dbInfo, tblInfo) - err := kv.RunInNewTxn(context.Background(), store, false, func(ctx context.Context, txn kv.Transaction) error { + err = kv.RunInNewTxn(context.Background(), store, false, func(ctx context.Context, txn kv.Transaction) error { job.SchemaID = -1 job.TableID = -1 t := meta.NewMeta(txn) @@ -291,12 +291,12 @@ func (s *testDDLSuite) TestViewError(c *C) { c.Assert(err, IsNil) }() - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -325,12 +325,12 @@ func (s *testDDLSuite) TestInvalidDDLJob(c *C) { err := store.Close() c.Assert(err, IsNil) }() - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -344,7 +344,7 @@ func (s *testDDLSuite) TestInvalidDDLJob(c *C) { BinlogInfo: &model.HistoryInfo{}, Args: []interface{}{}, } - err := d.doDDLJob(ctx, job) + err = d.doDDLJob(ctx, job) c.Assert(err.Error(), Equals, "[ddl:8204]invalid ddl job type: none") } @@ -355,12 +355,12 @@ func (s *testDDLSuite) TestForeignKeyError(c *C) { c.Assert(err, IsNil) }() - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -384,12 +384,12 @@ func (s *testDDLSuite) TestIndexError(c *C) { c.Assert(err, IsNil) }() - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -430,12 +430,12 @@ func (s *testDDLSuite) TestColumnError(c *C) { err := store.Close() c.Assert(err, IsNil) }() - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -729,12 +729,12 @@ func (s *testDDLSerialSuite) TestCancelJob(c *C) { err := store.Close() c.Assert(err, IsNil) }() - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -748,7 +748,7 @@ func (s *testDDLSerialSuite) TestCancelJob(c *C) { // create table t (c1 int, c2 int, c3 int, c4 int, c5 int); tblInfo := testTableInfo(c, d, "t", 5) ctx := testNewContext(d) - err := ctx.NewTxn(context.Background()) + err = ctx.NewTxn(context.Background()) c.Assert(err, IsNil) err = ctx.GetSessionVars().SetSystemVar("tidb_enable_exchange_partition", "1") c.Assert(err, IsNil) @@ -1438,18 +1438,18 @@ func (s *testDDLSuite) TestParallelDDL(c *C) { err := store.Close() c.Assert(err, IsNil) }() - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) }() ctx := testNewContext(d) - err := ctx.NewTxn(context.Background()) + err = ctx.NewTxn(context.Background()) c.Assert(err, IsNil) /* build structure: @@ -1643,12 +1643,12 @@ func (s *testDDLSuite) TestDDLPackageExecuteSQL(c *C) { c.Assert(err, IsNil) }() - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) testCheckOwner(c, d, true) defer func() { err := d.Stop() diff --git a/ddl/fail_test.go b/ddl/fail_test.go index ef671a45bf9f0..e5ac586976ae0 100644 --- a/ddl/fail_test.go +++ b/ddl/fail_test.go @@ -25,12 +25,12 @@ import ( ) func (s *testColumnChangeSuite) TestFailBeforeDecodeArgs(c *C) { - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -38,7 +38,7 @@ func (s *testColumnChangeSuite) TestFailBeforeDecodeArgs(c *C) { // create table t_fail (c1 int, c2 int); tblInfo := testTableInfo(c, d, "t_fail", 2) ctx := testNewContext(d) - err := ctx.NewTxn(context.Background()) + err = ctx.NewTxn(context.Background()) c.Assert(err, IsNil) testCreateTable(c, ctx, d, s.dbInfo, tblInfo) // insert t_fail values (1, 2); diff --git a/ddl/foreign_key_test.go b/ddl/foreign_key_test.go index 699205380e53d..1ab322ecc8221 100644 --- a/ddl/foreign_key_test.go +++ b/ddl/foreign_key_test.go @@ -112,12 +112,12 @@ func getForeignKey(t table.Table, name string) *model.FKInfo { } func (s *testForeignKeySuite) TestForeignKey(c *C) { - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -129,7 +129,7 @@ func (s *testForeignKeySuite) TestForeignKey(c *C) { testCreateSchema(c, ctx, d, s.dbInfo) tblInfo := testTableInfo(c, d, "t", 3) - err := ctx.NewTxn(context.Background()) + err = ctx.NewTxn(context.Background()) c.Assert(err, IsNil) testCreateTable(c, ctx, d, s.dbInfo, tblInfo) diff --git a/ddl/index_change_test.go b/ddl/index_change_test.go index 402ea37d61780..95ac5889265ad 100644 --- a/ddl/index_change_test.go +++ b/ddl/index_change_test.go @@ -38,12 +38,12 @@ type testIndexChangeSuite struct { func (s *testIndexChangeSuite) SetUpSuite(c *C) { s.store = testCreateStore(c, "test_index_change") - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -57,12 +57,12 @@ func (s *testIndexChangeSuite) TearDownSuite(c *C) { } func (s *testIndexChangeSuite) TestIndexChange(c *C) { - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -72,7 +72,7 @@ func (s *testIndexChangeSuite) TestIndexChange(c *C) { tblInfo.Columns[0].Flag = mysql.PriKeyFlag | mysql.NotNullFlag tblInfo.PKIsHandle = true ctx := testNewContext(d) - err := ctx.NewTxn(context.Background()) + err = ctx.NewTxn(context.Background()) c.Assert(err, IsNil) testCreateTable(c, ctx, d, s.dbInfo, tblInfo) originTable := testGetTable(c, d, s.dbInfo.ID, tblInfo.ID) diff --git a/ddl/partition_test.go b/ddl/partition_test.go index 6e84bfdda84cd..5dc5d51b9d3c9 100644 --- a/ddl/partition_test.go +++ b/ddl/partition_test.go @@ -41,12 +41,12 @@ func (s *testPartitionSuite) TearDownSuite(c *C) { } func (s *testPartitionSuite) TestDropAndTruncatePartition(c *C) { - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) diff --git a/ddl/placement_policy_ddl_test.go b/ddl/placement_policy_ddl_test.go index c713570124efd..2f083b3f56f56 100644 --- a/ddl/placement_policy_ddl_test.go +++ b/ddl/placement_policy_ddl_test.go @@ -60,7 +60,8 @@ func (s *testDDLSuite) TestPlacementPolicyInUse(c *C) { }() ctx := context.Background() - d := testNewDDLAndStart(ctx, c, WithStore(store)) + d, err := testNewDDLAndStart(ctx, WithStore(store)) + c.Assert(err, IsNil) sctx := testNewContext(d) db1 := testSchemaInfo(c, d, "db1") diff --git a/ddl/reorg_test.go b/ddl/reorg_test.go index 269df0dc1c76d..8338da13f5ac2 100644 --- a/ddl/reorg_test.go +++ b/ddl/reorg_test.go @@ -41,12 +41,12 @@ func (s *testDDLSuite) TestReorg(c *C) { c.Assert(err, IsNil) }() - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -60,7 +60,7 @@ func (s *testDDLSuite) TestReorg(c *C) { c.Assert(ctx.Value(testCtxKey), Equals, 1) ctx.ClearValue(testCtxKey) - err := ctx.NewTxn(context.Background()) + err = ctx.NewTxn(context.Background()) c.Assert(err, IsNil) txn, err := ctx.Txn(true) c.Assert(err, IsNil) @@ -192,12 +192,12 @@ func (s *testDDLSuite) TestReorgOwner(c *C) { c.Assert(err, IsNil) }() - d1 := testNewDDLAndStart( + d1, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d1.Stop() c.Assert(err, IsNil) @@ -207,12 +207,12 @@ func (s *testDDLSuite) TestReorgOwner(c *C) { testCheckOwner(c, d1, true) - d2 := testNewDDLAndStart( + d2, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d2.Stop() c.Assert(err, IsNil) diff --git a/ddl/restart_test.go b/ddl/restart_test.go index 6248e86806696..4311b40d79c0e 100644 --- a/ddl/restart_test.go +++ b/ddl/restart_test.go @@ -110,12 +110,12 @@ func (s *testSchemaSuite) TestSchemaResume(c *C) { c.Assert(err, IsNil) }() - d1 := testNewDDLAndStart( + d1, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d1.Stop() c.Assert(err, IsNil) @@ -149,12 +149,12 @@ func (s *testStatSuite) TestStat(c *C) { c.Assert(err, IsNil) }() - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) diff --git a/ddl/schema_test.go b/ddl/schema_test.go index 7ddbe1a4ea0db..772d439c13777 100644 --- a/ddl/schema_test.go +++ b/ddl/schema_test.go @@ -129,12 +129,12 @@ func (s *testSchemaSuite) TestSchema(c *C) { err := store.Close() c.Assert(err, IsNil) }() - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -181,7 +181,7 @@ func (s *testSchemaSuite) TestSchema(c *C) { Type: model.ActionDropSchema, BinlogInfo: &model.HistoryInfo{}, } - err := d.doDDLJob(ctx, job) + err = d.doDDLJob(ctx, job) c.Assert(terror.ErrorEqual(err, infoschema.ErrDatabaseDropExists), IsTrue, Commentf("err %v", err)) // Drop a database without a table. @@ -201,12 +201,12 @@ func (s *testSchemaSuite) TestSchemaWaitJob(c *C) { c.Assert(err, IsNil) }() - d1 := testNewDDLAndStart( + d1, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d1.Stop() c.Assert(err, IsNil) @@ -214,12 +214,12 @@ func (s *testSchemaSuite) TestSchemaWaitJob(c *C) { testCheckOwner(c, d1, true) - d2 := testNewDDLAndStart( + d2, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease*4), ) + c.Assert(err, IsNil) defer func() { err := d2.Stop() c.Assert(err, IsNil) diff --git a/ddl/stat_test.go b/ddl/stat_test.go index 58cb113352805..e6dc64bd14f1c 100644 --- a/ddl/stat_test.go +++ b/ddl/stat_test.go @@ -51,12 +51,12 @@ func (s *testSerialStatSuite) TestDDLStatsInfo(c *C) { c.Assert(err, IsNil) }() - d := testNewDDLAndStart( + d, err := testNewDDLAndStart( context.Background(), - c, WithStore(store), WithLease(testLease), ) + c.Assert(err, IsNil) defer func() { err := d.Stop() c.Assert(err, IsNil) @@ -70,7 +70,7 @@ func (s *testSerialStatSuite) TestDDLStatsInfo(c *C) { t := testGetTable(c, d, dbInfo.ID, tblInfo.ID) // insert t values (1, 1), (2, 2), (3, 3) - _, err := t.AddRecord(ctx, types.MakeDatums(1, 1)) + _, err = t.AddRecord(ctx, types.MakeDatums(1, 1)) c.Assert(err, IsNil) _, err = t.AddRecord(ctx, types.MakeDatums(2, 2)) c.Assert(err, IsNil) diff --git a/ddl/table_test.go b/ddl/table_test.go index 7f577c8d1a916..312e147a54064 100644 --- a/ddl/table_test.go +++ b/ddl/table_test.go @@ -349,12 +349,13 @@ func testGetTableWithError(d *ddl, schemaID, tableID int64) (table.Table, error) func (s *testTableSuite) SetUpSuite(c *C) { s.store = testCreateStore(c, "test_table") - s.d = testNewDDLAndStart( + ddl, err := testNewDDLAndStart( context.Background(), - c, WithStore(s.store), WithLease(testLease), ) + c.Assert(err, IsNil) + s.d = ddl s.dbInfo = testSchemaInfo(c, s.d, "test_table") testCreateSchema(c, testNewContext(s.d), s.d, s.dbInfo)