Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

dep: check some privilege should be globally granted (#1366) #1375

Merged
merged 2 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions checker/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ func (s *testCheckerSuite) TestDumpPrivilegeChecking(c *tc.C) {
mock := s.initMockDB(c)
mock.ExpectQuery("SHOW GRANTS").WillReturnRows(sqlmock.NewRows([]string{"Grants for User"}).
AddRow("GRANT USAGE ON *.* TO 'haha'@'%'"))
c.Assert(CheckSyncConfig(context.Background(), cfgs), tc.ErrorMatches, "(.|\n)*lack of RELOAD,SELECT privilege(.|\n)*")
err := CheckSyncConfig(context.Background(), cfgs)
c.Assert(err, tc.ErrorMatches, "(.|\n)*lack.*RELOAD(.|\n)*")
c.Assert(err, tc.ErrorMatches, "(.|\n)*lack.*Select(.|\n)*")

mock = s.initMockDB(c)
mock.ExpectQuery("SHOW GRANTS").WillReturnRows(sqlmock.NewRows([]string{"Grants for User"}).
Expand All @@ -110,7 +112,9 @@ func (s *testCheckerSuite) TestReplicationPrivilegeChecking(c *tc.C) {
mock := s.initMockDB(c)
mock.ExpectQuery("SHOW GRANTS").WillReturnRows(sqlmock.NewRows([]string{"Grants for User"}).
AddRow("GRANT USAGE ON *.* TO 'haha'@'%'"))
c.Assert(CheckSyncConfig(context.Background(), cfgs), tc.ErrorMatches, "(.|\n)*lack of REPLICATION SLAVE,REPLICATION CLIENT privilege(.|\n)*")
err := CheckSyncConfig(context.Background(), cfgs)
c.Assert(err, tc.ErrorMatches, "(.|\n)*lack.*REPLICATION SLAVE(.|\n)*")
c.Assert(err, tc.ErrorMatches, "(.|\n)*lack.*REPLICATION CLIENT(.|\n)*")

mock = s.initMockDB(c)
mock.ExpectQuery("SHOW GRANTS").WillReturnRows(sqlmock.NewRows([]string{"Grants for User"}).
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ require (
github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3
github.com/pingcap/failpoint v0.0.0-20200702092429-9f69995143ce
github.com/pingcap/log v0.0.0-20201112100606-8f1e84a3abc8
github.com/pingcap/parser v0.0.0-20201222091346-02c8ff27d0bc
github.com/pingcap/tidb v1.1.0-beta.0.20201224021059-213942149427
github.com/pingcap/tidb-tools v4.0.10-0.20201127090955-2707c97b3853+incompatible
github.com/pingcap/parser v0.0.0-20210108074737-814a888e05e2
github.com/pingcap/tidb v1.1.0-beta.0.20210108095858-c2ee8d37c22f
github.com/pingcap/tidb-tools v4.0.10-0.20210106041835-b7bb2754a8df+incompatible
github.com/prometheus/client_golang v1.5.1
github.com/rakyll/statik v0.1.6
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726
github.com/siddontang/go-mysql v0.0.0-20200222075837-12e89848f047
github.com/soheilhy/cmux v0.1.4
Expand All @@ -39,6 +40,7 @@ require (
github.com/unrolled/render v1.0.1
go.etcd.io/etcd v0.5.0-alpha.5.0.20200824191128-ae9734ed278b
go.uber.org/zap v1.16.0
golang.org/x/exp v0.0.0-20200513190911-00229845015e // indirect
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
Expand Down
Loading