-
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
Tracking issue for restructure tests #26022
Comments
A little question, if we use testify to instead |
In an offline discussion with @tiancaiamao it seems we'd better consider test timeout in this effort also. gocheck provides a After a little investigation, I write a helper for this requirement func RunWithTimeout(t *testing.T, d time.Duration, f func(*testing.T)) {
timeout := time.After(d)
done := make(chan bool)
go func() {
defer func() {
done <- true
}()
f(t)
}()
select {
case <-timeout:
t.Fatalf("timeout: %s", d.String())
case <-done:
}
} ... which is used as func TestName(t *testing.T) {
testkit.RunWithTimeout(t, 1 * time.Second, func(t *testing.T) {
require.Equal(t, 2, 2)
time.Sleep(2 * time.Second)
})
} .. one more level of ident but works well. However, @tiancaiamao means the original issue is that a panic from a previous test cause the whole test hang. I don't know what does it mean, since a main goroutine panic will fail the test immediately. |
It's a problem of gocheck, it spawn new goroutines to run the test cases, so a panic does not make the process exit immediately. @tisonkun |
Hi @tisonkun, I'd like to migrate some tests under |
@PragmaTwice most of |
Hi @tisonkun ,I'd like to migrate util/plancodec pkg , which is not listed above, please create a subtask and assign to me . Thx. |
Aha! That's it. Let me create one for you. |
@tisonkun You idea is same as me, tools could do easy work and more complex work need be checked manually . |
@tisonkun I assume https://pingcap.github.io/tidb-dev-guide/get-started/write-and-run-unit-tests.html#parallel needs updating? Should that section be replaced by an explanation about why we want to run things in serial? or keep it? |
So... As #33296 got merged, we have new subtasks to resolve. |
Closed as all subtasks resolved. Thanks for everyone help in this thread! |
Brief Motivation
This issue tracks the efforts to restructure TiDB tests, focusing on unit tests and integration tests, especially on separating
integration_test.go
as well as unifying test infrastructure in testify.For the detailed design, see also:
Join force
We are currently on the first phase on the effort and focus on migrating tests to testify. If you want to participant the movement, you can directly comment under any open issues below without assignee to require assignment.
You can take a look at #26375 as an example to do the migration.
Note
Before writing code, please take a look at PRs merged already and keep consistent code style.
Keep test cases as parallel as possible.When some test cases should be run in serial, take use of go testing subtests (t.Run(name string, f func(t *T))
) and parallel the parent test only. In this way, test cases in the same subtests set run in serial.Tracking issue for restructure tests #26022 (comment)When test cases should be run in serial at top level, move them intoxxx_serial_test.go
file.br/pkg
#27178 (comment)c.Assert
is almostrequire.Xxx
Migration
bindinfo
pkg #27177br/pkg
#27178cmd
pkg #27844config
pkg #27179ddl
pkg #27180distsql
pkg #26156domain
pkg #26306domain/infosync
pkg #26155errno
pkg #26081executor
#26854expression
#26855infoschema
#28319infoschema/perfschema
pkg #26436kv
pkg #26100meta
pkg #26740meta/autoid
pkg #26741metrics
pkg #26742owner
pkg #26743parser
#28887planner/cascades
#26856planner/core
#26857planner/implementation
#26858planner/memo
#26860planner/property
#26861planner/util
#26862plugin
pkg #26744plugin/conn_ip_example_test.go
#26745privilege/privileges
pkg #26746server
#26863session
#26864sessionctx
#27140statistics
#27141store
#27142tests
folder #27874tidb-binlog/driver/reader
pkg #33461tidb-binlog/node
pkg #33462tidb-binlog/pump_client
pkg #33463tidb-server
#27143structure
#27139table
#26865table/tables
#26866tablecodec
#26867telemetry
pkg #26537types
pkg #26747types/json
pkg #26374types/driver
pkg #26521util
folder #33453Kits
Reference
The text was updated successfully, but these errors were encountered: