1
0
mirror of https://github.com/golang/go synced 2024-11-14 08:40:27 -07:00

database/sql: make tests repeatable with -cpu=n,n

New test added in CL 14611045 causes a deadlock when
running the tests with -cpu=n,n because the fakedb
driver always waits when opening a new connection after
running TestConnectionLeak.  Reset its state after.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/14780043
This commit is contained in:
Alberto García Hierro 2013-10-17 09:02:32 -07:00 committed by Brad Fitzpatrick
parent 078bcffcb8
commit e39eda1366

View File

@ -151,6 +151,8 @@ func (d *fakeDriver) Open(dsn string) (driver.Conn, error) {
if d.waitCh != nil { if d.waitCh != nil {
d.waitingCh <- struct{}{} d.waitingCh <- struct{}{}
<-d.waitCh <-d.waitCh
d.waitCh = nil
d.waitingCh = nil
} }
return conn, nil return conn, nil
} }