diff options
| author | Daniel Theophanes <kardianos@gmail.com> | 2017-06-09 18:45:46 +0000 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2017-06-12 15:50:16 +0000 |
| commit | 3820191839a5b87acab5106b5fb43113d4f18b08 (patch) | |
| tree | 888b3a205de8546bd455ff0fef0dd7d560945983 /src/database/sql/sql_test.go | |
| parent | 0e9d293db773b443e1e37b7cfcb75a114989c041 (diff) | |
| download | go-3820191839a5b87acab5106b5fb43113d4f18b08.tar.xz | |
Revert "database/sql: Use Tx.ctx in Tx non-context methods"
This reverts commit ef0f7fb92b9458d7d35ee3c10ae853e3dc3077eb.
Reason for revert: Altered behavior of Queries prior to Tx commit. See #20631.
Change-Id: I2548507c2935a7c60b92aae377dcc8e9aca66331
Reviewed-on: https://go-review.googlesource.com/45231
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
Reviewed-by: Bulat Gaifullin <gaifullinbf@gmail.com>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/database/sql/sql_test.go')
| -rw-r--r-- | src/database/sql/sql_test.go | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/database/sql/sql_test.go b/src/database/sql/sql_test.go index 06877a6081..8a477edf1a 100644 --- a/src/database/sql/sql_test.go +++ b/src/database/sql/sql_test.go @@ -439,35 +439,6 @@ func TestTxContextWait(t *testing.T) { waitForFree(t, db, 5*time.Second, 0) } -// TestTxUsesContext tests the transaction behavior when the tx was created by context, -// but for query execution used methods without context -func TestTxUsesContext(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - - ctx, cancel := context.WithTimeout(context.Background(), 15*time.Millisecond) - defer cancel() - - tx, err := db.BeginTx(ctx, nil) - if err != nil { - // Guard against the context being canceled before BeginTx completes. - if err == context.DeadlineExceeded { - t.Skip("tx context canceled prior to first use") - } - t.Fatal(err) - } - - // This will trigger the *fakeConn.Prepare method which will take time - // performing the query. The ctxDriverPrepare func will check the context - // after this and close the rows and return an error. - _, err = tx.Query("WAIT|1s|SELECT|people|age,name|") - if err != context.DeadlineExceeded { - t.Fatalf("expected QueryContext to error with context deadline exceeded but returned %v", err) - } - - waitForFree(t, db, 5*time.Second, 0) -} - func TestMultiResultSetQuery(t *testing.T) { db := newTestDB(t, "people") defer closeDB(t, db) |
