Skip to content

Commit

Permalink
ddl: migrate test-infra to testify for ddl/table_test.go
Browse files Browse the repository at this point in the history
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
  • Loading branch information
hawkingrei committed Nov 30, 2021
1 parent 50fcadc commit 8ceb8d9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
33 changes: 33 additions & 0 deletions ddl/restart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"time"

. "github.com/pingcap/check"
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/parser/model"
"github.com/pingcap/tidb/parser/terror"
"github.com/pingcap/tidb/util/mock"
Expand Down Expand Up @@ -201,6 +202,38 @@ LOOP:
}
}

var _ = Suite(&testTableSuite{})

type testTableSuite struct {
store kv.Storage
dbInfo *model.DBInfo

d *ddl
}

func (s *testTableSuite) SetUpSuite(c *C) {
s.store = testCreateStore(c, "test_table")
ddl, err := testNewDDLAndStart(
context.Background(),
WithStore(s.store),
WithLease(testLease),
)
c.Assert(err, IsNil)
s.d = ddl

s.dbInfo, err = testSchemaInfo(s.d, "test_table")
c.Assert(err, IsNil)
testCreateSchema(c, testNewContext(s.d), s.d, s.dbInfo)
}

func (s *testTableSuite) TearDownSuite(c *C) {
testDropSchema(c, testNewContext(s.d), s.d, s.dbInfo)
err := s.d.Stop()
c.Assert(err, IsNil)
err = s.store.Close()
c.Assert(err, IsNil)
}

func (s *testTableSuite) TestTableResume(c *C) {
d := s.d

Expand Down
9 changes: 0 additions & 9 deletions ddl/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@ import (
"github.com/stretchr/testify/require"
)

var _ = Suite(&testTableSuite{})

type testTableSuite struct {
store kv.Storage
dbInfo *model.DBInfo

d *ddl
}

func testTableInfoWith2IndexOnFirstColumn(c *C, d *ddl, name string, num int) *model.TableInfo {
normalInfo, err := testTableInfo(d, name, num)
c.Assert(err, IsNil)
Expand Down

0 comments on commit 8ceb8d9

Please sign in to comment.