From b73cc4b02b3801603b3ce0bcc57cf01d6aa9a4dd Mon Sep 17 00:00:00 2001 From: Daniel Theophanes Date: Wed, 16 Jun 2021 11:46:00 -0500 Subject: [PATCH] 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 TryBot-Result: Go Bot Reviewed-by: Bryan C. Mills Trust: Carlos Amedee --- src/database/sql/sql_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/database/sql/sql_test.go b/src/database/sql/sql_test.go index 80f63e877d..7d1cb9b85a 100644 --- a/src/database/sql/sql_test.go +++ b/src/database/sql/sql_test.go @@ -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) }