From c96fa440cc02ec3e9ba92b94c6801f049b0605cd Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Fri, 26 Jul 2013 16:45:27 -0500 Subject: [PATCH] Test getSharedConnection handles dead connections If a test does something that kills a connection, it previously would break all subsequent tests that used the shared connection. It no longer does. --- helper_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helper_test.go b/helper_test.go index 8fca4223..bb8266b1 100644 --- a/helper_test.go +++ b/helper_test.go @@ -11,7 +11,7 @@ type test interface { var sharedConnection *pgx.Connection func getSharedConnection(t test) (c *pgx.Connection) { - if sharedConnection == nil { + if sharedConnection == nil || !sharedConnection.IsAlive() { var err error sharedConnection, err = pgx.Connect(*defaultConnectionParameters) if err != nil {