From ef01e6cdfd93cdfba15aa8491e39db2d3b20d795 Mon Sep 17 00:00:00 2001 From: flaky-claw Date: Wed, 29 Apr 2026 13:33:52 +0000 Subject: [PATCH] fix: stabilize flaky issue #67420 --- pkg/ddl/tests/tiflash/ddl_tiflash_test.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pkg/ddl/tests/tiflash/ddl_tiflash_test.go b/pkg/ddl/tests/tiflash/ddl_tiflash_test.go index 081670bba0133..57af2d6df3860 100644 --- a/pkg/ddl/tests/tiflash/ddl_tiflash_test.go +++ b/pkg/ddl/tests/tiflash/ddl_tiflash_test.go @@ -104,10 +104,12 @@ func createTiFlashContext(t *testing.T) (*tiflashContext, func()) { s.dom.SetStatsUpdating(true) tearDown := func() { + s.dom.Close() s.tiflash.Lock() - s.tiflash.StatusServer.Close() + if s.tiflash.StatusServer != nil { + s.tiflash.StatusServer.Close() + } s.tiflash.Unlock() - s.dom.Close() require.NoError(t, s.store.Close()) ddl.PollTiFlashInterval = 2 * time.Second } @@ -1124,12 +1126,13 @@ func TestTiFlashFailureProgressAfterAvailable(t *testing.T) { func TestTiFlashProgressAfterAvailable(t *testing.T) { s, teardown := createTiFlashContext(t) defer teardown() - tk := testkit.NewTestKit(t, s.store) + se := session.CreateSessionAndSetID(t, s.store) + defer se.Close() - tk.MustExec("use test") - tk.MustExec("drop table if exists ddltiflash") - tk.MustExec("create table ddltiflash(z int)") - tk.MustExec("alter table ddltiflash set tiflash replica 1") + session.MustExec(t, se, "use test") + session.MustExec(t, se, "drop table if exists ddltiflash") + session.MustExec(t, se, "create table ddltiflash(z int)") + session.MustExec(t, se, "alter table ddltiflash set tiflash replica 1") time.Sleep(ddl.PollTiFlashInterval * RoundToBeAvailable * 3) CheckTableAvailable(s.dom, t, 1, []string{})