Skip to content

Commit

Permalink
database/sql: do not rely on timeout for deadlock test
Browse files Browse the repository at this point in the history
Fixes #46783

Change-Id: I8a8d1716279a041a7411c0c47a440a7997b39c80
Reviewed-on: https://go-review.googlesource.com/c/go/+/328649
Run-TryBot: Daniel Theophanes <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Bryan C. Mills <[email protected]>
Trust: Carlos Amedee <[email protected]>
  • Loading branch information
kardianos committed Jun 19, 2021
1 parent 86743e7 commit b73cc4b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/database/sql/sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2838,9 +2838,10 @@ func TestTxStmtDeadlock(t *testing.T) {
db := newTestDB(t, "people")
defer closeDB(t, db)

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Millisecond)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
tx, err := db.BeginTx(ctx, nil)
cancel()
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit b73cc4b

Please sign in to comment.