Skip to content

Commit d041cd0

Browse files
authored
test: fix unstable TestParallelErrStage (#55620)
close #55594
1 parent ae59dfe commit d041cd0

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

pkg/disttask/framework/scheduler/scheduler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func checkSchedule(t *testing.T, taskCnt int, isSucc, isCancel, isSubtaskCancel,
204204

205205
checkSubtaskCnt := func(tasks []*proto.Task, taskIDs []int64) {
206206
for i, taskID := range taskIDs {
207-
require.Equal(t, int64(i+1), tasks[i].ID)
207+
require.Equal(t, taskID, tasks[i].ID)
208208
require.Eventually(t, func() bool {
209209
cntByStates, err := mgr.GetSubtaskCntGroupByStates(ctx, taskID, proto.StepOne)
210210
require.NoError(t, err)

pkg/table/tables/cache_test.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -521,16 +521,10 @@ func TestRenewLeaseABAFailPoint(t *testing.T) {
521521
tk2.MustExec("use test")
522522

523523
// Load the cache data by this query.
524-
var cacheUsed bool
525-
for i := 0; i < 10; i++ {
524+
require.Eventually(t, func() bool {
526525
tk.MustQuery("select * from t_lease").Check(testkit.Rows("1 1"))
527-
if lastReadFromCache(tk) {
528-
cacheUsed = true
529-
break
530-
}
531-
time.Sleep(50 * time.Millisecond)
532-
}
533-
require.True(t, cacheUsed)
526+
return lastReadFromCache(tk)
527+
}, 3*time.Second, 100*time.Millisecond)
534528

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

0 commit comments

Comments
 (0)