Skip to content

Commit

Permalink
ddl/failtest: migrate test-infra to testify (pingcap#27747)
Browse files Browse the repository at this point in the history
  • Loading branch information
karuppiah7890 authored Sep 8, 2021
1 parent 9146cba commit cc04fdc
Show file tree
Hide file tree
Showing 6 changed files with 264 additions and 220 deletions.
2 changes: 1 addition & 1 deletion ddl/db_partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2630,7 +2630,7 @@ func testPartitionDropIndex(c *C, store kv.Storage, lease time.Duration, idxName
}
c.Assert(idx1, NotNil)

testutil.SessionExecInGoroutine(c, store, dropIdxSQL, done)
testutil.SessionExecInGoroutine(store, dropIdxSQL, done)
ticker := time.NewTicker(lease / 2)
defer ticker.Stop()
LOOP:
Expand Down
18 changes: 9 additions & 9 deletions ddl/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ func testAddIndex(c *C, store kv.Storage, lease time.Duration, tp testAddIndexTy
otherKeys = append(otherKeys, v)

addIdxSQL := fmt.Sprintf("alter table test_add_index add %s key c3_index(c3)", idxTp)
testddlutil.SessionExecInGoroutine(c, store, addIdxSQL, done)
testddlutil.SessionExecInGoroutine(store, addIdxSQL, done)

deletedKeys := make(map[int]struct{})

Expand Down Expand Up @@ -1543,7 +1543,7 @@ func testAddIndexWithSplitTable(c *C, store kv.Storage, lease time.Duration, cre
rows := re.Rows()
c.Assert(len(rows), Equals, 16)
addIdxSQL := "alter table test_add_index add index idx(a)"
testddlutil.SessionExecInGoroutine(c, store, addIdxSQL, done)
testddlutil.SessionExecInGoroutine(store, addIdxSQL, done)

ticker := time.NewTicker(lease / 5)
defer ticker.Stop()
Expand Down Expand Up @@ -1721,7 +1721,7 @@ func testDropIndex(c *C, store kv.Storage, lease time.Duration, createSQL, dropI
}
c.Assert(c3idx, NotNil)

testddlutil.SessionExecInGoroutine(c, store, dropIdxSQL, done)
testddlutil.SessionExecInGoroutine(store, dropIdxSQL, done)

ticker := time.NewTicker(lease / 2)
defer ticker.Stop()
Expand Down Expand Up @@ -2340,7 +2340,7 @@ func (s *testDBSuite) testAddColumn(tk *testkit.TestKit, c *C) {
// add some rows
batchInsert(tk, "t2", 0, num)

testddlutil.SessionExecInGoroutine(c, s.store, "alter table t2 add column c4 int default -1", done)
testddlutil.SessionExecInGoroutine(s.store, "alter table t2 add column c4 int default -1", done)

ticker := time.NewTicker(s.lease / 2)
defer ticker.Stop()
Expand Down Expand Up @@ -2486,7 +2486,7 @@ func (s *testDBSuite) testDropColumn(tk *testkit.TestKit, c *C) {
}

// get c4 column id
testddlutil.SessionExecInGoroutine(c, s.store, "alter table t2 drop column c4", done)
testddlutil.SessionExecInGoroutine(s.store, "alter table t2 drop column c4", done)

ticker := time.NewTicker(s.lease / 2)
defer ticker.Stop()
Expand Down Expand Up @@ -2552,9 +2552,9 @@ func (s *testDBSuite6) TestDropColumn(c *C) {
dmlDone := make(chan error, num)
ddlDone := make(chan error, num)

testddlutil.ExecMultiSQLInGoroutine(c, s.store, "drop_col_db", multiDDL, ddlDone)
testddlutil.ExecMultiSQLInGoroutine(s.store, "drop_col_db", multiDDL, ddlDone)
for i := 0; i < num; i++ {
testddlutil.ExecMultiSQLInGoroutine(c, s.store, "drop_col_db", []string{"insert into t2 set c1 = 1, c2 = 1, c3 = 1, c4 = 1"}, dmlDone)
testddlutil.ExecMultiSQLInGoroutine(s.store, "drop_col_db", []string{"insert into t2 set c1 = 1, c2 = 1, c3 = 1, c4 = 1"}, dmlDone)
}
for i := 0; i < num; i++ {
err := <-ddlDone
Expand Down Expand Up @@ -3787,7 +3787,7 @@ func (s *testDBSuite2) TestAddNotNullColumn(c *C) {
tk.MustExec("create table tnn (c1 int primary key auto_increment, c2 int)")
tk.MustExec("insert tnn (c2) values (0)" + strings.Repeat(",(0)", 99))
done := make(chan error, 1)
testddlutil.SessionExecInGoroutine(c, s.store, "alter table tnn add column c3 int not null default 3", done)
testddlutil.SessionExecInGoroutine(s.store, "alter table tnn add column c3 int not null default 3", done)
updateCnt := 0
out:
for {
Expand Down Expand Up @@ -7325,7 +7325,7 @@ func testDropIndexes(c *C, store kv.Storage, lease time.Duration, createSQL, dro
}
c.Assert(idxs, NotNil)

testddlutil.SessionExecInGoroutine(c, store, dropIdxSQL, done)
testddlutil.SessionExecInGoroutine(store, dropIdxSQL, done)

ticker := time.NewTicker(lease / 2)
defer ticker.Stop()
Expand Down
Loading

0 comments on commit cc04fdc

Please sign in to comment.