aboutsummaryrefslogtreecommitdiff
path: root/src/database/sql/sql_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/sql/sql_test.go')
-rw-r--r--src/database/sql/sql_test.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/database/sql/sql_test.go b/src/database/sql/sql_test.go
index a9e18004fb..7be5fc917a 100644
--- a/src/database/sql/sql_test.go
+++ b/src/database/sql/sql_test.go
@@ -2724,7 +2724,7 @@ func TestManyErrBadConn(t *testing.T) {
}
}
-// Issue 34755: Ensure that a Tx cannot commit after a rollback.
+// Issue 34775: Ensure that a Tx cannot commit after a rollback.
func TestTxCannotCommitAfterRollback(t *testing.T) {
db := newTestDB(t, "tx_status")
defer closeDB(t, db)
@@ -2766,6 +2766,9 @@ func TestTxCannotCommitAfterRollback(t *testing.T) {
// 2. (A) Start a query, (B) begin Tx rollback through a ctx cancel.
// 3. Check if 2.A has committed in Tx (pass) or outside of Tx (fail).
sendQuery := make(chan struct{})
+ // The Tx status is returned through the row results, ensure
+ // that the rows results are not cancelled.
+ bypassRowsAwaitDone = true
hookTxGrabConn = func() {
cancel()
<-sendQuery
@@ -2776,6 +2779,7 @@ func TestTxCannotCommitAfterRollback(t *testing.T) {
defer func() {
hookTxGrabConn = nil
rollbackHook = nil
+ bypassRowsAwaitDone = false
}()
err = tx.QueryRow("SELECT|tx_status|tx_status|").Scan(&txStatus)