mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
database/sql: fix TestTxStmtDeadlock test
Drop error check because errors can be not only ErrTxDone for tx stmt executions, and the purpose of the test is just reproducing deadlock. Fixes #42259 Change-Id: I9e7105ada1403ec7064dcc1c3385b36893a1c195 Reviewed-on: https://go-review.googlesource.com/c/go/+/266097 Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Trust: Emmanuel Odeke <emmanuel@orijtech.com> Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
c1afbf69c7
commit
d8044a6744
1 changed files with 2 additions and 4 deletions
|
|
@ -2828,12 +2828,10 @@ func TestTxStmtDeadlock(t *testing.T) {
|
|||
}
|
||||
// Run number of stmt queries to reproduce deadlock from context cancel
|
||||
for i := 0; i < 1e3; i++ {
|
||||
// Encounter any close related errors (e.g. ErrTxDone, stmt is closed)
|
||||
// is expected due to context cancel.
|
||||
_, err = stmt.Query(1)
|
||||
if err != nil {
|
||||
// Encounter ErrTxDone here is expected due to context cancel
|
||||
if err != ErrTxDone {
|
||||
t.Fatalf("unexpected error while executing stmt, err: %v", err)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue