Skip to content

Commit

Permalink
executor: Improve the aesthetics of code review
Browse files Browse the repository at this point in the history
executor: Improve the aesthetics of code review pingcap#6130
  • Loading branch information
kangxiaoning authored Mar 24, 2018
1 parent 9164625 commit 671a7ad
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions executor/grant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,26 +176,26 @@ func (s *testSuite) TestColumnScope(c *C) {

func (s *testSuite) TestIssue2456(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("CREATE USER 'dduser'@'%' IDENTIFIED by '123456';")
tk.MustExec("GRANT ALL PRIVILEGES ON `dddb_%`.* TO 'dduser'@'%';")
tk.MustExec("GRANT ALL PRIVILEGES ON `dddb_%`.`te%` to 'dduser'@'%';")
tk.MustExec(`CREATE USER 'dduser'@'%' IDENTIFIED by '123456';`)
tk.MustExec(`GRANT ALL PRIVILEGES ON `dddb_%`.* TO 'dduser'@'%';`)
tk.MustExec(`GRANT ALL PRIVILEGES ON `dddb_%`.`te%` to 'dduser'@'%';`)
}

func (s *testSuite) TestCreateUserWhenGrant(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("DROP USER IF EXISTS 'test'@'%'")
tk.MustExec("GRANT ALL PRIVILEGES ON *.* to 'test'@'%' IDENTIFIED BY 'xxx'")
tk.MustExec(`DROP USER IF EXISTS 'test'@'%'`)
tk.MustExec(`GRANT ALL PRIVILEGES ON *.* to 'test'@'%' IDENTIFIED BY 'xxx'`)
// Make sure user is created automatically when grant to a non-exists one.
tk.MustQuery("SELECT user FROM mysql.user WHERE user='test' and host='%'").Check(
tk.MustQuery(`SELECT user FROM mysql.user WHERE user='test' and host='%'`).Check(
testkit.Rows("test"),
)
}

func (s *testSuite) TestIssue2654(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("DROP USER IF EXISTS 'test'@'%'")
tk.MustExec("CREATE USER 'test'@'%' IDENTIFIED BY 'test'")
tk.MustExec(`DROP USER IF EXISTS 'test'@'%'`)
tk.MustExec(`CREATE USER 'test'@'%' IDENTIFIED BY 'test'`)
tk.MustExec("GRANT SELECT ON test.* to 'test'")
rows := tk.MustQuery("SELECT user,host FROM mysql.user WHERE user='test' and host='%'")
rows.Check(testkit.Rows("test %"))
rows := tk.MustQuery(`SELECT user,host FROM mysql.user WHERE user='test' and host='%'`)
rows.Check(testkit.Rows(`test %`))
}

0 comments on commit 671a7ad

Please sign in to comment.