@@ -16,17 +16,19 @@ package executor_test
16
16
import (
17
17
"context"
18
18
19
- "github.com/pingcap/tidb/planner/core"
20
-
21
19
. "github.com/pingcap/check"
22
20
"github.com/pingcap/parser/auth"
23
21
"github.com/pingcap/parser/model"
24
22
"github.com/pingcap/parser/mysql"
25
23
"github.com/pingcap/parser/terror"
24
+ "github.com/pingcap/tidb/config"
26
25
"github.com/pingcap/tidb/domain"
27
26
"github.com/pingcap/tidb/executor"
27
+ "github.com/pingcap/tidb/planner/core"
28
28
"github.com/pingcap/tidb/session"
29
29
"github.com/pingcap/tidb/sessionctx"
30
+ "github.com/pingcap/tidb/store/mockstore"
31
+ "github.com/pingcap/tidb/store/mockstore/mocktikv"
30
32
"github.com/pingcap/tidb/util/testkit"
31
33
"github.com/pingcap/tidb/util/testutil"
32
34
)
@@ -386,6 +388,31 @@ func (s *testSuite3) TestFlushPrivileges(c *C) {
386
388
// After flush.
387
389
_ , err = se .Execute (ctx , `SELECT Password FROM mysql.User WHERE User="testflush" and Host="localhost"` )
388
390
c .Check (err , IsNil )
391
+
392
+ }
393
+
394
+ type testFlushSuite struct {}
395
+
396
+ func (s * testFlushSuite ) TestFlushPrivilegesPanic (c * C ) {
397
+ // Run in a separate suite because this test need to set SkipGrantTable config.
398
+ cluster := mocktikv .NewCluster ()
399
+ mocktikv .BootstrapWithSingleStore (cluster )
400
+ mvccStore := mocktikv .MustNewMVCCStore ()
401
+ store , err := mockstore .NewMockTikvStore (
402
+ mockstore .WithCluster (cluster ),
403
+ mockstore .WithMVCCStore (mvccStore ),
404
+ )
405
+ c .Assert (err , IsNil )
406
+ defer store .Close ()
407
+
408
+ config .GetGlobalConfig ().Security .SkipGrantTable = true
409
+ dom , err := session .BootstrapSession (store )
410
+ c .Assert (err , IsNil )
411
+ defer dom .Close ()
412
+
413
+ tk := testkit .NewTestKit (c , store )
414
+ tk .MustExec ("FLUSH PRIVILEGES" )
415
+ config .GetGlobalConfig ().Security .SkipGrantTable = false
389
416
}
390
417
391
418
func (s * testSuite3 ) TestDropStats (c * C ) {
0 commit comments