Skip to content

Commit 840d126

Browse files
committed
Improve TiKV wait strategy for v6 and v7 variants
- Replace 'TiKV started' log wait with more reliable indicators: - Wait for 'succeed to update max timestamp' log (appears 3+ times when TiKV is active) - Wait for status port 20180 to be listening - Increase timeout from 120s to 180s for better reliability - This addresses timeout issues where TiKV was running but wait condition wasn't matching
1 parent 4403f2d commit 840d126

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

mysql/testcontainers_helper.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,12 @@ func startTiDBCluster(ctx context.Context, t *testing.T, version string) *TiDBTe
428428
},
429429
}
430430
},
431-
WaitingFor: wait.ForLog("TiKV started").
432-
WithStartupTimeout(120 * time.Second),
431+
WaitingFor: wait.ForAll(
432+
// Wait for TiKV to connect to PD and start serving
433+
wait.ForLog("succeed to update max timestamp").
434+
WithOccurrence(3), // Wait for at least 3 region updates
435+
wait.ForListeningPort("20180/tcp"), // Status port
436+
).WithStartupTimeout(180 * time.Second),
433437
},
434438
Started: true,
435439
})
@@ -554,8 +558,12 @@ func startSharedTiDBCluster(version string) (*TiDBTestCluster, error) {
554558
},
555559
}
556560
},
557-
WaitingFor: wait.ForLog("TiKV started").
558-
WithStartupTimeout(120 * time.Second),
561+
WaitingFor: wait.ForAll(
562+
// Wait for TiKV to connect to PD and start serving
563+
wait.ForLog("succeed to update max timestamp").
564+
WithOccurrence(3), // Wait for at least 3 region updates
565+
wait.ForListeningPort("20180/tcp"), // Status port
566+
).WithStartupTimeout(180 * time.Second),
559567
},
560568
Started: true,
561569
})

0 commit comments

Comments
 (0)