test: fix the auth problem in the test of set replica for system tables (#25742)
This commit is contained in:
@ -29,6 +29,7 @@ import (
|
||||
"github.com/pingcap/errors"
|
||||
"github.com/pingcap/failpoint"
|
||||
"github.com/pingcap/parser/ast"
|
||||
"github.com/pingcap/parser/auth"
|
||||
"github.com/pingcap/parser/model"
|
||||
"github.com/pingcap/parser/mysql"
|
||||
"github.com/pingcap/parser/terror"
|
||||
@ -5340,13 +5341,19 @@ func (s *testSerialDBSuite) TestSetTableFlashReplicaForSystemTable(c *C) {
|
||||
memOrSysDB := []string{"MySQL", "INFORMATION_SCHEMA", "PERFORMANCE_SCHEMA", "METRICS_SCHEMA"}
|
||||
for _, db := range memOrSysDB {
|
||||
tk.MustExec("use " + db)
|
||||
tk.Se.Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil)
|
||||
rows := tk.MustQuery("show tables").Rows()
|
||||
for i := 0; i < len(rows); i++ {
|
||||
sysTables = append(sysTables, rows[i][0].(string))
|
||||
}
|
||||
for _, one := range sysTables {
|
||||
_, err := tk.Exec(fmt.Sprintf("alter table `%s` set tiflash replica 1", one))
|
||||
c.Assert(err.Error(), Equals, "[ddl:8200]ALTER table replica for tables in system database is currently unsupported")
|
||||
if db == "MySQL" {
|
||||
c.Assert(err.Error(), Equals, "[ddl:8200]ALTER table replica for tables in system database is currently unsupported")
|
||||
} else {
|
||||
c.Assert(err.Error(), Equals, fmt.Sprintf("[planner:1142]ALTER command denied to user 'root'@'%%' for table '%s'", strings.ToLower(one)))
|
||||
}
|
||||
|
||||
}
|
||||
sysTables = sysTables[:0]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user