mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
database/sql: do not rely on timeout for deadlock test
Fixes #46783 Change-Id: I8a8d1716279a041a7411c0c47a440a7997b39c80 Reviewed-on: https://go-review.googlesource.com/c/go/+/328649 Run-TryBot: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Trust: Carlos Amedee <carlos@golang.org>
This commit is contained in:
parent
86743e7d86
commit
b73cc4b02b
1 changed files with 2 additions and 1 deletions
|
|
@ -2838,9 +2838,10 @@ func TestTxStmtDeadlock(t *testing.T) {
|
||||||
db := newTestDB(t, "people")
|
db := newTestDB(t, "people")
|
||||||
defer closeDB(t, db)
|
defer closeDB(t, db)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Millisecond)
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
tx, err := db.BeginTx(ctx, nil)
|
tx, err := db.BeginTx(ctx, nil)
|
||||||
|
cancel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue