mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
database/sql: fix nits in test
Change-Id: I451b33d8da8d97917f2b257e6a25392c6e6582db Reviewed-on: https://go-review.googlesource.com/36671 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
3c22e5ca27
commit
5630d39f0c
1 changed files with 5 additions and 3 deletions
|
|
@ -316,7 +316,7 @@ func TestQueryContext(t *testing.T) {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
if err := ctx.Err(); err != context.Canceled {
|
if err := ctx.Err(); err != context.Canceled {
|
||||||
t.Fatalf("context err = %v; want context.Canceled")
|
t.Fatalf("context err = %v; want context.Canceled", err)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
t.Fatalf("context err = nil; want context.Canceled")
|
t.Fatalf("context err = nil; want context.Canceled")
|
||||||
|
|
@ -365,7 +365,8 @@ func TestQueryContextWait(t *testing.T) {
|
||||||
defer closeDB(t, db)
|
defer closeDB(t, db)
|
||||||
prepares0 := numPrepares(t, db)
|
prepares0 := numPrepares(t, db)
|
||||||
|
|
||||||
ctx, _ := context.WithTimeout(context.Background(), time.Millisecond*15)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*15)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
// This will trigger the *fakeConn.Prepare method which will take time
|
// This will trigger the *fakeConn.Prepare method which will take time
|
||||||
// performing the query. The ctxDriverPrepare func will check the context
|
// performing the query. The ctxDriverPrepare func will check the context
|
||||||
|
|
@ -386,7 +387,8 @@ func TestTxContextWait(t *testing.T) {
|
||||||
db := newTestDB(t, "people")
|
db := newTestDB(t, "people")
|
||||||
defer closeDB(t, db)
|
defer closeDB(t, db)
|
||||||
|
|
||||||
ctx, _ := context.WithTimeout(context.Background(), time.Millisecond*15)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*15)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
tx, err := db.BeginTx(ctx, nil)
|
tx, err := db.BeginTx(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue