@@ -95,6 +95,7 @@ func TestLiteInitStatsWithTableIDs(t *testing.T) {
9595 withStatsLease (t , - 1 , func () {
9696 dom , err = session .BootstrapSession (store )
9797 require .NoError (t , err )
98+ dom .InfoSyncer ().SetSessionManager (& testkit.MockSessionManager {})
9899 h := dom .StatsHandle ()
99100 _ , ok := h .Get (tbl1 .Meta ().ID )
100101 require .False (t , ok )
@@ -152,6 +153,7 @@ func TestNonLiteInitStatsWithTableIDs(t *testing.T) {
152153 withStatsLease (t , - 1 , func () {
153154 dom , err = session .BootstrapSession (store )
154155 require .NoError (t , err )
156+ dom .InfoSyncer ().SetSessionManager (& testkit.MockSessionManager {})
155157 is = dom .InfoSchema ()
156158 h := dom .StatsHandle ()
157159 _ , ok := h .Get (tbl1 .Meta ().ID )
@@ -365,20 +367,27 @@ func TestNonLiteInitStatsAndCheckTheLastTableStats(t *testing.T) {
365367 withStatsLease (t , - 1 , func () {
366368 dom , err = session .BootstrapSession (store )
367369 require .NoError (t , err )
370+ dom .InfoSyncer ().SetSessionManager (& testkit.MockSessionManager {})
368371 is = dom .InfoSchema ()
369372 h := dom .StatsHandle ()
370373 _ , ok := h .Get (tbl1 .Meta ().ID )
371374 require .False (t , ok )
372375 require .NoError (t , h .InitStats (context .Background (), is ))
373376 stats1 , ok := h .Get (tbl1 .Meta ().ID )
374377 require .True (t , ok )
375- require .True (t , stats1 .GetIdx (1 ).IsFullLoad ())
378+ idx1 := stats1 .GetIdx (tbl1 .Meta ().Indices [0 ].ID )
379+ require .NotNil (t , idx1 )
380+ require .True (t , idx1 .IsFullLoad ())
376381 stats2 , ok := h .Get (tbl2 .Meta ().ID )
377382 require .True (t , ok )
378- require .True (t , stats2 .GetIdx (1 ).IsFullLoad ())
383+ idx2 := stats2 .GetIdx (tbl2 .Meta ().Indices [0 ].ID )
384+ require .NotNil (t , idx2 )
385+ require .True (t , idx2 .IsFullLoad ())
379386 stats3 , ok := h .Get (tbl3 .Meta ().ID )
380387 require .True (t , ok )
381- require .True (t , stats3 .GetIdx (1 ).IsFullLoad ())
388+ idx3 := stats3 .GetIdx (tbl3 .Meta ().Indices [0 ].ID )
389+ require .NotNil (t , idx3 )
390+ require .True (t , idx3 .IsFullLoad ())
382391
383392 dom .Close ()
384393 })
0 commit comments