From 4d1d72f0bfc17fc19b78438616b9e4f8ea0dbb4c Mon Sep 17 00:00:00 2001 From: yedamo Date: Sat, 14 Aug 2021 17:18:37 +0800 Subject: [PATCH] server: fix goroutine leak in TestGracefulShutdown --- server/tidb_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/tidb_test.go b/server/tidb_test.go index ff64ec2cfeab1..a0c32ed5d80f0 100644 --- a/server/tidb_test.go +++ b/server/tidb_test.go @@ -1433,11 +1433,12 @@ func (ts *tidbTestSuite) TestNO_DEFAULT_VALUEFlag(c *C) { } func (ts *tidbTestSuite) TestGracefulShutdown(c *C) { - var err error - ts.store, err = mockstore.NewMockStore() + store, err := mockstore.NewMockStore() + defer store.Close() session.DisableStats4Test() c.Assert(err, IsNil) - ts.domain, err = session.BootstrapSession(ts.store) + dom, err := session.BootstrapSession(store) + defer dom.Close() c.Assert(err, IsNil) ts.tidbdrv = NewTiDBDriver(ts.store) cli := newTestServerClient()