Skip to content

Commit

Permalink
server: add tests for empty query hang (#22740)
Browse files Browse the repository at this point in the history
  • Loading branch information
morgo authored Feb 11, 2021
1 parent 8fe8ecd commit d6a2b9a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,22 @@ 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 res := <-c1:
fmt.Println(res)
case <-time.After(30 * 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 @@ -196,6 +196,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 d6a2b9a

Please sign in to comment.