Skip to content

Commit

Permalink
Add tests for empty query
Browse files Browse the repository at this point in the history
  • Loading branch information
morgo committed Feb 5, 2021
1 parent 3171b98 commit dd89829
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,20 @@ func (cli *testServerClient) runTestIssue3680(c *C) {
c.Assert(err.Error(), Equals, "Error 1045: Access denied for user 'non_existing_user'@'127.0.0.1' (using password: NO)")
}

func (cli *testServerClient) runTestIssue22646(c *C) {
cli.runTests(c, nil, func(dbt *DBTest) {
c1 := make(chan string, 1)
go func() {
dbt.mustExec(``) // empty query.
c1 <- "success"
}()
select {
case <-time.After(4 * time.Second):
panic("read empty query statement timed out.")
}
})
}

func (cli *testServerClient) runTestIssue3682(c *C) {
cli.runTests(c, nil, func(dbt *DBTest) {
dbt.mustExec(`CREATE USER 'issue3682'@'%' IDENTIFIED BY '123';`)
Expand Down
1 change: 1 addition & 0 deletions server/tidb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ func (ts *tidbTestSuite) TestIssues(c *C) {
c.Parallel()
ts.runTestIssue3662(c)
ts.runTestIssue3680(c)
ts.runTestIssue22646(c)
}

func (ts *tidbTestSuite) TestDBNameEscape(c *C) {
Expand Down

0 comments on commit dd89829

Please sign in to comment.