-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ddl: migrate test-infra to testify for serial_test.go #30630
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
@tisonkun PTAL PS: for |
ddl/serial_test.go
Outdated
@@ -215,23 +215,23 @@ func TestCreateTableWithLikeAtTemporaryMode(t *testing.T) { | |||
// Test create temporary table like. | |||
// Test auto_random. | |||
tk.MustExec("drop table if exists auto_random_table") | |||
_, err = tk.Exec("create table auto_random_table (a bigint primary key auto_random(3), b varchar(255));") | |||
tk.Exec("create table auto_random_table (a bigint primary key auto_random(3), b varchar(255));") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tk.Exec => tk.MustExec
You should migrate all the test cases in the serial_test.go to testify. Please not move this case to other files. The new framework has no concept of You can move this |
Well, some test cases in |
NOTE: |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/b6cc15dce8e8de2ac55ad180ea00e5e0cc8df45f |
@hawkingrei PTAL |
@wangggong sorry to reply late. @hawkingrei and other did some works on decoupling ddl tests. Could you rebase the migrate on the nightly master? I'll review the PR then. |
@tisonkun Sorry for replying late, I've merged. PTAL |
ddl/db_test.go
Outdated
@@ -258,6 +257,16 @@ func testGetTableByName(c *C, ctx sessionctx.Context, db, table string) table.Ta | |||
return tbl | |||
} | |||
|
|||
func testGetTableByNameT(t *testing.T, ctx sessionctx.Context, db, table string) table.Table { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use tk.GetTableByName
.
@wangggong thanks for your update. Let me try to submit follow ups... |
testkit/testkit.go
Outdated
@@ -62,6 +62,14 @@ func NewTestKit(t testing.TB, store kv.Storage) *TestKit { | |||
} | |||
} | |||
|
|||
// NewTestKitWithInit returns a new *TestKit and creates a session. | |||
func NewTestKitWithInit(t testing.TB, store kv.Storage) *TestKit { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We just simply write:
tk := NewTestKit(t, store)
tk.MustExec("use test")
This method is too easy to misuse unnecessarily.
@wangggong @hawkingrei maybe you can cooperate on migrating this test & db_partition test, I found they're tightly coupled. |
/run-unit-test |
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
ddl/serial_test.go
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 53bb6a3
|
/run-unit-test |
/run-unit-test |
1 similar comment
/run-unit-test |
/run-unit-test |
What problem does this PR solve?
Issue Number: close #29113
Problem Summary:
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note