Skip to content

Commit

Permalink
test: fix unstable TestParallelErrStage (pingcap#55620)
Browse files Browse the repository at this point in the history
  • Loading branch information
tangenta committed Aug 23, 2024
1 parent ae59dfe commit d041cd0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pkg/disttask/framework/scheduler/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func checkSchedule(t *testing.T, taskCnt int, isSucc, isCancel, isSubtaskCancel,

checkSubtaskCnt := func(tasks []*proto.Task, taskIDs []int64) {
for i, taskID := range taskIDs {
require.Equal(t, int64(i+1), tasks[i].ID)
require.Equal(t, taskID, tasks[i].ID)
require.Eventually(t, func() bool {
cntByStates, err := mgr.GetSubtaskCntGroupByStates(ctx, taskID, proto.StepOne)
require.NoError(t, err)
Expand Down
12 changes: 3 additions & 9 deletions pkg/table/tables/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,16 +521,10 @@ func TestRenewLeaseABAFailPoint(t *testing.T) {
tk2.MustExec("use test")

// Load the cache data by this query.
var cacheUsed bool
for i := 0; i < 10; i++ {
require.Eventually(t, func() bool {
tk.MustQuery("select * from t_lease").Check(testkit.Rows("1 1"))
if lastReadFromCache(tk) {
cacheUsed = true
break
}
time.Sleep(50 * time.Millisecond)
}
require.True(t, cacheUsed)
return lastReadFromCache(tk)
}, 3*time.Second, 100*time.Millisecond)

// Renew lease by this query, mock the operation is delayed.
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/table/tables/mockRenewLeaseABA1", `return`))
Expand Down

0 comments on commit d041cd0

Please sign in to comment.