Skip to content

Commit

Permalink
test: stabilize TestTopSQLCPUProfile (pingcap#36468)
Browse files Browse the repository at this point in the history
  • Loading branch information
tangenta authored Jul 22, 2022
1 parent eaead02 commit 4c74ab4
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions server/tidb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1412,10 +1412,7 @@ func TestTopSQLCPUProfile(t *testing.T) {
dbt.MustExec("create table t2 (a int auto_increment, b int, unique index idx(a));")
dbt.MustExec("set @@global.tidb_txn_mode = 'pessimistic'")

timeoutCtx, cancel := context.WithTimeout(context.Background(), time.Second*20)
defer cancel()
checkFn := func(sql, planRegexp string) {
require.NoError(t, timeoutCtx.Err())
stats := mc.GetSQLStatsBySQLWithRetry(sql, len(planRegexp) > 0)
// since 1 sql may has many plan, check `len(stats) > 0` instead of `len(stats) == 1`.
require.Greaterf(t, len(stats), 0, "sql: "+sql)
Expand Down

0 comments on commit 4c74ab4

Please sign in to comment.