From 46236c695e2779bf60889c1aa3fc4a2cebe413df 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 a65cfef26d035..acb9eba25ce36 100644 --- a/pkg/ddl/tests/tiflash/ddl_tiflash_test.go +++ b/pkg/ddl/tests/tiflash/ddl_tiflash_test.go @@ -106,10 +106,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 } @@ -1144,12 +1146,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{})