From b69b49ef342d319e889ced89b3dc68afeaf976e4 Mon Sep 17 00:00:00 2001 From: wjHuang Date: Thu, 2 Jul 2020 19:02:08 +0800 Subject: [PATCH] ddl: stabilize test TestParallelDDLBeforeRunDDLJob (#18227) Signed-off-by: wjhuang2016 --- ddl/db_change_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ddl/db_change_test.go b/ddl/db_change_test.go index 77493bd2b5..c3a9c6c66a 100644 --- a/ddl/db_change_test.go +++ b/ddl/db_change_test.go @@ -1321,6 +1321,8 @@ func (s *testStateChangeSuite) TestParallelDDLBeforeRunDDLJob(c *C) { se.SetConnectionID(firstConnID) _, err1 := se.Execute(context.Background(), "alter table test_table drop column c2") c.Assert(err1, IsNil) + // Sleep a while to make sure the connection 2 break out the first for loop in OnGetInfoSchemaExported, otherwise atomic.LoadInt32(&sessionCnt) == 2 will be false forever. + time.Sleep(100 * time.Millisecond) atomic.StoreInt32(&sessionCnt, finishedCnt) }() go func() {