Skip to content

Commit

Permalink
more error check where it won't hide other errors
Browse files Browse the repository at this point in the history
  • Loading branch information
max-hoffman committed Dec 20, 2024
1 parent 112556b commit fc476f6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -791,13 +791,13 @@ func TestHandlerKillQuery(t *testing.T) {
var wg sync.WaitGroup
wg.Add(1)
sleepQuery := "SELECT SLEEP(100000)"
var sleepErr error
go func() {
defer wg.Done()
// need a local |err| variable to avoid being overwritten
_ = handler.ComQuery(context.Background(), conn1, sleepQuery, func(res *sqltypes.Result, more bool) error {
sleepErr = handler.ComQuery(context.Background(), conn1, sleepQuery, func(res *sqltypes.Result, more bool) error {
return nil
})
//require.Error(serr)
}()

time.Sleep(100 * time.Millisecond)
Expand Down Expand Up @@ -831,6 +831,8 @@ func TestHandlerKillQuery(t *testing.T) {
})
require.NoError(err)
wg.Wait()
require.Error(sleepErr)

time.Sleep(100 * time.Millisecond)
err = handler.ComQuery(context.Background(), conn2, "SHOW PROCESSLIST", func(res *sqltypes.Result, more bool) error {
// 1, , , test, Sleep, 0, ,
Expand Down

0 comments on commit fc476f6

Please sign in to comment.